mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
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.
This commit is contained in:
parent
4a915ee541
commit
e4e6010cd4
2 changed files with 13 additions and 1 deletions
|
|
@ -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 ()
|
||||
|
|
|
|||
|
|
@ -75,9 +75,18 @@ protected:
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue