smoothen rendering of x-fades
[ardour.git] / libs / canvas / canvas / item.h
index e856c7e149c18a9a28ce013e4d47a1f634eff3d5..da061f5bfc7a7e6b975f28beada5df157a701501 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "pbd/signals.h"
 
+#include "canvas/visibility.h"
 #include "canvas/types.h"
 
 namespace ArdourCanvas
@@ -48,7 +49,7 @@ class Rect;
  *  and all except the `root group' have a pointer to their parent group.
  */
        
-class Item
+class LIBCANVAS_API Item
 {
 public:
        Item (Canvas *);
@@ -56,6 +57,8 @@ public:
        Item (Group *, Duple);
        virtual ~Item ();
 
+        void redraw () const;
+
        /** Render this item to a Cairo context.
         *  @param area Area to draw, in **window** coordinates
         *
@@ -73,6 +76,8 @@ public:
                items.push_back (this);
        }
 
+        virtual bool covers (Duple const &) const;
+
        /** Update _bounding_box and _bounding_box_dirty */
        virtual void compute_bounding_box () const = 0;
 
@@ -86,6 +91,21 @@ public:
        Group* parent () const {
                return _parent;
        }
+    
+        uint32_t depth() const;
+        const Item* closest_ancestor_with (const Item& other) const;
+        bool common_ancestor_within (uint32_t, const Item& other) const;
+
+        /** returns true if this item is an ancestor of @param candidate,
+        * and false otherwise. 
+        */
+        bool is_ancestor_of (const Item& candidate) const {
+               return candidate.is_descendant_of (*this);
+       }
+        /** returns true if this Item is a descendant of @param candidate,
+        * and false otherwise. 
+        */
+        bool is_descendant_of (const Item& candidate) const;
 
        void set_position (Duple);
        void set_x_position (Coord);
@@ -222,7 +242,7 @@ private:
        bool _ignore_events;
 };
 
-extern std::ostream& operator<< (std::ostream&, const ArdourCanvas::Item&);
+extern LIBCANVAS_API std::ostream& operator<< (std::ostream&, const ArdourCanvas::Item&);
 
 }