Code

switch to sigc++ signals for "modified" and "release"
[inkscape.git] / src / knot.h
index 71342b4ef0904c5193b847bee40c5fbd4e4c069b..bba49f3e7479c932d9ebbf1e1ec4ad69a5d2c749 100644 (file)
@@ -36,8 +36,7 @@ class SPKnotClass;
  * A knot is a draggable object, with callbacks to change something by
  * dragging it, visuably represented by a canvas item (mostly square).
  */
-struct SPKnot {
-    GObject object;
+struct SPKnot : GObject {
     SPDesktop *desktop;   /**< Desktop we are on. */
     SPCanvasItem *item;   /**< Our CanvasItem. */
     guint flags;
@@ -62,28 +61,32 @@ struct SPKnot {
 
     gchar *tip;
 
+    gulong _event_handler_id;
+
+    double pressure; /**< The tablet pen pressure when the knot is being dragged. */
+
     //TODO: all the members above should eventualle become private, accessible via setters/getters
-    void inline setSize (guint i) {size = i;}
-    void inline setShape (guint i) {shape = (SPKnotShapeType) i;}
-    void inline setAnchor (guint i) {anchor = (GtkAnchorType) i;}
-    void inline setMode (guint i) {mode = (SPKnotModeType) i;}
-    void inline setPixbuf (gpointer p) {pixbuf = p;}
-    void inline setFill (guint32 normal, guint32 mouseover, guint32 dragging) {
+    inline void setSize (guint i) {size = i;}
+    inline void setShape (guint i) {shape = (SPKnotShapeType) i;}
+    inline void setAnchor (guint i) {anchor = (GtkAnchorType) i;}
+    inline void setMode (guint i) {mode = (SPKnotModeType) i;}
+    inline void setPixbuf (gpointer p) {pixbuf = p;}
+    inline void setFill (guint32 normal, guint32 mouseover, guint32 dragging) {
         fill[SP_KNOT_STATE_NORMAL] = normal;
         fill[SP_KNOT_STATE_MOUSEOVER] = mouseover;
         fill[SP_KNOT_STATE_DRAGGING] = dragging;
     }
-    void inline setStroke (guint32 normal, guint32 mouseover, guint32 dragging) {
+    inline void setStroke (guint32 normal, guint32 mouseover, guint32 dragging) {
         stroke[SP_KNOT_STATE_NORMAL] = normal;
         stroke[SP_KNOT_STATE_MOUSEOVER] = mouseover;
         stroke[SP_KNOT_STATE_DRAGGING] = dragging;
     }
-    void inline setImage (guchar* normal, guchar* mouseover, guchar* dragging) {
+    inline void setImage (guchar* normal, guchar* mouseover, guchar* dragging) {
         image[SP_KNOT_STATE_NORMAL] = normal;
         image[SP_KNOT_STATE_MOUSEOVER] = mouseover;
         image[SP_KNOT_STATE_DRAGGING] = dragging;
     }
-    void inline setCursor (GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging) {
+    inline void setCursor (GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging) {
         if (cursor[SP_KNOT_STATE_NORMAL]) {
             gdk_cursor_unref(cursor[SP_KNOT_STATE_NORMAL]);
         }
@@ -114,7 +117,6 @@ struct SPKnot {
 /// The SPKnot vtable.
 struct SPKnotClass {
     GObjectClass parent_class;
-
     gint (* event) (SPKnot *knot, GdkEvent *event);
 
     /*
@@ -140,13 +142,14 @@ GType sp_knot_get_type();
 SPKnot *sp_knot_new(SPDesktop *desktop, gchar const *tip = NULL);
 
 #define SP_KNOT_IS_VISIBLE(k) ((k->flags & SP_KNOT_VISIBLE) != 0)
-#define SP_KNOT_IS_MOSEOVER(k) ((k->flags & SP_KNOT_MOUSEOVER) != 0)
+#define SP_KNOT_IS_MOUSEOVER(k) ((k->flags & SP_KNOT_MOUSEOVER) != 0)
 #define SP_KNOT_IS_DRAGGING(k) ((k->flags & SP_KNOT_DRAGGING) != 0)
 #define SP_KNOT_IS_GRABBED(k) ((k->flags & SP_KNOT_GRABBED) != 0)
 
 void sp_knot_show(SPKnot *knot);
 void sp_knot_hide(SPKnot *knot);
 
+void sp_knot_set_flag(SPKnot *knot, guint flag, bool set);
 void sp_knot_update_ctrl(SPKnot *knot);
 
 void sp_knot_request_position(SPKnot *knot, NR::Point *pos, guint state);