diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-26 21:01:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-26 21:01:14 +0000 |
commit | 51ab5ccabf432540ca935065f6c6f40a96f42dad (patch) | |
tree | a5f062738bcedc33cd55b176168d532e4cc6d189 /gtk2_ardour/cairo_widget.cc | |
parent | ae3eb6e3f4f270a03ff297d1bbe7cd3f3a2159a9 (diff) |
new ArdourButton class, to start to provide more control over how our buttons work and appear; use ArdourButtons for monitor, solo isolate and solo safe buttons, and in the processor box; don't save UI config file (canvas colors) to the user's home dir unless one or more parameters were modified by the user
git-svn-id: svn://localhost/ardour2/branches/3.0@10311 d708f5d6-7413-0410-9779-e7cbd77b26cf
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 (); + } + } +} |