NOOP, remove trailing tabs/whitespace.
[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/alignment.h>
23 #include <cairo.h>
24
25 #include "gtkmm2ext/visibility.h"
26 #include "gtkmm2ext/binding_proxy.h"
27 #include "gtkmm2ext/slider_controller.h"
28
29 namespace Gtkmm2ext {
30
31 class LIBGTKMM2EXT_API BarController : public Gtk::Alignment
32 {
33   public:
34         BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>);
35
36         virtual ~BarController ();
37
38         void set_sensitive (bool yn);
39
40         PixFader::Tweaks tweaks() const { return _slider.tweaks (); }
41         void set_tweaks (PixFader::Tweaks t) { _slider.set_tweaks (t);}
42
43         sigc::signal<void> StartGesture;
44         sigc::signal<void> StopGesture;
45
46         /* export this to allow direct connection to button events */
47         Gtk::Widget& event_widget() { return _slider; }
48
49         /** Emitted when the adjustment spinner is activated or deactivated;
50          *  the parameter is true on activation, false on deactivation.
51          */
52         sigc::signal<void, bool> SpinnerActive;
53
54   protected:
55         bool on_button_press_event (GdkEventButton*);
56         bool on_button_release_event (GdkEventButton*);
57         void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
58
59         virtual std::string get_label (double& /*x*/) {
60                 return "";
61         }
62
63         private:
64         HSliderController _slider;
65         bool entry_focus_out (GdkEventFocus*);
66         void entry_activated ();
67         void before_expose ();
68
69         gint switch_to_bar ();
70         gint switch_to_spinner ();
71
72         bool _switching;
73         bool _switch_on_release;
74
75
76         void passtrhu_gesture_start() { StartGesture (); }
77         void passtrhu_gesture_stop()  { StopGesture (); }
78 };
79
80
81 }; /* namespace */
82
83 #endif // __gtkmm2ext_bar_controller_h__