delete slave during Session::destroy
[ardour.git] / libs / widgets / widgets / slider_controller.h
1 /*
2     Copyright (C) 1998-2006 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 _WIDGETS_SLIDER_CONTROLLER_H_
20 #define _WIDGETS_SLIDER_CONTROLLER_H_
21
22 #ifdef interface
23 #undef interface
24 #endif
25
26 #include <boost/shared_ptr.hpp>
27
28 #include <gtkmm/adjustment.h>
29 #include <gtkmm/spinbutton.h>
30
31 #include "widgets/ardour_fader.h"
32 #include "widgets/binding_proxy.h"
33 #include "widgets/visibility.h"
34
35 namespace PBD {
36         class Controllable;
37 }
38
39 namespace ArdourWidgets {
40
41 class LIBWIDGETS_API SliderController : public ArdourWidgets::ArdourFader
42 {
43 public:
44         SliderController (Gtk::Adjustment* adj, boost::shared_ptr<PBD::Controllable> mc, int orientation, int, int);
45
46         virtual ~SliderController () {}
47
48         Gtk::SpinButton& get_spin_button () { assert(_ctrl); return _spin; }
49         void set_controllable (boost::shared_ptr<PBD::Controllable> c) { _binding_proxy.set_controllable (c); }
50
51 protected:
52         bool on_button_press_event (GdkEventButton *ev);
53         bool on_enter_notify_event (GdkEventCrossing* ev);
54         bool on_leave_notify_event (GdkEventCrossing* ev);
55         void ctrl_adjusted();
56         void spin_adjusted();
57
58         BindingProxy _binding_proxy;
59         boost::shared_ptr<PBD::Controllable> _ctrl;
60         Gtk::Adjustment *_ctrl_adj;
61         Gtk::Adjustment _spin_adj;
62         Gtk::SpinButton _spin;
63         bool _ctrl_ignore;
64         bool _spin_ignore;
65 };
66
67 class LIBWIDGETS_API VSliderController : public SliderController
68 {
69 public:
70         VSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int, int);
71 };
72
73 class LIBWIDGETS_API HSliderController : public SliderController
74 {
75 public:
76         HSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int, int);
77 };
78
79 }; /* namespace */
80
81 #endif