This one's for oofus: optionally show solo mute status (FEATURE FREEZE my ass!)
[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     $Id$
18 */
19
20 #ifndef __gtkmm2ext_bar_controller_h__
21 #define __gtkmm2ext_bar_controller_h__
22
23 #include <gtkmm/frame.h>
24 #include <gtkmm/drawingarea.h>
25 #include <gtkmm2ext/binding_proxy.h>
26
27 namespace ARDOUR {
28         class Controllable;
29 }
30
31 namespace Gtkmm2ext {
32
33 class BarController : public Gtk::Frame
34 {
35   public:
36         BarController (Gtk::Adjustment& adj, PBD::Controllable&, sigc::slot<void,char*,unsigned int>);
37         virtual ~BarController () {}
38         
39         enum Style {
40                 LeftToRight,
41                 RightToLeft,
42                 Line,
43                 CenterOut,
44                 TopToBottom,
45                 BottomToTop
46         };
47
48         Style style() const { return _style; }
49         void set_style (Style);
50         void set_with_text (bool yn);
51         void set_use_parent (bool yn);
52
53         void set_sensitive (bool yn);
54
55         Gtk::SpinButton& get_spin_button() { return spinner; }
56
57         sigc::signal<void> StartGesture;
58         sigc::signal<void> StopGesture;
59
60         /* export this to allow direct connection to button events */
61
62         Gtk::Widget& event_widget() { return darea; }
63
64   protected:
65         Gtk::Adjustment&    adjustment;
66         BindingProxy        binding_proxy;
67         Gtk::DrawingArea    darea;
68         sigc::slot<void,char*,unsigned int> label_callback;
69         Glib::RefPtr<Pango::Layout> layout;
70         Style              _style;
71         bool                grabbed;
72         bool                switching;
73         bool                switch_on_release;
74         bool                with_text;
75         double              initial_value;
76         double              grab_x;
77         GdkWindow*          grab_window;
78         Gtk::SpinButton     spinner;
79         bool                use_parent;
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
88         gint mouse_control (double x, GdkWindow* w, double scaling);
89
90         gint switch_to_bar ();
91         gint switch_to_spinner ();
92
93         void entry_activated ();
94         void drop_grab ();
95 };
96
97
98 }; /* namespace */
99
100 #endif // __gtkmm2ext_bar_controller_h__