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 "pbd/signals.h"
25 #include <gdkmm/pixbuf.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/eventbox.h>
30 #include "gtkmm2ext/visibility.h"
31 #include "gtkmm2ext/binding_proxy.h"
32 #include "gtkmm2ext/prolooks-helpers.h"
41 class LIBGTKMM2EXT_API MotionFeedback : public Gtk::VBox
50 MotionFeedback (Glib::RefPtr<Gdk::Pixbuf>,
52 boost::shared_ptr<PBD::Controllable>,
54 double step_increment,
55 double page_increment,
56 const char *widget_name = NULL,
57 bool with_numeric_display = true,
58 int sub_image_width = 40,
59 int sub_image_height = 40);
60 virtual ~MotionFeedback ();
62 Gtk::Widget& eventwin () { return pixwin; }
64 boost::shared_ptr<PBD::Controllable> controllable() const;
65 virtual void set_controllable (boost::shared_ptr<PBD::Controllable> c);
67 static void set_lamp_color (const std::string&);
69 static Glib::RefPtr<Gdk::Pixbuf> render_pixbuf (int size);
71 void set_print_func(void (*pf)(char buf[32], const boost::shared_ptr<PBD::Controllable>&, void *),
78 boost::shared_ptr<PBD::Controllable> _controllable;
84 void pixwin_size_request (GtkRequisition *);
86 bool pixwin_button_press_event (GdkEventButton *);
87 bool pixwin_button_release_event (GdkEventButton *);
88 bool pixwin_motion_notify_event (GdkEventMotion *);
89 bool pixwin_key_press_event (GdkEventKey *);
90 bool pixwin_enter_notify_event (GdkEventCrossing *);
91 bool pixwin_leave_notify_event (GdkEventCrossing *);
92 bool pixwin_focus_in_event (GdkEventFocus*);
93 bool pixwin_focus_out_event (GdkEventFocus *);
94 bool pixwin_expose_event (GdkEventExpose*);
95 bool pixwin_scroll_event (GdkEventScroll*);
97 /* map a display value (0.0 .. 1.0) to a control
98 value (controllable->lower() .. controllable()->upper)
100 virtual double to_control_value (double) = 0;
102 /* map a control value (controllable->lower() .. controllable()->upper)
103 to a display value (0.0 .. 1.0)
105 virtual double to_display_value (double) = 0;
107 virtual double adjust (double nominal_delta) = 0;
111 Gtk::EventBox pixwin;
112 Gtk::EventBox* value_packer;
113 Glib::RefPtr<Gdk::Pixbuf> pixbuf;
114 BindingProxy binding_proxy;
115 static Gdk::Color* base_color;
117 void (*print_func) (char buf[32], const boost::shared_ptr<PBD::Controllable>&, void *);
119 static void default_printer (char buf[32], const boost::shared_ptr<PBD::Controllable>&, void *);
126 void controllable_value_changed ();
127 PBD::ScopedConnection controller_connection;
129 static void core_draw (cairo_t*, int, double, double, double, double, const GdkColor* bright, const GdkColor* dark);
134 #endif // __gtkmm2ext_motion_feedback_h__