2 Copyright (C) 2004 Paul Davis
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __gtkmm2ext_bar_controller_h__
20 #define __gtkmm2ext_bar_controller_h__
22 #include <gtkmm/frame.h>
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm2ext/binding_proxy.h>
32 class BarController : public Gtk::Frame
35 typedef sigc::slot<void,char*,unsigned int> LabelCallback;
37 BarController (Gtk::Adjustment& adj, PBD::Controllable&, LabelCallback lc = LabelCallback());
39 virtual ~BarController () {}
51 Style style() const { return _style; }
52 void set_style (Style);
53 void set_with_text (bool yn);
54 void set_use_parent (bool yn);
56 void set_sensitive (bool yn);
58 Gtk::SpinButton& get_spin_button() { return spinner; }
60 sigc::signal<void> StartGesture;
61 sigc::signal<void> StopGesture;
63 /* export this to allow direct connection to button events */
65 Gtk::Widget& event_widget() { return darea; }
66 PBD::Controllable* get_controllable() { return binding_proxy.get_controllable(); }
69 Gtk::Adjustment& adjustment;
70 BindingProxy binding_proxy;
71 Gtk::DrawingArea darea;
72 LabelCallback label_callback;
73 Glib::RefPtr<Pango::Layout> layout;
77 bool switch_on_release;
81 GdkWindow* grab_window;
82 Gtk::SpinButton spinner;
85 virtual bool button_press (GdkEventButton *);
86 virtual bool button_release (GdkEventButton *);
87 virtual bool motion (GdkEventMotion *);
88 virtual bool expose (GdkEventExpose *);
89 virtual bool scroll (GdkEventScroll *);
90 virtual bool entry_focus_out (GdkEventFocus*);
92 gint mouse_control (double x, GdkWindow* w, double scaling);
94 gint switch_to_bar ();
95 gint switch_to_spinner ();
97 void entry_activated ();
104 #endif // __gtkmm2ext_bar_controller_h__