#include "pbd/signals.h"
+#include "canvas/visibility.h"
#include "canvas/types.h"
namespace ArdourCanvas
* and all except the `root group' have a pointer to their parent group.
*/
-class Item
+class LIBCANVAS_API Item
{
public:
Item (Canvas *);
Item (Group *, Duple);
virtual ~Item ();
+ void redraw () const;
+
/** Render this item to a Cairo context.
- * @param area Area to draw in this item's coordinates.
+ * @param area Area to draw, in **window** coordinates
+ *
+ * Items must convert their own coordinates into window coordinates
+ * because Cairo is limited to a fixed point coordinate space that
+ * does not extend as far as the Ardour timeline. All rendering must
+ * be done using coordinates that do not exceed the (rough) limits
+ * of the canvas' window, to avoid odd errors within Cairo as it
+ * converts doubles into its fixed point format and then tesselates
+ * the results.
*/
virtual void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const = 0;
items.push_back (this);
}
+ virtual bool covers (Duple const &) const;
+
/** Update _bounding_box and _bounding_box_dirty */
virtual void compute_bounding_box () const = 0;
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);
Duple canvas_to_item (Duple const &) const;
void item_to_canvas (Coord &, Coord &) const;
Rect item_to_canvas (Rect const &) const;
+ Rect canvas_to_item (Rect const &) const;
Duple item_to_canvas (Duple const &) const;
+ Duple item_to_window (Duple const&) const;
+ Duple window_to_item (Duple const&) const;
+ Rect item_to_window (Rect const&) const;
+
void raise_to_top ();
void raise (int);
void lower_to_bottom ();
bool _ignore_events;
};
-extern std::ostream& operator<< (std::ostream&, const ArdourCanvas::Item&);
+extern LIBCANVAS_API std::ostream& operator<< (std::ostream&, const ArdourCanvas::Item&);
}