add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / src / adjustment.hg
1 /* $Id: adjustment.hg,v 1.5 2006/11/08 21:51:35 murrayc Exp $ */
2
3 /* adjustment.h
4  * 
5  * Copyright (C) 1998-2002 The gtkmm Development Team
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include <gtkmm/object.h>
23 _DEFS(gtkmm,gtk)
24 _PINCLUDE(gtkmm/private/object_p.h)
25
26
27 namespace Gtk
28 {
29
30 /** A class representing an adjustable bounded value.
31  *
32  * The Gtk::Adjustment object represents a value which has an associated
33  * lower and upper bound, together with step and page increments, and a page
34  * size.  It is used within several gtkmm widgets, including
35  * Gtk::SpinButton, Gtk::Viewport, and Gtk::Range (which is a base class for
36  * Gtk::HScrollbar, Gtk::VScrollbar, Gtk::HScale, and Gtk::VScale).
37  *
38  * The Gtk::Adjustment object does not update the value itself. Instead it
39  * is left up to the owner of the Gtk::Adjustment to control the value.
40  *
41  * The owner of the Gtk::Adjustment typically calls the value_changed() and
42  * changed() functions after changing the value and its bounds. This results
43  * in the emission of the "value_changed" or "changed" signal respectively. 
44  *
45  */
46 class Adjustment : public Object
47 {
48   _CLASS_GTKOBJECT(Adjustment,GtkAdjustment,GTK_ADJUSTMENT,Gtk::Object,GtkObject)
49 public:
50
51   friend class Range;
52   friend class HScrollbar;
53   friend class VScrollbar;
54
55   /** Constructor to create an Adjustment object.
56    * @param value The initial value
57    * @param lower The minimum value
58    * @param upper The maximum value
59    * @param step_increment The step increment
60    * @param page_increment The page increment
61    * @param page_size The page size
62    */
63   Adjustment(double value, double lower, double upper, double step_increment = 1, double page_increment = 10, double page_size = 0);
64   
65   _WRAP_METHOD(void changed(), gtk_adjustment_changed)
66   _WRAP_METHOD(void value_changed(), gtk_adjustment_value_changed)
67
68   _WRAP_METHOD(void clamp_page(double lower, double upper), gtk_adjustment_clamp_page)
69
70   _WRAP_METHOD(void set_value(double value), gtk_adjustment_set_value)
71   _WRAP_METHOD(double get_value() const, gtk_adjustment_get_value)
72
73   // Other internal fields accessors
74   /** Retrieve the @a lower member variable.
75    * @return The current value of @a lower.
76    */
77   _MEMBER_GET(lower,lower,double,double)
78
79   /** Retrieve the @a upper member variable.
80    * @return The current value of @a upper.
81    */
82   _MEMBER_GET(upper,upper,double,double)
83
84   /** Retrieve the @a step_increment variable.
85    * @return The current value of @a step_increment.
86    */
87   _MEMBER_GET(step_increment,step_increment,double,double)
88
89   /** Retrieve the @a page_increment variable.
90    * @return The current value of @a page_increment.
91    */
92   _MEMBER_GET(page_increment,page_increment,double,double)
93
94   /** Retrieve the @a page_size variable.
95    * @return The current value of @a page_size.
96    */
97   _MEMBER_GET(page_size,page_size,double,double)
98
99   // TODO: This section needs changing. We must be able to set more at a time,
100   // emitting "changed" signal only once.
101   /** Sets the @a lower member variable
102    * @param lower The value to set the @a lower member variable to.
103    */
104   void set_lower(double lower);
105   
106   /** Sets the @a upper member variable
107    * @param upper The value to set the @a upper member variable to.
108    */
109   void set_upper(double upper);
110
111   /** Sets the @a step_increment member variable
112    * @param incr The value to set the @a step_incrememnt member variable to.
113    */
114   void set_step_increment(double incr);
115
116   /** Sets the @a page_increment member variable
117    * @param incr The value to set the @a page_increment member variable to.
118    */
119   void set_page_increment(double incr);
120
121   /** Sets the @a page_size member variable
122    * @param size The value to set the @ page_size member varialbe to.
123    */
124   void set_page_size(double size);
125
126   _WRAP_SIGNAL(void changed(), "changed")
127   _WRAP_SIGNAL(void value_changed(), "value_changed")
128
129 };
130
131 } /* namespace Gtk */
132