ardour
auto_spin.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000 Paul Barton-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_auto_spin_h__
21 #define __gtkmm2ext_auto_spin_h__
22 
23 #ifdef interface
24 #undef interface
25 #endif
26 
27 #include <gtkmm.h>
28 
29 #include "gtkmm2ext/visibility.h"
30 
31 namespace Gtkmm2ext {
32 
34 
35 {
36  public:
37  AutoSpin (Gtk::Adjustment &adj, gfloat cr = 0, bool round_to_steps_yn = false);
38 
39  Gtk::Adjustment &get_adjustment() { return adjustment; }
40 
41  void use_left_as_decrement (bool yn) { left_is_decrement = yn; }
42  void set_wrap (bool yn) { wrap = yn; }
43  void set_climb_rate (gfloat cr) { climb_rate = cr; }
44  void set_bounds (gfloat initial, gfloat low, gfloat high,
45  bool with_reset = true);
46 
47  gint button_press (GdkEventButton *);
48  gint stop_spinning (GdkEventButton *ignored_but_here_for_clicked);
49  void start_spinning (bool decrementing, bool use_page);
50 
51  private:
52  Gtk::Adjustment &adjustment;
53  gfloat climb_rate;
55  gfloat initial;
56  unsigned int timer_calls;
57  bool have_timer;
58  bool need_timer;
59  bool wrap;
63 
64  static const unsigned int initial_timer_interval;
65  static const unsigned int timer_interval;
66  static const unsigned int climb_timer_calls;
67 
68  void stop_timer ();
69  static gint _timer (void *arg);
70  gint timer ();
71  bool adjust_value (gfloat increment);
72  void set_value (gfloat value);
73 };
74 
75 } /* namespace */
76 
77 #endif /* __gtkmm2ext_auto_spin_h__ */
void use_left_as_decrement(bool yn)
Definition: auto_spin.h:41
gfloat timer_increment
Definition: auto_spin.h:54
static const unsigned int timer_interval
Definition: auto_spin.h:65
LIBGTKMM2EXT_API
static const unsigned int climb_timer_calls
Definition: auto_spin.h:66
unsigned int timer_calls
Definition: auto_spin.h:56
void set_climb_rate(gfloat cr)
Definition: auto_spin.h:43
Gtk::Adjustment & adjustment
Definition: auto_spin.h:52
void set_wrap(bool yn)
Definition: auto_spin.h:42
Gtk::Adjustment & get_adjustment()
Definition: auto_spin.h:39
static const unsigned int initial_timer_interval
Definition: auto_spin.h:64