Provide dialogs to edit pan values numerically, at least for
[ardour.git] / gtk2_ardour / panner_interface.h
1 /*
2     Copyright (C) 2011 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __gtk_ardour_panner_interface_h__
21 #define __gtk_ardour_panner_interface_h__
22
23 #include <boost/shared_ptr.hpp>
24 #include <gtkmm/drawingarea.h>
25 #include <gtkmm/label.h>
26 #include "pbd/destructible.h"
27
28 namespace ARDOUR {
29         class Panner;
30 }
31
32 class PannerEditor;
33
34 /** Parent class for some panner UI classes that contains some common code */
35 class PannerInterface : public Gtk::DrawingArea, public PBD::Destructible
36 {
37 public:
38         PannerInterface (boost::shared_ptr<ARDOUR::Panner>);
39         virtual ~PannerInterface ();
40
41         boost::shared_ptr<ARDOUR::Panner> panner () {
42                 return _panner;
43         }
44
45         void edit ();
46
47 protected:
48         virtual void set_drag_data () = 0;
49
50         void show_drag_data_window ();
51         void hide_drag_data_window ();
52         void value_change ();
53         
54         bool on_enter_notify_event (GdkEventCrossing *);
55         bool on_leave_notify_event (GdkEventCrossing *);
56         bool on_key_release_event  (GdkEventKey *);
57         bool on_button_press_event (GdkEventButton*);
58         bool on_button_release_event (GdkEventButton*);
59
60         boost::shared_ptr<ARDOUR::Panner> _panner;
61         Gtk::Window* _drag_data_window;
62         Gtk::Label*  _drag_data_label;
63         bool _dragging;
64
65 private:
66         bool drag_data_timeout ();
67         sigc::connection _drag_data_timeout;
68
69         virtual PannerEditor* editor () = 0;
70         PannerEditor* _editor;
71 };
72
73 #endif