added missing horizontal jumper icon
[dia.git] / lib / element.h
blob4ef43461916032029d001ee42ae9670548d7ae54
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 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 ELEMENT_H
19 #define ELEMENT_H
21 #include "diatypes.h"
22 #include "object.h"
23 #include "handle.h"
24 #include "connectionpoint.h"
25 #include "boundingbox.h"
27 /* This is a subclass of Object used to help implementing objects
28 * of a type with 8 handles around ..... more info here. */
29 struct _Element {
30 /* Object must be first because this is a 'subclass' of it. */
31 Object object;
33 Handle resize_handles[8];
35 Point corner;
36 real width;
37 real height;
39 ElementBBExtras extra_spacing;
42 void element_update_handles(Element *elem);
43 void element_update_boundingbox(Element *elem);
44 void element_init(Element *elem, int num_handles, int num_connections);
45 void element_destroy(Element *elem);
46 void element_copy(Element *from, Element *to);
47 void element_move_handle(Element *elem, HandleId id,
48 Point *to, HandleMoveReason reason);
49 void element_move_handle_aspect(Element *elem, HandleId id,
50 Point *to, real aspect_ratio);
52 void element_save(Element *elem, ObjectNode obj_node);
53 void element_load(Element *elem, ObjectNode obj_node);
55 /* base property stuff ... */
56 #define ELEMENT_COMMON_PROPERTIES \
57 OBJECT_COMMON_PROPERTIES, \
58 { "elem_corner", PROP_TYPE_POINT, 0, \
59 "Element corner", "The corner of the element"}, \
60 { "elem_width", PROP_TYPE_REAL, 0, \
61 "Element width", "The width of the element"}, \
62 { "elem_height", PROP_TYPE_REAL, 0, \
63 "Element height", "The height of the element"}
65 #define ELEMENT_COMMON_PROPERTIES_OFFSETS \
66 OBJECT_COMMON_PROPERTIES_OFFSETS, \
67 { "elem_corner", PROP_TYPE_POINT, offsetof(Element, corner) }, \
68 { "elem_width", PROP_TYPE_REAL, offsetof(Element, width) }, \
69 { "elem_height", PROP_TYPE_REAL, offsetof(Element, height) }
71 #endif /* ELEMENT_H */