diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-06 09:44:33 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-06 09:44:33 -0500 |
commit | e4e6010cd4671f8b7f90edeee0d41ad89bdf1192 (patch) | |
tree | 4acb3f9fd7b37c93654f978948242e1034856c47 | |
parent | 4a915ee54109fd07a226c0220bdb59057e7792e1 (diff) |
add on_name_changed() virtual method to CairoWidget
If a CairoWidget does not a GtkRC-defined style, then changing its name does not trigger on_style_changed(). Since we want to use CairoWidget::set_name()
to trigger changes in the rendering of a widget, this is ... bad. Adding on_name_changed() provides a workaround for that.
-rw-r--r-- | libs/gtkmm2ext/cairo_widget.cc | 5 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/cairo_widget.h | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc index e2149b9238..70c52bf177 100644 --- a/libs/gtkmm2ext/cairo_widget.cc +++ b/libs/gtkmm2ext/cairo_widget.cc @@ -20,14 +20,17 @@ #include "gtkmm2ext/cairo_widget.h" #include "gtkmm2ext/gui_thread.h" +#include "i18n.h" + static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info"; CairoWidget::CairoWidget () : _active_state (Gtkmm2ext::Off) , _visual_state (Gtkmm2ext::NoVisualState) , _need_bg (true) + , _name_proxy (this, X_("name")) { - + _name_proxy.connect (sigc::mem_fun (*this, &CairoWidget::on_name_changed)); } CairoWidget::~CairoWidget () diff --git a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h index 596b695da6..c8927b050b 100644 --- a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h +++ b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h @@ -74,10 +74,19 @@ protected: void on_size_allocate (Gtk::Allocation &); void on_state_changed (Gtk::StateType); Gdk::Color get_parent_bg (); + + /* this is an additional virtual "on_..." method. Glibmm does not + provide a direct signal for name changes, so this acts as a proxy. + */ + + virtual void on_name_changed () {}; Gtkmm2ext::ActiveState _active_state; Gtkmm2ext::VisualState _visual_state; bool _need_bg; + + private: + Glib::SignalProxyProperty _name_proxy; }; #endif |