2 Copyright (C) 2006 Paul Davis
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.
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.
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.
20 #ifndef __gtkmm2ext_fader_h__
21 #define __gtkmm2ext_fader_h__
26 #include <gtkmm/adjustment.h>
28 #include <gtkmm2ext/binding_proxy.h>
29 #include "gtkmm2ext/cairo_widget.h"
31 #include <boost/shared_ptr.hpp>
33 #include "gtkmm2ext/visibility.h"
37 class LIBGTKMM2EXT_API Fader : public CairoWidget
40 Fader (Gtk::Adjustment& adjustment,
41 const Glib::RefPtr<Gdk::Pixbuf>& face_pixbuf,
42 const Glib::RefPtr<Gdk::Pixbuf>& active_face_pixbuf,
43 const Glib::RefPtr<Gdk::Pixbuf>& underlay_pixbuf,
44 const Glib::RefPtr<Gdk::Pixbuf>& handle_pixbuf,
45 const Glib::RefPtr<Gdk::Pixbuf>& active_handle_pixbuf,
54 void set_controllable (boost::shared_ptr<PBD::Controllable> c) { binding_proxy.set_controllable (c); }
55 void set_default_value (float);
56 void set_touch_cursor (const Glib::RefPtr<Gdk::Pixbuf>& touch_cursor);
57 void get_image_scales (double &x_scale, double &y_scale);
60 void get_handle_position (double& x, double& y);
62 void on_size_request (GtkRequisition*);
63 void on_size_allocate (Gtk::Allocation& alloc);
65 void render (cairo_t* cr, cairo_rectangle_t*);
66 bool on_button_press_event (GdkEventButton*);
67 bool on_button_release_event (GdkEventButton*);
68 bool on_motion_notify_event (GdkEventMotion*);
69 bool on_scroll_event (GdkEventScroll* ev);
70 bool on_enter_notify_event (GdkEventCrossing* ev);
71 bool on_leave_notify_event (GdkEventCrossing* ev);
74 Gtk::Adjustment& adjustment;
75 BindingProxy binding_proxy;
79 const Glib::RefPtr<Gdk::Pixbuf> _face_pixbuf;
80 const Glib::RefPtr<Gdk::Pixbuf> _active_face_pixbuf;
81 const Glib::RefPtr<Gdk::Pixbuf> _underlay_pixbuf;
82 const Glib::RefPtr<Gdk::Pixbuf> _handle_pixbuf;
83 const Glib::RefPtr<Gdk::Pixbuf> _active_handle_pixbuf;
91 GdkWindow* _grab_window;
92 Gdk::Cursor *_touch_cursor;
94 double _grab_start_mouse_x;
95 double _grab_start_mouse_y;
96 double _grab_start_handle_x;
97 double _grab_start_handle_y;
101 float _default_value;
104 void adjustment_changed ();
105 void update_unity_position ();
111 #endif /* __gtkmm2ext_fader_h__ */