Slider Controller API Change
[ardour.git] / libs / gtkmm2ext / slider_controller.cc
1 /*
2     Copyright (C) 1998-99 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 #include <string>
21
22 #include <gtkmm2ext/gtk_ui.h>
23 #include <gtkmm2ext/pixfader.h>
24 #include <gtkmm2ext/slider_controller.h>
25 #include "pbd/controllable.h"
26
27 #include "i18n.h"
28
29 using namespace Gtkmm2ext;
30 using namespace PBD;
31
32 SliderController::SliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int orientation, int fader_length, int fader_girth)
33         : PixFader (*adj, orientation, fader_length, fader_girth)
34         , spin (*adj, 0, 2)
35 {                         
36         spin.set_name ("SliderControllerValue");
37         spin.set_numeric (true);
38         spin.set_snap_to_ticks (false);
39 }
40
41 bool 
42 SliderController::on_button_press_event (GdkEventButton *ev) 
43 {
44         if (binding_proxy.button_press_handler (ev)) {
45                 return true;
46         }
47
48         return PixFader::on_button_press_event (ev);
49 }
50
51 VSliderController::VSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int fader_length, int fader_girth)
52         : SliderController (adj, mc, VERT, fader_length, fader_girth)
53 {
54 }
55
56 HSliderController::HSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int fader_length, int fader_girth)
57         : SliderController (adj, mc, HORIZ, fader_length, fader_girth)
58 {
59 }