make CairoWidget respond to gtk_widget_set_state (INSENSITIVE)

git-svn-id: svn://localhost/ardour2/branches/3.0@10413 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2011-11-03 14:50:42 +00:00
parent 3e36dc7746
commit d555253fff
2 changed files with 17 additions and 0 deletions

View File

@@ -105,3 +105,19 @@ CairoWidget::set_visual_state (Gtkmm2ext::VisualState s)
StateChanged ();
}
}
void
CairoWidget::on_state_changed (Gtk::StateType)
{
/* this will catch GTK-level state changes from calls like
::set_sensitive()
*/
if (get_state() == Gtk::STATE_INSENSITIVE) {
set_visual_state (Gtkmm2ext::VisualState (visual_state() | Gtkmm2ext::Insensitive));
} else {
set_visual_state (Gtkmm2ext::VisualState (visual_state() & ~Gtkmm2ext::Insensitive));
}
queue_draw ();
}

View File

@@ -48,6 +48,7 @@ protected:
virtual void render (cairo_t *) = 0;
virtual bool on_expose_event (GdkEventExpose *);
void on_size_allocate (Gtk::Allocation &);
void on_state_changed (Gtk::StateType);
Gdk::Color get_parent_bg ();
int _width; ///< pixmap width