2006-12-03 Dimitris Glezos <dimitris@glezos.com>
[dia.git] / lib / connection.h
blobf4f74765f4f7e3028b0ad63f1a1b3e9dbe55dea4
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.
19 /** \file connection.h -- The basis of connections in Dia */
20 #ifndef CONNECTION_H
21 #define CONNECTION_H
23 #include "diatypes.h"
24 #include "object.h"
25 #include "boundingbox.h"
27 /*!
28 * \brief Base class for simple (straight) lines connecting object
30 * This is a subclass of DiaObject used to help implementing objects
31 * of a line-like type.
33 struct _Connection {
34 DiaObject object; /*!< inheritance */
36 Point endpoints[2]; /*!< start and end position */
37 Handle endpoint_handles[2]; /*!< start and end handles */
38 LineBBExtras extra_spacing; /*!< calcualted bounding box */
41 void connection_update_handles(Connection *conn);
42 void connection_update_boundingbox(Connection *conn);
43 void connection_init(Connection *conn,
44 int num_handles, int num_connections);
45 void connection_destroy(Connection *conn);
46 void connection_copy(Connection *from, Connection *to);
47 void connection_save(Connection *conn, ObjectNode obj_node);
48 void connection_load(Connection *conn, ObjectNode obj_node);
49 ObjectChange* connection_move_handle(Connection *conn, HandleId id,
50 Point *to, ConnectionPoint* cp,
51 HandleMoveReason reason,
52 ModifierKeys modifiers);
54 void connection_adjust_for_autogap(Connection *conn);
56 /* base property stuff... */
57 #define CONNECTION_COMMON_PROPERTIES \
58 OBJECT_COMMON_PROPERTIES, \
59 { "conn_endpoints", PROP_TYPE_ENDPOINTS, 0, "Connection endpoints", NULL}
61 #define CONNECTION_COMMON_PROPERTIES_OFFSETS \
62 OBJECT_COMMON_PROPERTIES_OFFSETS, \
63 { "conn_endpoints", PROP_TYPE_ENDPOINTS, offsetof(Connection,endpoints)}
65 #endif /* CONNECTION_H */