Merge branch 'master' into cairocanvas
[ardour.git] / libs / canvas / canvas / canvas.h
index 9b31844e7e4632a884884a3be232fb97668e7b36..e65abf6b2708e8bb8371356f293521fc9fe85b06 100644 (file)
@@ -79,15 +79,25 @@ public:
 
         virtual Cairo::RefPtr<Cairo::Context> context () = 0;
 
-       std::list<Rect> const & renders () const {
-               return _renders;
-       }
+        Rect canvas_to_window (Rect const&) const;
+        Rect window_to_canvas (Rect const&) const;
+        Duple canvas_to_window (Duple const&) const;
+        Duple window_to_canvas (Duple const&) const;
 
-       void set_log_renders (bool log) {
-               _log_renders = log;
-       }
+        void canvas_to_window (Coord cx, Coord cy, Coord& wx, Coord& wy) {
+               Duple d = canvas_to_window (Duple (cx, cy));
+               wx = d.x;
+               wy = d.y;
+        }
+
+        void window_to_canvas (Coord wx, Coord wy, Coord& cx, Coord& cy) {
+               Duple d = window_to_canvas (Duple (wx, wy));
+               cx = d.x;
+               cy = d.y;
+        }
 
         void scroll_to (Coord x, Coord y);
+        virtual Rect visible_area () const = 0;
 
         std::string indent() const;
         std::string render_indent() const;
@@ -99,11 +109,11 @@ protected:
        /** our root group */
        RootGroup _root;
 
-       mutable std::list<Rect> _renders;
-       bool _log_renders;
-
         Coord _scroll_offset_x;
         Coord _scroll_offset_y;
+
+        virtual void enter_leave_items (int state) = 0;
+        virtual void enter_leave_items (Duple const &, int state) = 0;
 };
 
 /** A canvas which renders onto a GTK EventBox */
@@ -119,11 +129,7 @@ public:
 
        Cairo::RefPtr<Cairo::Context> context ();
 
-        Rect canvas_to_window (Rect const&) const;
-        Rect window_to_canvas (Rect const&) const;
-
-        Duple canvas_to_window (Duple const&) const;
-        Duple window_to_canvas (Duple const&) const;
+       Rect visible_area () const;
 
 protected:
        bool on_expose_event (GdkEventExpose *);
@@ -135,6 +141,9 @@ protected:
        bool motion_notify_handler (GdkEventMotion *);
        bool deliver_event (Duple, GdkEvent *);
 
+        void enter_leave_items (int state);
+        void enter_leave_items (Duple const &, int state);
+
 private:
        void item_going_away (Item *, boost::optional<Rect>);
        bool send_leave_event (Item const *, double, double) const;
@@ -162,9 +171,6 @@ public:
                return &_canvas;
        }
 
-       void window_to_canvas (int, int, Coord &, Coord &) const;
-       Rect visible_area () const;
-
 protected:
        void on_size_request (Gtk::Requisition *);