2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ADJUSTMENT_H
4 #define _GTKMM_ADJUSTMENT_H
13 * Copyright (C) 1998-2002 The gtkmm Development Team
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.
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.
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.
30 #include <gtkmm/object.h>
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkAdjustment GtkAdjustment;
35 typedef struct _GtkAdjustmentClass GtkAdjustmentClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40 { class Adjustment_Class; } // namespace Gtk
44 /** A class representing an adjustable bounded value.
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).
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.
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.
61 class Adjustment : public Object
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 */
71 virtual ~Adjustment();
73 #ifndef DOXYGEN_SHOULD_SKIP_THIS
76 friend class Adjustment_Class;
77 static CppClassType adjustment_class_;
80 Adjustment(const Adjustment&);
81 Adjustment& operator=(const Adjustment&);
84 explicit Adjustment(const Glib::ConstructParams& construct_params);
85 explicit Adjustment(GtkAdjustment* castitem);
87 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91 static GType get_type() G_GNUC_CONST;
92 static GType get_base_type() G_GNUC_CONST;
95 ///Provides access to the underlying C GtkObject.
96 GtkAdjustment* gobj() { return reinterpret_cast<GtkAdjustment*>(gobject_); }
98 ///Provides access to the underlying C GtkObject.
99 const GtkAdjustment* gobj() const { return reinterpret_cast<GtkAdjustment*>(gobject_); }
103 //C++ methods used to invoke GTK+ virtual functions:
104 #ifdef GLIBMM_VFUNCS_ENABLED
105 #endif //GLIBMM_VFUNCS_ENABLED
108 //GTK+ Virtual Functions (override these to change behaviour):
109 #ifdef GLIBMM_VFUNCS_ENABLED
110 #endif //GLIBMM_VFUNCS_ENABLED
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
124 friend class HScrollbar;
125 friend class VScrollbar;
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
135 Adjustment(double value, double lower, double upper, double step_increment = 1, double page_increment = 10, double page_size = 0);
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.
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.
144 void value_changed();
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.
151 void clamp_page(double lower, double upper);
154 /** Sets the current value of the Adjustment
155 * @param value The new value of the Adjustment.
157 void set_value(double value);
159 /** Gets the current value of the adjustment. See
161 * @return The current value of the adjustment.
163 double get_value() const;
165 // Other internal fields accessors
166 /** Retrieve the @a lower member variable.
167 * @return The current value of @a lower.
169 double get_lower() const;
171 /** Retrieve the @a upper member variable.
172 * @return The current value of @a upper.
174 double get_upper() const;
176 /** Retrieve the @a step_increment variable.
177 * @return The current value of @a step_increment.
179 double get_step_increment() const;
181 /** Retrieve the @a page_increment variable.
182 * @return The current value of @a page_increment.
184 double get_page_increment() const;
186 /** Retrieve the @a page_size variable.
187 * @return The current value of @a page_size.
189 double get_page_size() const;
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.
196 void set_lower(double lower);
198 /** Sets the @a upper member variable
199 * @param upper The value to set the @a upper member variable to.
201 void set_upper(double upper);
203 /** Sets the @a step_increment member variable
204 * @param incr The value to set the @a step_incrememnt member variable to.
206 void set_step_increment(double incr);
208 /** Sets the @a page_increment member variable
209 * @param incr The value to set the @a page_increment member variable to.
211 void set_page_increment(double incr);
213 /** Sets the @a page_size member variable
214 * @param size The value to set the @ page_size member varialbe to.
216 void set_page_size(double size);
221 * <tt>void on_my_%changed()</tt>
224 Glib::SignalProxy0< void > signal_changed();
229 * <tt>void on_my_%value_changed()</tt>
232 Glib::SignalProxy0< void > signal_value_changed();
237 } /* namespace Gtk */
242 /** A Glib::wrap() method for this object.
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.
248 * @relates Gtk::Adjustment
250 Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy = false);
254 #endif /* _GTKMM_ADJUSTMENT_H */