namespace ArdourCanvas
{
+struct Rect;
-class Rect;
-class Group;
+class Item;
class ScrollGroup;
/** The base class for our different types of canvas.
void render (Rect const &, Cairo::RefPtr<Cairo::Context> const &) const;
/** @return root group */
- Group* root () {
+ Item* root () {
return &_root;
}
}
void scroll_to (Coord x, Coord y);
- Duple scroll_offset() const { return _scroll_offset; }
void add_scroller (ScrollGroup& i);
- virtual Rect visible_area () const = 0;
+ virtual Rect visible_area () const = 0;
+ 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);
- /** our root group */
- RootGroup _root;
-
- Duple _scroll_offset;
+ /** our root item */
+ Root _root;
virtual void pick_current_item (int state) = 0;
virtual void pick_current_item (Duple const &, int state) = 0;
Cairo::RefPtr<Cairo::Context> context ();
Rect visible_area () const;
+ 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);