add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / adjustment.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ADJUSTMENT_H
4 #define _GTKMM_ADJUSTMENT_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* adjustment.h
12  * 
13  * Copyright (C) 1998-2002 The gtkmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 #include <gtkmm/object.h>
31
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkAdjustment GtkAdjustment;
35 typedef struct _GtkAdjustmentClass GtkAdjustmentClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37
38
39 namespace Gtk
40 { class Adjustment_Class; } // namespace Gtk
41 namespace Gtk
42 {
43
44 /** A class representing an adjustable bounded value.
45  *
46  * The Gtk::Adjustment object represents a value which has an associated
47  * lower and upper bound, together with step and page increments, and a page
48  * size.  It is used within several gtkmm widgets, including
49  * Gtk::SpinButton, Gtk::Viewport, and Gtk::Range (which is a base class for
50  * Gtk::HScrollbar, Gtk::VScrollbar, Gtk::HScale, and Gtk::VScale).
51  *
52  * The Gtk::Adjustment object does not update the value itself. Instead it
53  * is left up to the owner of the Gtk::Adjustment to control the value.
54  *
55  * The owner of the Gtk::Adjustment typically calls the value_changed() and
56  * changed() functions after changing the value and its bounds. This results
57  * in the emission of the "value_changed" or "changed" signal respectively. 
58  *
59  */
60
61 class Adjustment : public Object
62 {
63   public:
64 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65   typedef Adjustment CppObjectType;
66   typedef Adjustment_Class CppClassType;
67   typedef GtkAdjustment BaseObjectType;
68   typedef GtkAdjustmentClass BaseClassType;
69 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
70
71   virtual ~Adjustment();
72
73 #ifndef DOXYGEN_SHOULD_SKIP_THIS
74
75 private:
76   friend class Adjustment_Class;
77   static CppClassType adjustment_class_;
78
79   // noncopyable
80   Adjustment(const Adjustment&);
81   Adjustment& operator=(const Adjustment&);
82
83 protected:
84   explicit Adjustment(const Glib::ConstructParams& construct_params);
85   explicit Adjustment(GtkAdjustment* castitem);
86
87 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
88
89 public:
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91   static GType get_type()      G_GNUC_CONST;
92   static GType get_base_type() G_GNUC_CONST;
93 #endif
94
95   ///Provides access to the underlying C GtkObject.
96   GtkAdjustment*       gobj()       { return reinterpret_cast<GtkAdjustment*>(gobject_); }
97
98   ///Provides access to the underlying C GtkObject.
99   const GtkAdjustment* gobj() const { return reinterpret_cast<GtkAdjustment*>(gobject_); }
100
101
102 public:
103   //C++ methods used to invoke GTK+ virtual functions:
104 #ifdef GLIBMM_VFUNCS_ENABLED
105 #endif //GLIBMM_VFUNCS_ENABLED
106
107 protected:
108   //GTK+ Virtual Functions (override these to change behaviour):
109 #ifdef GLIBMM_VFUNCS_ENABLED
110 #endif //GLIBMM_VFUNCS_ENABLED
111
112   //Default Signal Handlers::
113 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
114   virtual void on_changed();
115   virtual void on_value_changed();
116 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
117
118
119 private:
120
121 public:
122
123   friend class Range;
124   friend class HScrollbar;
125   friend class VScrollbar;
126
127   /** Constructor to create an Adjustment object.
128    * @param value The initial value
129    * @param lower The minimum value
130    * @param upper The maximum value
131    * @param step_increment The step increment
132    * @param page_increment The page increment
133    * @param page_size The page size
134    */
135   Adjustment(double value, double lower, double upper, double step_increment = 1, double page_increment = 10, double page_size = 0);
136   
137   
138   /** Emits a "changed" signal from the Adjustment.  This is typically called by the owner of the Adjustment after it has changed any of the Adjustment fields other than the value.
139    */
140   void changed();
141   
142   /** Emits a "value_changed" signal from the Adjustment.  This is typically called by the owner of the Adjustment after it has changed the Adjustment value field.
143    */
144   void value_changed();
145
146   
147   /** Updates the Adjustment value to ensure that the range between the parameters @a lower  and @a upper  is in the current page (i.e.\ between @a value  and @a value  + @a page_size ).  If this range is larger than the page size, then only the start of it will be in the current page.  A "changed" signal will be emitted if the value is changed.
148    * @param upper The upper value.
149    * @param lower The lower value.
150    */
151   void clamp_page(double lower, double upper);
152
153   
154   /** Sets the current value of the Adjustment
155    * @param value The new value of the Adjustment.
156    */
157   void set_value(double value);
158   
159   /** Gets the current value of the adjustment. See
160    * set_value().
161    * @return The current value of the adjustment.
162    */
163   double get_value() const;
164
165   // Other internal fields accessors
166   /** Retrieve the @a lower member variable.
167    * @return The current value of @a lower.
168    */
169    double get_lower() const;
170  
171   /** Retrieve the @a upper member variable.
172    * @return The current value of @a upper.
173    */
174    double get_upper() const;
175  
176   /** Retrieve the @a step_increment variable.
177    * @return The current value of @a step_increment.
178    */
179    double get_step_increment() const;
180  
181   /** Retrieve the @a page_increment variable.
182    * @return The current value of @a page_increment.
183    */
184    double get_page_increment() const;
185  
186   /** Retrieve the @a page_size variable.
187    * @return The current value of @a page_size.
188    */
189    double get_page_size() const;
190  
191   // TODO: This section needs changing. We must be able to set more at a time,
192   // emitting "changed" signal only once.
193   /** Sets the @a lower member variable
194    * @param lower The value to set the @a lower member variable to.
195    */
196   void set_lower(double lower);
197   
198   /** Sets the @a upper member variable
199    * @param upper The value to set the @a upper member variable to.
200    */
201   void set_upper(double upper);
202
203   /** Sets the @a step_increment member variable
204    * @param incr The value to set the @a step_incrememnt member variable to.
205    */
206   void set_step_increment(double incr);
207
208   /** Sets the @a page_increment member variable
209    * @param incr The value to set the @a page_increment member variable to.
210    */
211   void set_page_increment(double incr);
212
213   /** Sets the @a page_size member variable
214    * @param size The value to set the @ page_size member varialbe to.
215    */
216   void set_page_size(double size);
217
218   
219   /**
220    * @par Prototype:
221    * <tt>void on_my_%changed()</tt>
222    */
223
224   Glib::SignalProxy0< void > signal_changed();
225
226   
227   /**
228    * @par Prototype:
229    * <tt>void on_my_%value_changed()</tt>
230    */
231
232   Glib::SignalProxy0< void > signal_value_changed();
233
234
235 };
236
237 } /* namespace Gtk */
238
239
240 namespace Glib
241 {
242   /** A Glib::wrap() method for this object.
243    * 
244    * @param object The C instance.
245    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
246    * @result A C++ instance that wraps this C instance.
247    *
248    * @relates Gtk::Adjustment
249    */
250   Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy = false);
251 } //namespace Glib
252
253
254 #endif /* _GTKMM_ADJUSTMENT_H */
255