add MidiByteArray::compare_n()
[ardour.git] / gtk2_ardour / ardour_spinner.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  * Copyright (C) 2011 Paul Davis
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include <boost/algorithm/string.hpp>
21 #ifndef __gtk2_ardour_ardour_spinner_h__
22 #define __gtk2_ardour_ardour_spinner_h__
23
24 #include <gtkmm.h>
25
26 #include "ardour/automatable.h"
27 #include "ardour/automation_control.h"
28 #include "ardour_button.h"
29
30 class ArdourSpinner : public Gtk::Alignment
31 {
32         public:
33                 ArdourSpinner (
34                                 boost::shared_ptr<ARDOUR::AutomationControl>,
35                                 Gtk::Adjustment* adj,
36                                 boost::shared_ptr<ARDOUR::Automatable>);
37
38                 virtual ~ArdourSpinner ();
39
40         protected:
41                 bool on_button_press_event (GdkEventButton*);
42                 bool on_button_release_event (GdkEventButton*);
43                 bool on_scroll_event (GdkEventScroll* ev);
44
45                 void controllable_changed ();
46                 PBD::ScopedConnection watch_connection;
47
48         private:
49
50                 bool entry_focus_out (GdkEventFocus*);
51                 void entry_activated ();
52                 gint switch_to_button ();
53                 gint switch_to_spinner ();
54
55                 void ctrl_adjusted();
56                 void spin_adjusted();
57
58                 ArdourButton     _btn;
59                 Gtk::Adjustment* _ctrl_adj;
60                 Gtk::Adjustment  _spin_adj;
61                 Gtk::SpinButton  _spinner;
62                 bool             _switching;
63                 bool             _switch_on_release;
64                 bool             _ctrl_ignore;
65                 bool             _spin_ignore;
66
67                 boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
68                 boost::shared_ptr<ARDOUR::Automatable>       _printer;
69
70 };
71
72 #endif /* __gtk2_ardour_ardour_menu_h__ */