diff options
Diffstat (limited to 'libs/gtkmm2ext/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/auto_spin.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/barcontroller.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/bindable_button.h | 38 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/click_box.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/doi.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/fastmeter.h | 5 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/grouped_buttons.h | 48 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/gtk_ui.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/gtkutils.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/hexentry.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/pixfader.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/popup.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/prompter.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/selector.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/slider_controller.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/stateful_button.h | 59 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/tearoff.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/textviewer.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/utils.h | 1 |
19 files changed, 127 insertions, 38 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/auto_spin.h b/libs/gtkmm2ext/gtkmm2ext/auto_spin.h index 68da2249a0..b692a7ccdc 100644 --- a/libs/gtkmm2ext/gtkmm2ext/auto_spin.h +++ b/libs/gtkmm2ext/gtkmm2ext/auto_spin.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_auto_spin_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h index e5b8e31b58..c91f4c8a06 100644 --- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h +++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_bar_controller_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h index 1936125405..2ddd3628fc 100644 --- a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h +++ b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __bindable_button_h__ @@ -30,15 +29,46 @@ namespace PBD { class Controllable; } -class BindableToggleButton : public Gtk::ToggleButton +class BindableToggleButton : public Gtkmm2ext::StatefulToggleButton { public: BindableToggleButton (PBD::Controllable& c) : binding_proxy (c) {} - explicit BindableToggleButton (PBD::Controllable& c, const std::string &label) : Gtk::ToggleButton (label), binding_proxy (c) {} + + explicit BindableToggleButton (PBD::Controllable& c, const std::string &label) + : Gtkmm2ext::StatefulToggleButton (label), binding_proxy (c) {} + virtual ~BindableToggleButton() {} bool on_button_press_event (GdkEventButton *ev) { - return binding_proxy.button_press_handler (ev); + if (!binding_proxy.button_press_handler (ev)) { + StatefulToggleButton::on_button_press_event (ev); + return false; + } else { + return true; + } + } + + private: + BindingProxy binding_proxy; +}; + +class BindableButton : public Gtkmm2ext::StatefulButton +{ + public: + BindableButton (PBD::Controllable& c) : binding_proxy (c) {} + + explicit BindableButton (PBD::Controllable& c, const std::string &label) + : Gtkmm2ext::StatefulButton (label), binding_proxy (c) {} + + ~BindableButton() {} + + bool on_button_press_event (GdkEventButton *ev) { + if (!binding_proxy.button_press_handler (ev)) { + StatefulButton::on_button_press_event (ev); + return false; + } else { + return true; + } } private: diff --git a/libs/gtkmm2ext/gtkmm2ext/click_box.h b/libs/gtkmm2ext/gtkmm2ext/click_box.h index e4aee36ebe..8f9fb55717 100644 --- a/libs/gtkmm2ext/gtkmm2ext/click_box.h +++ b/libs/gtkmm2ext/gtkmm2ext/click_box.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_click_box_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/doi.h b/libs/gtkmm2ext/gtkmm2ext/doi.h index 16a9a6549c..6ad1f7dd94 100644 --- a/libs/gtkmm2ext/gtkmm2ext/doi.h +++ b/libs/gtkmm2ext/gtkmm2ext/doi.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __ardour_gtk_doi_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h index d624f29afb..775cb201cd 100644 --- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h +++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_fastmeter_h__ @@ -70,13 +69,13 @@ class FastMeter : public Gtk::DrawingArea { bool vertical_expose (GdkEventExpose*); bool horizontal_expose (GdkEventExpose*); - static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int); + static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int w, int h); static Glib::RefPtr<Gdk::Pixbuf> *v_pixbuf_cache; static int min_v_pixbuf_size; static int max_v_pixbuf_size; - static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int); + static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int w, int h); static Glib::RefPtr<Gdk::Pixbuf> *h_pixbuf_cache; static int min_h_pixbuf_size; diff --git a/libs/gtkmm2ext/gtkmm2ext/grouped_buttons.h b/libs/gtkmm2ext/gtkmm2ext/grouped_buttons.h new file mode 100644 index 0000000000..99d9f8ffc4 --- /dev/null +++ b/libs/gtkmm2ext/gtkmm2ext/grouped_buttons.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2001 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __gtkmm2ext_grouped_buttons_h__ +#define __gtkmm2ext_grouped_buttons_h__ + +#include <stdint.h> + +#include <vector> +#include <sigc++/signal.h> + +namespace Gtk { + class ToggleButton; +}; + +class GroupedButtons : public sigc::trackable +{ + public: + GroupedButtons (uint32_t nbuttons, uint32_t first_active); + GroupedButtons (std::vector<Gtk::ToggleButton *>&); + + Gtk::ToggleButton& button (uint32_t which) { + return *buttons[which]; + } + + private: + std::vector<Gtk::ToggleButton *> buttons; + uint32_t current_active; + void one_clicked (uint32_t which); +}; + +#endif /* __gtkmm2ext_grouped_buttons_h__ */ diff --git a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h index a692e64c9c..b6a52c6c0c 100644 --- a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h +++ b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __pbd_gtk_ui_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/gtkutils.h b/libs/gtkmm2ext/gtkmm2ext/gtkutils.h index 1841040560..832423f31d 100644 --- a/libs/gtkmm2ext/gtkmm2ext/gtkutils.h +++ b/libs/gtkmm2ext/gtkmm2ext/gtkutils.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkutils_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/hexentry.h b/libs/gtkmm2ext/gtkmm2ext/hexentry.h index 785d6eef36..410f54274e 100644 --- a/libs/gtkmm2ext/gtkmm2ext/hexentry.h +++ b/libs/gtkmm2ext/gtkmm2ext/hexentry.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_hexentry_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h index bb4176240a..d974f5d5bc 100644 --- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h +++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: fastmeter.h 570 2006-06-07 21:21:21Z sampo $ */ #ifndef __gtkmm2ext_pixfader_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/popup.h b/libs/gtkmm2ext/gtkmm2ext/popup.h index 89f14b4c50..1db357341d 100644 --- a/libs/gtkmm2ext/gtkmm2ext/popup.h +++ b/libs/gtkmm2ext/gtkmm2ext/popup.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __qui_popup_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/prompter.h b/libs/gtkmm2ext/gtkmm2ext/prompter.h index 9847e73661..10870ee752 100644 --- a/libs/gtkmm2ext/gtkmm2ext/prompter.h +++ b/libs/gtkmm2ext/gtkmm2ext/prompter.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_prompter_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/selector.h b/libs/gtkmm2ext/gtkmm2ext/selector.h index 9eb07cfbfe..841742db03 100644 --- a/libs/gtkmm2ext/gtkmm2ext/selector.h +++ b/libs/gtkmm2ext/gtkmm2ext/selector.h @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkselector_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h index c137dbabf5..74ff36816b 100644 --- a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h +++ b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_slider_controller_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/stateful_button.h b/libs/gtkmm2ext/gtkmm2ext/stateful_button.h index f684903836..c86402e54e 100644 --- a/libs/gtkmm2ext/gtkmm2ext/stateful_button.h +++ b/libs/gtkmm2ext/gtkmm2ext/stateful_button.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __pbd_gtkmm_abutton_h__ @@ -27,28 +26,56 @@ namespace Gtkmm2ext { -class StatefulButton : public Gtk::Button +class StateButton { public: - StatefulButton(); - explicit StatefulButton(const std::string &label); - virtual ~StatefulButton() {} + StateButton(); + virtual ~StateButton() {} + + void set_visual_state (int); + int get_visual_state () { return visual_state; } + void set_self_managed (bool yn) { _self_managed = yn; } - void set_colors (const std::vector<Gdk::Color>& colors); - void set_state (int); - int get_state () { return current_state; } - void set_active (bool yn) { - set_state (yn ? 1 : 0); - } - + protected: + int visual_state; + bool _self_managed; + bool _is_realized; + + virtual std::string get_widget_name() const = 0; + virtual void set_widget_name (std::string) = 0; + virtual int get_widget_state() = 0; +}; + + +class StatefulToggleButton : public StateButton, public Gtk::ToggleButton +{ + public: + StatefulToggleButton() {} + explicit StatefulToggleButton(const std::string &label) : Gtk::ToggleButton (label) {} + ~StatefulToggleButton() {} protected: - std::vector<Gdk::Color> colors; - int current_state; - Gdk::Color saved_bg; - bool have_saved_bg; + void on_realize (); + void on_toggled (); + + std::string get_widget_name() const { return get_name(); } + void set_widget_name (std::string name) { set_name (name); get_child()->set_name (name); } + int get_widget_state() { return get_state(); } +}; +class StatefulButton : public StateButton, public Gtk::Button +{ + public: + StatefulButton() {} + explicit StatefulButton(const std::string &label) : Gtk::Button (label) {} + virtual ~StatefulButton() {} + + protected: void on_realize (); + + std::string get_widget_name() const { return get_name(); } + void set_widget_name (std::string name) { set_name (name); get_child()->set_name (name); } + int get_widget_state() { return get_state(); } }; }; diff --git a/libs/gtkmm2ext/gtkmm2ext/tearoff.h b/libs/gtkmm2ext/gtkmm2ext/tearoff.h index fd36cb6416..5e80892b98 100644 --- a/libs/gtkmm2ext/gtkmm2ext/tearoff.h +++ b/libs/gtkmm2ext/gtkmm2ext/tearoff.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_tearoff_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/textviewer.h b/libs/gtkmm2ext/gtkmm2ext/textviewer.h index 280eb4437d..9cc639cd75 100644 --- a/libs/gtkmm2ext/gtkmm2ext/textviewer.h +++ b/libs/gtkmm2ext/gtkmm2ext/textviewer.h @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __pbd_gtkmm_textviewer_h__ diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index 97dab523aa..ca1b88abba 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __gtkmm2ext_utils_h__ |