waf build works on OS X ; new bindings file and processing system in place for mnemon...
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / barcontroller.h
1 /*
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.
7
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.
12
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.
16
17 */
18
19 #ifndef __gtkmm2ext_bar_controller_h__
20 #define __gtkmm2ext_bar_controller_h__
21
22 #include <gtkmm/frame.h>
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm2ext/binding_proxy.h>
25
26
27 namespace Gtkmm2ext {
28
29 class BarController : public Gtk::Frame
30 {
31   public:
32         BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>);
33
34         virtual ~BarController () {}
35
36         enum barStyle {
37                 LeftToRight,
38                 RightToLeft,
39                 Line,
40                 CenterOut,
41                 
42                 TopToBottom,
43                 BottomToTop
44         };
45
46         barStyle style() const { return _style; }
47         void set_style (barStyle);
48         void set_use_parent (bool yn);
49
50         void set_sensitive (bool yn);
51
52         sigc::signal<void> StartGesture;
53         sigc::signal<void> StopGesture;
54
55         /* export this to allow direct connection to button events */
56
57         Gtk::Widget& event_widget() { return darea; }
58
59         boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
60         void set_controllable(boost::shared_ptr<PBD::Controllable> c) { binding_proxy.set_controllable(c); }
61
62   protected:
63         Gtk::Adjustment&    adjustment;
64         BindingProxy        binding_proxy;
65         Gtk::DrawingArea    darea;
66         Glib::RefPtr<Pango::Layout> layout;
67         barStyle              _style;
68         bool                grabbed;
69         bool                switching;
70         bool                switch_on_release;
71         double              initial_value;
72         double              grab_x;
73         GdkWindow*          grab_window;
74         Gtk::SpinButton     spinner;
75         bool                use_parent;
76
77         virtual std::string get_label (int& /*x*/) {
78                 return "";
79         }
80         
81         virtual bool button_press (GdkEventButton *);
82         virtual bool button_release (GdkEventButton *);
83         virtual bool motion (GdkEventMotion *);
84         virtual bool expose (GdkEventExpose *);
85         virtual bool scroll (GdkEventScroll *);
86         virtual bool entry_focus_out (GdkEventFocus*);
87         virtual bool entry_input (double *);
88         virtual bool entry_output ();
89
90         gint mouse_control (double x, GdkWindow* w, double scaling);
91
92         gint switch_to_bar ();
93         gint switch_to_spinner ();
94
95         void entry_activated ();
96         void drop_grab ();
97 };
98
99
100 }; /* namespace */
101
102 #endif // __gtkmm2ext_bar_controller_h__