* of screen pixels, with an origin of (0, 0) at the top left. x increases
* rightwards and y increases downwards.
*/
-
+
class LIBCANVAS_API Canvas
{
public:
return &_root;
}
+ void set_background_color (ArdourCanvas::Color);
+ ArdourCanvas::Color background_color() const { return _bg_color; }
+
/** Called when an item is being destroyed */
virtual void item_going_away (Item *, boost::optional<Rect>) {}
void item_shown_or_hidden (Item *);
void item_changed (Item *, boost::optional<Rect>);
void item_moved (Item *, boost::optional<Rect>);
- virtual Cairo::RefPtr<Cairo::Context> context () = 0;
-
Duple canvas_to_window (Duple const&, bool rounded = true) const;
Duple window_to_canvas (Duple const&) const;
void scroll_to (Coord x, Coord y);
void add_scroller (ScrollGroup& i);
-
+
virtual Rect visible_area () const = 0;
virtual Coord width () const = 0;
virtual Coord height () const = 0;
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;
/** Set the timeout used to display tooltips, in milliseconds
*/
static void set_tooltip_timeout (uint32_t msecs);
-
+
protected:
- void queue_draw_item_area (Item *, Rect);
-
- /** our root item */
- Root _root;
+ Root _root;
+ Color _bg_color;
static uint32_t tooltip_timeout_msecs;
+ void queue_draw_item_area (Item *, Rect);
virtual void pick_current_item (int state) = 0;
virtual void pick_current_item (Duple const &, int state) = 0;
{
public:
GtkCanvas ();
+ ~GtkCanvas () { _in_dtor = true ; }
void request_redraw (Rect const &);
void request_size (Duple);
void focus (Item *);
void unfocus (Item*);
- Cairo::RefPtr<Cairo::Context> context ();
-
Rect visible_area () const;
Coord width() const;
Coord height() const;
bool get_mouse_position (Duple& winpos) const;
+ void set_single_exposure (bool s) { _single_exposure = s; }
+ bool single_exposure () { return _single_exposure; }
+
void re_enter ();
void start_tooltip_timeout (Item*);
void stop_tooltip_timeout ();
protected:
+ void on_size_allocate (Gtk::Allocation&);
bool on_scroll_event (GdkEventScroll *);
bool on_expose_event (GdkEventExpose *);
+ bool on_key_press_event (GdkEventKey *);
+ bool on_key_release_event (GdkEventKey *);
bool on_button_press_event (GdkEventButton *);
bool on_button_release_event (GdkEventButton* event);
bool on_motion_notify_event (GdkEventMotion *);
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
-
+
bool button_handler (GdkEventButton *);
bool motion_notify_handler (GdkEventMotion *);
bool deliver_event (GdkEvent *);
void deliver_enter_leave (Duple const & point, int state);
-
+
void pick_current_item (int state);
void pick_current_item (Duple const &, int state);
void item_going_away (Item *, boost::optional<Rect>);
bool send_leave_event (Item const *, double, double) const;
+ Cairo::RefPtr<Cairo::Surface> canvas_image;
+
/** Item currently chosen for event delivery based on pointer position */
Item * _current_item;
/** Item pending as _current_item */
/** the item that currently has key focus or 0 */
Item * _focused_item;
+ bool _single_exposure;
+
sigc::connection tooltip_timeout_connection;
Item* current_tooltip_item;
Gtk::Window* tooltip_window;
bool show_tooltip ();
void hide_tooltip ();
bool really_start_tooltip_timeout ();
+
+ bool _in_dtor;
};
/** A GTK::Alignment with a GtkCanvas inside it plus some Gtk::Adjustments for
- * scrolling.
+ * scrolling.
*
* This provides a GtkCanvas that can be scrolled. It does NOT implement the
* Gtk::Scrollable interface.