use volume controller widget for monitor section, drop some now-unused code
[ardour2.git] / libs / gtkmm2ext / gtkmm2ext / motionfeedback.h
blob84b2ae7154dc7795f21cfbb527893f8201d33115
1 /*
2 Copyright (C) 1998-99 Paul Barton-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.
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.
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.
17 $Id: motionfeedback.h,v 1.1.1.1 2001/11/24 00:44:46 pbd Exp $
20 #ifndef __gtkmm2ext_motion_feedback_h__
21 #define __gtkmm2ext_motion_feedback_h__
23 #include <gdkmm/pixbuf.h>
24 #include <gtkmm/box.h>
25 #include <gtkmm/eventbox.h>
27 #include "gtkmm2ext/binding_proxy.h"
28 #include "gtkmm2ext/prolooks-helpers.h"
30 namespace Gtk {
31 class Adjustment;
32 class SpinButton;
35 namespace Gtkmm2ext {
37 class MotionFeedback : public Gtk::VBox
39 public:
40 enum Type {
41 Rotary,
42 CenterSpring,
43 Endless
46 MotionFeedback (Glib::RefPtr<Gdk::Pixbuf>,
47 Type type,
48 const char *widget_name = NULL,
49 Gtk::Adjustment *adj = NULL,
50 bool with_numeric_display = true,
51 int sub_image_width = 40,
52 int sub_image_height = 40);
53 virtual ~MotionFeedback ();
55 void set_adjustment (Gtk::Adjustment *adj);
56 Gtk::Adjustment *get_adjustment () { return adjustment; }
58 Gtk::Widget& eventwin () { return pixwin; }
59 Gtk::SpinButton& spinner() const { return *value; }
61 gfloat lower () { return _lower; }
62 gfloat upper () { return _upper; }
63 gfloat range () { return _range; }
65 boost::shared_ptr<PBD::Controllable> controllable() const;
66 virtual void set_controllable (boost::shared_ptr<PBD::Controllable> c);
67 void set_lamp_color (const Gdk::Color&);
69 static Glib::RefPtr<Gdk::Pixbuf> render_pixbuf (int size);
71 protected:
72 gfloat _range;
73 gfloat _lower;
74 gfloat _upper;
76 void pixwin_size_request (GtkRequisition *);
78 bool pixwin_button_press_event (GdkEventButton *);
79 bool pixwin_button_release_event (GdkEventButton *);
80 bool pixwin_motion_notify_event (GdkEventMotion *);
81 bool pixwin_key_press_event (GdkEventKey *);
82 bool pixwin_enter_notify_event (GdkEventCrossing *);
83 bool pixwin_leave_notify_event (GdkEventCrossing *);
84 bool pixwin_focus_in_event (GdkEventFocus*);
85 bool pixwin_focus_out_event (GdkEventFocus *);
86 bool pixwin_expose_event (GdkEventExpose*);
87 bool pixwin_scroll_event (GdkEventScroll*);
88 void pixwin_realized ();
90 private:
91 Type type;
92 Gtk::EventBox pixwin;
93 Gtk::HBox* value_packer;
94 Gtk::SpinButton* value;
95 Gtk::Adjustment* adjustment;
96 Glib::RefPtr<Gdk::Pixbuf> pixbuf;
97 BindingProxy binding_proxy;
99 double default_value;
100 double step_inc;
101 double page_inc;
102 bool grab_is_fine;
103 double grabbed_y;
104 double grabbed_x;
105 bool i_own_my_adjustment;
106 int subwidth;
107 int subheight;
108 void adjustment_changed ();
110 ProlooksHSV* lamp_hsv;
111 Gdk::Color _lamp_color;
112 GdkColor lamp_bright;
113 GdkColor lamp_dark;
115 static void core_draw (cairo_t*, int, double, double, double, double, const GdkColor* bright, const GdkColor* dark);
118 } /* namespace */
120 #endif // __gtkmm2ext_motion_feedback_h__