X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fgtkmm2ext%2Fbarcontroller.h;h=76dc8f2d49fd0208dd1cd4d21982fc1bc71bbb25;hb=11619a37bff79c050e39e434bc9899b516cbe4a1;hp=1a4b78009d74575f9092ef214eac167f6faffc51;hpb=d09f6b3016bacbc2871a8946cbb24ad705076509;p=ardour.git diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h index 1a4b78009d..76dc8f2d49 100644 --- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h +++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h @@ -14,51 +14,44 @@ 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__ #define __gtkmm2ext_bar_controller_h__ -#include -#include +#include +#include +#include +#include -namespace MIDI { - class Controllable; -} namespace Gtkmm2ext { class BarController : public Gtk::Frame { public: - BarController (Gtk::Adjustment& adj, MIDI::Controllable*, sigc::slot); - virtual ~BarController () {} - - void set_bind_button_state (guint button, guint statemask); - void get_bind_button_state (guint &button, guint &statemask); - void midicontrol_set_tip (); - void midi_learn (); + BarController (Gtk::Adjustment& adj, boost::shared_ptr); - void set_sensitive (bool yn) { - darea.set_sensitive (yn); - } - - enum Style { + virtual ~BarController (); + + enum barStyle { LeftToRight, RightToLeft, Line, + Blob, CenterOut, + TopToBottom, BottomToTop }; - Style style() const { return _style; } - void set_style (Style); - void set_with_text (bool yn); + barStyle style() const { return _style; } + void set_style (barStyle); void set_use_parent (bool yn); - Gtk::SpinButton& get_spin_button() { return spinner; } + void set_sensitive (bool yn); + + void set_logarithmic (bool yn) { logarithmic = yn; } sigc::signal StartGesture; sigc::signal StopGesture; @@ -67,44 +60,57 @@ class BarController : public Gtk::Frame Gtk::Widget& event_widget() { return darea; } + boost::shared_ptr get_controllable() { return binding_proxy.get_controllable(); } + void set_controllable(boost::shared_ptr c) { binding_proxy.set_controllable(c); } + + /** Emitted when the adjustment spinner is activated or deactivated; + * the parameter is true on activation, false on deactivation. + */ + sigc::signal SpinnerActive; + protected: Gtk::Adjustment& adjustment; + BindingProxy binding_proxy; Gtk::DrawingArea darea; - Gtkmm2ext::PopUp prompter; - MIDI::Controllable* midi_control; - sigc::slot label_callback; - Style _style; + Glib::RefPtr layout; + barStyle _style; bool grabbed; bool switching; bool switch_on_release; - bool with_text; double initial_value; double grab_x; GdkWindow* grab_window; Gtk::SpinButton spinner; bool use_parent; + bool logarithmic; + sigc::slot _label_slot; + bool _use_slot; - guint bind_button; - guint bind_statemask; - bool prompting, unprompting; + virtual std::string get_label (double& /*x*/) { + return ""; + } - gint button_press (GdkEventButton *); - gint button_release (GdkEventButton *); - gint motion (GdkEventMotion *); - gint expose (GdkEventExpose *); + void create_patterns(); + Cairo::RefPtr pattern; + Cairo::RefPtr shine_pattern; - gint mouse_control (double x, GdkWindow* w, double scaling); + virtual bool button_press (GdkEventButton *); + virtual bool button_release (GdkEventButton *); + virtual bool motion (GdkEventMotion *); + virtual bool expose (GdkEventExpose *); + virtual bool scroll (GdkEventScroll *); + virtual bool entry_focus_out (GdkEventFocus*); - gint prompter_hiding (GdkEventAny *); - void midicontrol_prompt (); - void midicontrol_unprompt (); - void update_midi_control (); + gint mouse_control (double x, GdkWindow* w, double scaling); gint switch_to_bar (); gint switch_to_spinner (); void entry_activated (); - gint entry_focus_out (GdkEventFocus*); + void drop_grab (); + + int entry_input (double* new_value); + bool entry_output (); };