summaryrefslogtreecommitdiffstats
path: root/src/gui/Controls.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-28 06:02:14 +0000
committerDavid Robillard <d@drobilla.net>2010-01-28 06:02:14 +0000
commitcf099732084c20dfe45ae78b2d64816f2bf03ab6 (patch)
tree16e2042c653ea07acff74bc26515d24a0d193c76 /src/gui/Controls.cpp
parent2b7f487f515929099744c69afe22f85c332b2f20 (diff)
downloadingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.tar.gz
ingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.tar.bz2
ingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.zip
Shrink code (generic Control::enable and Control::disable by iterating over box).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2389 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/Controls.cpp')
-rw-r--r--src/gui/Controls.cpp68
1 files changed, 18 insertions, 50 deletions
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 6e2fd6be..8564fbed 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -76,6 +76,24 @@ Control::init(ControlPanel* panel, SharedPtr<PortModel> pm)
void
+Control::enable()
+{
+ for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin();
+ i != children().end(); ++i)
+ i->get_widget()->set_sensitive(true);
+}
+
+
+void
+Control::disable()
+{
+ for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin();
+ i != children().end(); ++i)
+ i->get_widget()->set_sensitive(false);
+}
+
+
+void
Control::set_name(const string& name)
{
const string name_markup = string("<span weight=\"bold\">") + name + "</span>";
@@ -223,24 +241,6 @@ SliderControl::set_range(float min, float max)
void
-SliderControl::enable()
-{
- _slider->property_sensitive() = true;
- _value_spinner->property_sensitive() = true;
- _name_label->property_sensitive() = true;
-}
-
-
-void
-SliderControl::disable()
-{
- _slider->property_sensitive() = false;
- _value_spinner->property_sensitive() = false;
- _name_label->property_sensitive() = false;
-}
-
-
-void
SliderControl::update_value_from_slider()
{
if (_enable_signal) {
@@ -353,22 +353,6 @@ ToggleControl::set_value(const Atom& val)
void
-ToggleControl::enable()
-{
- _checkbutton->property_sensitive() = true;
- _name_label->property_sensitive() = true;
-}
-
-
-void
-ToggleControl::disable()
-{
- _checkbutton->property_sensitive() = false;
- _name_label->property_sensitive() = false;
-}
-
-
-void
ToggleControl::toggled()
{
if (_enable_signal) {
@@ -422,22 +406,6 @@ StringControl::set_value(const Atom& val)
void
-StringControl::enable()
-{
- _entry->property_sensitive() = true;
- _name_label->property_sensitive() = true;
-}
-
-
-void
-StringControl::disable()
-{
- _entry->property_sensitive() = false;
- _name_label->property_sensitive() = false;
-}
-
-
-void
StringControl::activated()
{
if (_enable_signal)