Text samples
[dia.git] / lib / connection.h
blob9dd99a908a8eddb40ff419dfd16267b0d657d290
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 CONNECTION_H
19 #define CONNECTION_H
21 #include "diatypes.h"
22 #include "object.h"
23 #include "boundingbox.h"
25 /* This is a subclass of DiaObject used to help implementing objects
26 * of a line-like type. */
27 struct _Connection {
28 /* DiaObject must be first because this is a 'subclass' of it. */
29 DiaObject object;
31 Point endpoints[2];
32 Handle endpoint_handles[2];
33 LineBBExtras extra_spacing;
36 void connection_update_handles(Connection *conn);
37 void connection_update_boundingbox(Connection *conn);
38 void connection_init(Connection *conn,
39 int num_handles, int num_connections);
40 void connection_destroy(Connection *conn);
41 void connection_copy(Connection *from, Connection *to);
42 void connection_save(Connection *conn, ObjectNode obj_node);
43 void connection_load(Connection *conn, ObjectNode obj_node);
44 ObjectChange* connection_move_handle(Connection *conn, HandleId id,
45 Point *to, ConnectionPoint* cp,
46 HandleMoveReason reason,
47 ModifierKeys modifiers);
49 /* base property stuff... */
50 #define CONNECTION_COMMON_PROPERTIES \
51 OBJECT_COMMON_PROPERTIES, \
52 { "conn_endpoints", PROP_TYPE_ENDPOINTS, 0, "Connection endpoints", NULL}
54 #define CONNECTION_COMMON_PROPERTIES_OFFSETS \
55 OBJECT_COMMON_PROPERTIES_OFFSETS, \
56 { "conn_endpoints", PROP_TYPE_ENDPOINTS, offsetof(Connection,endpoints)}
58 #endif /* CONNECTION_H */