Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / ui / tool / control-point.h
index e59d6d5cfff64f9e09d9c21880a7b27c406973d1..3f5fe668d1dd322a2a424d2b2ec42181cd0f06e4 100644 (file)
@@ -17,7 +17,6 @@
 #include <gtkmm.h>
 #include <2geom/point.h>
 
-#include "display/display-forward.h"
 #include "forward.h"
 #include "util/accumulators.h"
 #include "display/sodipodi-ctrl.h"
@@ -73,11 +72,11 @@ public:
 
     /// @name Receive notifications about control point events
     /// @{
-    sigc::signal<void, Geom::Point const &, Geom::Point &, GdkEventMotion*> signal_dragged;
+    /*sigc::signal<void, Geom::Point const &, Geom::Point &, GdkEventMotion*> signal_dragged;
     sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_clicked;
     sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_doubleclicked;
     sigc::signal<bool, GdkEventMotion*>::accumulated<Int> signal_grabbed;
-    sigc::signal<void, GdkEventButton*> signal_ungrabbed;
+    sigc::signal<void, GdkEventButton*> signal_ungrabbed;*/
     /// @}
 
     /// @name Inspect the state of the control point
@@ -90,7 +89,7 @@ public:
     static sigc::signal<void, ControlPoint*> signal_mouseover_change;
     static Glib::ustring format_tip(char const *format, ...) G_GNUC_PRINTF(1,2);
 
-    // temporarily public, until snapping is refactored a little
+    // temporarily public, until snap delay is refactored a little
     virtual bool _eventHandler(GdkEvent *event);
 
 protected:
@@ -99,6 +98,39 @@ protected:
     ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, Gtk::AnchorType anchor,
         Glib::RefPtr<Gdk::Pixbuf> pixbuf, ColorSet *cset = 0, SPCanvasGroup *group = 0);
 
+    /// @name Handle control point events in subclasses
+    /// @{
+    /**
+     * Called when the user moves the point beyond the drag tolerance with the first button held
+     * down. Return true if you called transferGrab() during this method.
+     * @param event Motion event when drag tolerance was exceeded */
+    virtual bool grabbed(GdkEventMotion *event);
+    /**
+     * Called while dragging, but before moving the knot to new position.
+     * @param pos Old position, always equal to position()
+     * @param new_pos New position (after drag). This is passed as a non-const reference,
+     *   so you can change it from the handler - that's how constrained dragging is implemented.
+     * @param event Motion event */
+    virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event);
+    /**
+     * @var ControlPoint::signal_ungrabbed
+     * Emitted when the control point finishes a drag.
+     * @param event Button release event
+     */
+    virtual void ungrabbed(GdkEventButton *event);
+    /**
+     * Called when the control point is clicked, at mouse button release. Your override should
+     * return true if the click had some effect. If it did nothing, return false. Improperly
+     * implementing this method can cause the default context menu not to appear when a control
+     * point is right-clicked.
+     * @param event Button release event */
+    virtual bool clicked(GdkEventButton *event);
+    /**
+     * Called when the control point is doubleclicked, at mouse button release.
+     * @param event Button release event */
+    virtual bool doubleclicked(GdkEventButton *);
+    /// @}
+
     /// @name Manipulate the control point's appearance in subclasses
     /// @{
     virtual void _setState(State state);
@@ -166,4 +198,4 @@ extern ControlPoint::ColorSet invisible_cset;
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :