Code

moving trunk for module inkscape
[inkscape.git] / src / sp-conn-end-pair.h
1 #ifndef SEEN_SP_CONN_END_PAIR
2 #define SEEN_SP_CONN_END_PAIR
4 /*
5  * A class for handling connector endpoint movement and libavoid interaction.
6  *
7  * Authors:
8  *   Peter Moulder <pmoulder@mail.csse.monash.edu.au>
9  *
10  *    * Copyright (C) 2004 Monash University
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
14 #include <glib/gtypes.h>
16 #include "forward.h"
17 #include "libnr/nr-point.h"
18 #include <sigc++/connection.h>
19 #include <sigc++/functors/slot.h>
20 #include <sigc++/signal.h>
21 #include "libavoid/connector.h"
24 class SPConnEnd;
25 namespace Inkscape {
26 namespace XML {
27 class Node;
28 }
29 }
32 class SPConnEndPair {
33 public:
34     SPConnEndPair(SPPath *);
35     ~SPConnEndPair();
36     void release();
37     void setAttr(unsigned const key, gchar const *const value);
38     void writeRepr(Inkscape::XML::Node *const repr) const;
39     void getAttachedItems(SPItem *[2]) const;
40     void getEndpoints(NR::Point endPts[]) const;
41     void reroutePath(void);
42     void makePathInvalid(void);
43     void update(void);
44     bool isAutoRoutingConn(void);
45     void rerouteFromManipulation(void);
46     void reroute(void);
47     sigc::connection connectInvalidPath(sigc::slot<void, SPPath *> slot);
49     // A signal emited by a call back from libavoid.  Used to let 
50     // connectors know when they need to reroute themselves.
51     sigc::signal<void, SPPath *> _invalid_path_signal;
52     // A sigc connection to listen for connector path invalidation.
53     sigc::connection _invalid_path_connection;
55 private:
56     SPConnEnd *_connEnd[2];
57     
58     SPPath *_path;
60     // libavoid's internal representation of the item.
61     Avoid::ConnRef *_connRef;
63     int _connType;
64     
65     // A sigc connection for transformed signal.
66     sigc::connection _transformed_connection;
67 };
70 void sp_conn_end_pair_build(SPObject *object);
73 // _connType options:
74 enum {
75     SP_CONNECTOR_NOAVOID,    // Basic connector - a straight line.
76     SP_CONNECTOR_POLYLINE    // Object avoiding polyline.
77 };
80 #endif /* !SEEN_SP_CONN_END_PAIR */
82 /*
83   Local Variables:
84   mode:c++
85   c-file-style:"stroustrup"
86   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
87   indent-tabs-mode:nil
88   fill-column:99
89   End:
90 */
91 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :