From 19dd9c529cc9d8db47627274910d849d87bb160a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 21 Jun 2009 15:56:16 +0000 Subject: [PATCH] Added a few comments. git-svn-id: svn://localhost/ardour2/branches/3.0@5233 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/cairo_widget.cc | 4 ++++ gtk2_ardour/cairo_widget.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/cairo_widget.cc b/gtk2_ardour/cairo_widget.cc index 62d709bda5..573f3e5ba6 100644 --- a/gtk2_ardour/cairo_widget.cc +++ b/gtk2_ardour/cairo_widget.cc @@ -83,6 +83,10 @@ CairoWidget::on_expose_event (GdkEventExpose *event) return true; } +/** Marks the widget as dirty, so that render () will be called on + * the next GTK expose event. + */ + void CairoWidget::set_dirty () { diff --git a/gtk2_ardour/cairo_widget.h b/gtk2_ardour/cairo_widget.h index ee0bed114b..c274c0aaeb 100644 --- a/gtk2_ardour/cairo_widget.h +++ b/gtk2_ardour/cairo_widget.h @@ -22,6 +22,11 @@ #include +/** A parent class for widgets that are made up of a pixmap rendered using Cairo. + * The pixmap is painted to screen on GTK expose events, but the rendering + * is only done after set_dirty() has been called. + */ + class CairoWidget : public Gtk::EventBox { public: @@ -31,6 +36,7 @@ public: void set_dirty (); protected: + /** Render the widget to the given Cairo context */ virtual void render (cairo_t *) = 0; virtual bool on_expose_event (GdkEventExpose *); void on_size_allocate (Gtk::Allocation &); @@ -39,8 +45,8 @@ protected: int _height; ///< pixmap height private: - bool _dirty; - GdkPixmap* _pixmap; + bool _dirty; ///< true if the pixmap requires re-rendering + GdkPixmap* _pixmap; ///< our pixmap }; #endif