diff options
Diffstat (limited to 'gtk2_ardour/cairo_widget.cc')
-rw-r--r-- | gtk2_ardour/cairo_widget.cc | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/gtk2_ardour/cairo_widget.cc b/gtk2_ardour/cairo_widget.cc index 209770ab03..11fcfdffd6 100644 --- a/gtk2_ardour/cairo_widget.cc +++ b/gtk2_ardour/cairo_widget.cc @@ -21,10 +21,12 @@ #include "gui_thread.h" CairoWidget::CairoWidget () - : _width (1), - _height (1), - _dirty (true), - _pixmap (0) + : _width (1) + , _height (1) + , _state (CairoWidget::State (0)) + , _dirty (true) + , _pixmap (0) + { } @@ -109,3 +111,37 @@ CairoWidget::on_size_allocate (Gtk::Allocation& alloc) set_dirty (); } + +Gdk::Color +CairoWidget::get_parent_bg () +{ + Widget* parent; + + parent = get_parent (); + + while (parent && !parent->get_has_window()) { + parent = parent->get_parent(); + } + + if (parent && parent->get_has_window()) { + return parent->get_style ()->get_bg (parent->get_state()); + } + + return get_style ()->get_bg (get_state()); +} + +void +CairoWidget::set_state (CairoWidget::State s, bool yn) +{ + if (yn) { + if (!(_state & s)) { + _state = CairoWidget::State (_state|s); + StateChanged (); + } + } else { + if (_state & s) { + _state = CairoWidget::State (_state & ~s); + StateChanged (); + } + } +} |