ardour
pixscroller.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 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 __gtkmm2ext_pixscroller_h__
21 #define __gtkmm2ext_pixscroller_h__
22 
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm/adjustment.h>
25 #include <gdkmm.h>
26 
27 #include "gtkmm2ext/visibility.h"
28 
29 namespace Gtkmm2ext {
30 
31 class LIBGTKMM2EXT_API PixScroller : public Gtk::DrawingArea
32 {
33  public:
34  PixScroller(Gtk::Adjustment& adjustment,
35  Glib::RefPtr<Gdk::Pixbuf> slider,
36  Glib::RefPtr<Gdk::Pixbuf> rail);
37 
38  bool on_expose_event (GdkEventExpose*);
39  bool on_motion_notify_event (GdkEventMotion*);
40  bool on_button_press_event (GdkEventButton*);
41  bool on_button_release_event (GdkEventButton*);
42  bool on_scroll_event (GdkEventScroll*);
43  void on_size_request (GtkRequisition*);
44 
45  protected:
46  Gtk::Adjustment& adj;
47 
48  private:
49 
50  Cairo::RefPtr< Cairo::Context > rail_context;
51  Cairo::RefPtr< Cairo::ImageSurface > rail_surface;
52  Glib::RefPtr<Gdk::Pixbuf> rail;
53  Cairo::RefPtr< Cairo::Context > slider_context;
54  Cairo::RefPtr< Cairo::ImageSurface > slider_surface;
55  Glib::RefPtr<Gdk::Pixbuf> slider;
56  Gdk::Rectangle sliderrect;
57  Gdk::Rectangle railrect;
58  GdkWindow* grab_window;
59  double grab_y;
60  double grab_start;
62  bool dragging;
63 
65 
66  void adjustment_changed ();
67 };
68 
69 } // namespace
70 
71 #endif /* __gtkmm2ext_pixscroller_h__ */
GdkWindow * grab_window
Definition: pixscroller.h:58
LIBGTKMM2EXT_API
Gdk::Rectangle sliderrect
Definition: pixscroller.h:56
Cairo::RefPtr< Cairo::ImageSurface > rail_surface
Definition: pixscroller.h:51
Cairo::RefPtr< Cairo::Context > slider_context
Definition: pixscroller.h:53
Cairo::RefPtr< Cairo::ImageSurface > slider_surface
Definition: pixscroller.h:54
Glib::RefPtr< Gdk::Pixbuf > rail
Definition: pixscroller.h:52
Gdk::Rectangle railrect
Definition: pixscroller.h:57
Gtk::Adjustment & adj
Definition: pixscroller.h:46
Cairo::RefPtr< Cairo::Context > rail_context
Definition: pixscroller.h:50
Glib::RefPtr< Gdk::Pixbuf > slider
Definition: pixscroller.h:55