2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_SPINBUTTON_H
4 #define _GTKMM_SPINBUTTON_H
10 /* Copyright (C) 1998-2002 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtkmm/entry.h>
28 #include <gtkmm/editable.h>
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 typedef struct _GtkSpinButton GtkSpinButton;
33 typedef struct _GtkSpinButtonClass GtkSpinButtonClass;
34 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
38 { class SpinButton_Class; } // namespace Gtk
43 /** @addtogroup gtkmmEnums Enums and Flags */
48 enum SpinButtonUpdatePolicy
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 class Value<Gtk::SpinButtonUpdatePolicy> : public Glib::Value_Enum<Gtk::SpinButtonUpdatePolicy>
65 static GType value_type() G_GNUC_CONST;
69 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
92 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97 class Value<Gtk::SpinType> : public Glib::Value_Enum<Gtk::SpinType>
100 static GType value_type() G_GNUC_CONST;
104 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
111 /** @ingroup gtkmmEnums */
112 enum { INPUT_ERROR = -1 };
116 /** numeric Entry with up/down buttons
117 * Slightly misnamed, this should be called a SpinEntry.
122 class SpinButton : public Entry
125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
126 typedef SpinButton CppObjectType;
127 typedef SpinButton_Class CppClassType;
128 typedef GtkSpinButton BaseObjectType;
129 typedef GtkSpinButtonClass BaseClassType;
130 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
132 virtual ~SpinButton();
134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
137 friend class SpinButton_Class;
138 static CppClassType spinbutton_class_;
141 SpinButton(const SpinButton&);
142 SpinButton& operator=(const SpinButton&);
145 explicit SpinButton(const Glib::ConstructParams& construct_params);
146 explicit SpinButton(GtkSpinButton* castitem);
148 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
151 #ifndef DOXYGEN_SHOULD_SKIP_THIS
152 static GType get_type() G_GNUC_CONST;
153 static GType get_base_type() G_GNUC_CONST;
156 ///Provides access to the underlying C GtkObject.
157 GtkSpinButton* gobj() { return reinterpret_cast<GtkSpinButton*>(gobject_); }
159 ///Provides access to the underlying C GtkObject.
160 const GtkSpinButton* gobj() const { return reinterpret_cast<GtkSpinButton*>(gobject_); }
164 //C++ methods used to invoke GTK+ virtual functions:
167 //GTK+ Virtual Functions (override these to change behaviour):
169 //Default Signal Handlers::
170 virtual int on_input(double* new_value);
171 virtual bool on_output();
172 virtual void on_value_changed();
181 // adjustment: see Gtk::Adjustment
183 // digits: number of decimal digits (has to be < 6)
184 SpinButton(double climb_rate = 0.0, guint digits = 0);
185 explicit SpinButton(Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0);
188 void configure(Adjustment& adjustment, double climb_rate, guint digits);
191 /** Replaces the Gtk::Adjustment associated with @a spin_button .
192 * @param adjustment A Gtk::Adjustment to replace the existing adjustment.
194 void set_adjustment(Adjustment& adjustment);
195 void unset_adjustment();
197 /** Get the adjustment associated with a Gtk::SpinButton
198 * @return The Gtk::Adjustment of @a spin_button .
200 Gtk::Adjustment* get_adjustment();
202 /** Get the adjustment associated with a Gtk::SpinButton
203 * @return The Gtk::Adjustment of @a spin_button .
205 const Gtk::Adjustment* get_adjustment() const;
208 /** Set the precision to be displayed by @a spin_button . Up to 20 digit precision
210 * @param digits The number of digits after the decimal point to be displayed for the spin button's value.
212 void set_digits(guint digits);
214 /** Fetches the precision of @a spin_button . See set_digits().
215 * @return The current precision.
217 guint get_digits() const;
220 /** Sets the step and page increments for spin_button. This affects how
221 * quickly the value changes when the spin button's arrows are activated.
222 * @param step Increment applied for a button 1 press.
223 * @param page Increment applied for a button 2 press.
225 void set_increments(double step, double page);
227 /** Gets the current step and page the increments used by @a spin_button . See
229 * @param step Location to store step increment, or <tt>0</tt>.
230 * @param page Location to store page increment, or <tt>0</tt>.
232 void get_increments(double& step, double& page) const;
235 /** Sets the minimum and maximum allowable values for @a spin_button
236 * @param min Minimum allowable value.
237 * @param max Maximum allowable value.
239 void set_range(double min, double max);
241 /** Gets the range allowed for @a spin_button . See
243 * @param min Location to store minimum allowed value, or <tt>0</tt>.
244 * @param max Location to store maximum allowed value, or <tt>0</tt>.
246 void get_range(double& min, double& max) const;
249 /** Get the value in the @a spin_button .
250 * @return The value of @a spin_button .
252 double get_value() const;
254 /** Get the value @a spin_button represented as an integer.
255 * @return The value of @a spin_button .
257 int get_value_as_int() const;
259 /** Set the value of @a spin_button .
260 * @param value The new value.
262 void set_value(double value);
265 /** Sets the update behavior of a spin button. This determines whether the
266 * spin button is always updated or only when a valid value is set.
267 * @param policy A Gtk::SpinButtonUpdatePolicy value.
269 void set_update_policy(SpinButtonUpdatePolicy policy);
271 /** Gets the update behavior of a spin button. See
272 * set_update_policy().
273 * @return The current update policy.
275 SpinButtonUpdatePolicy get_update_policy() const;
278 /** Sets the flag that determines if non-numeric text can be typed into
280 * @param numeric Flag indicating if only numeric entry is allowed.
282 void set_numeric(bool numeric = true);
284 /** Returns whether non-numeric text can be typed into the spin button.
286 * @return <tt>true</tt> if only numeric text can be entered.
288 bool get_numeric() const;
291 /** Increment or decrement a spin button's value in a specified direction
292 * by a specified amount.
293 * @param direction A Gtk::SpinType indicating the direction to spin.
294 * @param increment Step increment to apply in the specified direction.
296 void spin(SpinType direction, double increment);
299 /** Sets the flag that determines if a spin button value wraps around to the
300 * opposite limit when the upper or lower limit of the range is exceeded.
301 * @param wrap A flag indicating if wrapping behavior is performed.
303 void set_wrap(bool wrap = true);
305 /** Returns whether the spin button's value wraps around to the
306 * opposite limit when the upper or lower limit of the range is
307 * exceeded. See set_wrap().
308 * @return <tt>true</tt> if the spin button wraps around.
310 bool get_wrap() const;
313 /** Sets the policy as to whether values are corrected to the nearest step
314 * increment when a spin button is activated after providing an invalid value.
315 * @param snap_to_ticks A flag indicating if invalid values should be corrected.
317 void set_snap_to_ticks(bool snap_to_ticks = true);
319 /** Returns whether the values are corrected to the nearest step. See
320 * set_snap_to_ticks().
321 * @return <tt>true</tt> if values are snapped to the nearest step.
323 bool get_snap_to_ticks() const;
326 /** Manually force an update of the spin button.
330 /** Convert the Entry text to a number.
331 * The computed number should be written to <tt>*new_value</tt>.
333 * @li <tt>false</tt>: No conversion done, continue with default handler.
334 * @li <tt>true</tt>: Conversion successful, don't call default handler.
335 * @li <tt>Gtk::INPUT_ERROR</tt>: Conversion failed, don't call default handler.
339 Glib::SignalProxy1< int,double* > signal_input();
342 /** Convert the Adjustment position to text.
343 * The computed text should be written via Gtk::Entry::set_text().
345 * @li <tt>false</tt>: No conversion done, continue with default handler.
346 * @li <tt>true</tt>: Conversion successful, don't call default handler.
350 Glib::SignalProxy0< bool > signal_output();
353 Glib::SignalProxy0< void > signal_value_changed();
356 //Keybinding signals:
359 /** The adjustment that holds the value of the spinbutton.
361 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
362 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
363 * the value of the property changes.
365 Glib::PropertyProxy<Gtk::Adjustment*> property_adjustment() ;
367 /** The adjustment that holds the value of the spinbutton.
369 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
370 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
371 * the value of the property changes.
373 Glib::PropertyProxy_ReadOnly<Gtk::Adjustment*> property_adjustment() const;
375 /** The acceleration rate when you hold down a button.
377 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
378 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
379 * the value of the property changes.
381 Glib::PropertyProxy<double> property_climb_rate() ;
383 /** The acceleration rate when you hold down a button.
385 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
386 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
387 * the value of the property changes.
389 Glib::PropertyProxy_ReadOnly<double> property_climb_rate() const;
391 /** The number of decimal places to display.
393 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
394 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
395 * the value of the property changes.
397 Glib::PropertyProxy<guint> property_digits() ;
399 /** The number of decimal places to display.
401 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
402 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
403 * the value of the property changes.
405 Glib::PropertyProxy_ReadOnly<guint> property_digits() const;
407 /** Whether erroneous values are automatically changed to a spin button's nearest step increment.
409 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
410 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
411 * the value of the property changes.
413 Glib::PropertyProxy<bool> property_snap_to_ticks() ;
415 /** Whether erroneous values are automatically changed to a spin button's nearest step increment.
417 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
418 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
419 * the value of the property changes.
421 Glib::PropertyProxy_ReadOnly<bool> property_snap_to_ticks() const;
423 /** Whether non-numeric characters should be ignored.
425 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
426 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
427 * the value of the property changes.
429 Glib::PropertyProxy<bool> property_numeric() ;
431 /** Whether non-numeric characters should be ignored.
433 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
434 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
435 * the value of the property changes.
437 Glib::PropertyProxy_ReadOnly<bool> property_numeric() const;
439 /** Whether a spin button should wrap upon reaching its limits.
441 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
442 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
443 * the value of the property changes.
445 Glib::PropertyProxy<bool> property_wrap() ;
447 /** Whether a spin button should wrap upon reaching its limits.
449 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
450 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
451 * the value of the property changes.
453 Glib::PropertyProxy_ReadOnly<bool> property_wrap() const;
455 /** Whether the spin button should update always
457 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
458 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
459 * the value of the property changes.
461 Glib::PropertyProxy<SpinButtonUpdatePolicy> property_update_policy() ;
463 /** Whether the spin button should update always
465 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
466 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
467 * the value of the property changes.
469 Glib::PropertyProxy_ReadOnly<SpinButtonUpdatePolicy> property_update_policy() const;
471 /** Reads the current value
473 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
474 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
475 * the value of the property changes.
477 Glib::PropertyProxy<double> property_value() ;
479 /** Reads the current value
481 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
482 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
483 * the value of the property changes.
485 Glib::PropertyProxy_ReadOnly<double> property_value() const;
495 /** @relates Gtk::SpinButton
496 * @param object The C instance
497 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
498 * @result A C++ instance that wraps this C instance.
500 Gtk::SpinButton* wrap(GtkSpinButton* object, bool take_copy = false);
502 #endif /* _GTKMM_SPINBUTTON_H */