* lib/text.h: Added text_get_line() declaration
[dia.git] / lib / poly_conn.h
blob95c303d38f4bc406e71d1f8f3e28b382cbfab46d
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1999 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #ifndef POLY_CONN_H
19 #define POLY_CONN_H
21 #include "diatypes.h"
22 #include "object.h"
23 #include "boundingbox.h"
25 #define HANDLE_CORNER (HANDLE_CUSTOM1)
27 /* This is a subclass of DiaObject used to help implementing objects
28 * that connect points with polygonal line-segments.
30 struct _PolyConn {
31 /* DiaObject must be first because this is a 'subclass' of it. */
32 DiaObject object;
34 int numpoints; /* >= 2 */
35 Point *points;
37 PolyBBExtras extra_spacing;
41 void polyconn_update_data(PolyConn *poly);
42 void polyconn_update_boundingbox(PolyConn *poly);
43 void polyconn_simple_draw(PolyConn *poly, DiaRenderer *renderer, real width);
44 void polyconn_init(PolyConn *poly, int num_points);
45 void polyconn_set_points(PolyConn *poly, int num_points, Point *points);
46 void polyconn_destroy(PolyConn *poly);
47 void polyconn_copy(PolyConn *from, PolyConn *to);
48 void polyconn_save(PolyConn *poly, ObjectNode obj_node);
49 void polyconn_load(PolyConn *poly, ObjectNode obj_node); /* NOTE: Does object_init() */
50 ObjectChange *polyconn_add_point(PolyConn *poly, int segment, Point *point);
51 ObjectChange *polyconn_remove_point(PolyConn *poly, int point);
52 ObjectChange *polyconn_move_handle(PolyConn *poly, Handle *id,
53 Point *to, ConnectionPoint *cp,
54 HandleMoveReason reason,
55 ModifierKeys modifiers);
56 ObjectChange *polyconn_move(PolyConn *poly, Point *to);
57 real polyconn_distance_from(PolyConn *poly, Point *point,
58 real line_width);
59 Handle *polyconn_closest_handle(PolyConn *poly, Point *point);
60 int polyconn_closest_segment(PolyConn *poly, Point *point,
61 real line_width);
62 /* base property stuff... */
63 #define POLYCONN_COMMON_PROPERTIES \
64 OBJECT_COMMON_PROPERTIES, \
65 { "poly_points", PROP_TYPE_POINTARRAY, 0, "polconn points", NULL} \
67 #define POLYCONN_COMMON_PROPERTIES_OFFSETS \
68 OBJECT_COMMON_PROPERTIES_OFFSETS, \
69 { "poly_points", PROP_TYPE_POINTARRAY, \
70 offsetof(PolyConn,points), offsetof(PolyConn,numpoints)} \
72 #endif /* POLY_CONN_H */