Ardour  9.0-pre0-822-g12e3bc5c20
scroomer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _WIDGETS_SCROOMER_H_
21 #define _WIDGETS_SCROOMER_H_
22 
23 #include <ytkmm/drawingarea.h>
24 #include <ytkmm/adjustment.h>
25 
26 #include "widgets/visibility.h"
27 
28 namespace ArdourWidgets {
29 
30 class LIBWIDGETS_API Scroomer : public Gtk::DrawingArea
31 {
32 public:
33  enum Component {
34  TopBase = 0,
35  Handle1 = 1,
36  Slider = 2,
37  Handle2 = 3,
38  BottomBase = 4,
39  Total = 5,
40  None = 6
41  };
42 
43  Scroomer(Gtk::Adjustment& adjustment);
45 
46  bool on_motion_notify_event (GdkEventMotion*);
47  bool on_button_press_event (GdkEventButton*);
48  bool on_button_release_event (GdkEventButton*);
49  bool on_scroll_event (GdkEventScroll*);
50  virtual void on_size_allocate (Gtk::Allocation&);
51 
52  void set_comp_rect(GdkRectangle&, Component) const;
53 
54  Component point_in(double point) const;
55 
56  void set_min_page_size(double page_size);
57  int get_handle_size() { return handle_size; }
58 
59  inline int position_of(Component comp) { return position[comp]; }
60 
61  sigc::signal0<void> DragStarting;
62  sigc::signal0<void> DragFinishing;
63 
64  sigc::signal0<void> DoubleClicked;
65 
66 protected:
67  Gtk::Adjustment& adj;
68 
69 private:
70  struct UpdateRect {
71  GdkRectangle rect;
73  };
74 
75  void update();
77 
78  int position[6];
79  int old_pos[6];
81  double min_page_size;
82  GdkWindow* grab_window;
84  double grab_y;
85  double unzoomed_val;
86  double unzoomed_page;
87  bool pinch;
88 };
89 
90 } /* end namespace */
91 
92 #endif
void None
Definition: TypeList.h:49
sigc::signal0< void > DoubleClicked
Definition: scroomer.h:64
bool on_button_press_event(GdkEventButton *)
GdkWindow * grab_window
Definition: scroomer.h:82
Gtk::Adjustment & adj
Definition: scroomer.h:67
sigc::signal0< void > DragFinishing
Definition: scroomer.h:62
sigc::signal0< void > DragStarting
Definition: scroomer.h:61
int position_of(Component comp)
Definition: scroomer.h:59
void set_min_page_size(double page_size)
bool on_button_release_event(GdkEventButton *)
bool on_scroll_event(GdkEventScroll *)
Scroomer(Gtk::Adjustment &adjustment)
bool on_motion_notify_event(GdkEventMotion *)
virtual void on_size_allocate(Gtk::Allocation &)
Component point_in(double point) const
void set_comp_rect(GdkRectangle &, Component) const
#define LIBWIDGETS_API