change Metric element of a Canvas::Ruler item into a pointer internally
[ardour.git] / libs / canvas / canvas / canvas.h
index 94005f4cc76c06d3daccd9dc648e189411646764..c3ab322b67cf12079c277743c424650151d69f8d 100644 (file)
@@ -40,8 +40,8 @@
 
 namespace ArdourCanvas
 {
+struct Rect;
 
-class Rect;
 class Item;
 class ScrollGroup;
 
@@ -113,11 +113,33 @@ public:
         virtual Coord width () const = 0;
         virtual Coord height () const = 0;
 
+       /** Store the coordinates of the mouse pointer in window coordinates in
+          @param winpos. Return true if the position was within the window,
+          false otherwise.
+       */
+       virtual bool get_mouse_position (Duple& winpos) const = 0;
+
+       /** Signal to be used by items that need to track the mouse position
+          within the window.
+       */
+       sigc::signal<void,Duple const&> MouseMotion;
+
+       /** Ensures that the position given by @param winpos (in window
+           coordinates) is within the current window area, possibly reduced by
+           @param border.
+       */
+       Duple clamp_to_window (Duple const& winpos, Duple border = Duple());
+
         void zoomed();
     
         std::string indent() const;
         std::string render_indent() const;
         void dump (std::ostream&) const;
+
+       /** Ask the canvas to pick the current item again, and generate
+           an enter event for it.
+       */
+       virtual void re_enter () = 0;
     
 protected:
        void queue_draw_item_area (Item *, Rect);
@@ -150,7 +172,12 @@ public:
        Coord width() const;
        Coord height() const;
 
+       bool get_mouse_position (Duple& winpos) const;
+
+       void re_enter ();
+
 protected:
+       bool on_scroll_event (GdkEventScroll *);
        bool on_expose_event (GdkEventExpose *);
        bool on_button_press_event (GdkEventButton *);
        bool on_button_release_event (GdkEventButton* event);