1 /* $Id: adjustment.hg,v 1.5 2006/11/08 21:51:35 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
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.
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.
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.
22 #include <gtkmm/object.h>
24 _PINCLUDE(gtkmm/private/object_p.h)
30 /** A class representing an adjustable bounded value.
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).
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.
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.
46 class Adjustment : public Object
48 _CLASS_GTKOBJECT(Adjustment,GtkAdjustment,GTK_ADJUSTMENT,Gtk::Object,GtkObject)
52 friend class HScrollbar;
53 friend class VScrollbar;
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
63 Adjustment(double value, double lower, double upper, double step_increment = 1, double page_increment = 10, double page_size = 0);
65 _WRAP_METHOD(void changed(), gtk_adjustment_changed)
66 _WRAP_METHOD(void value_changed(), gtk_adjustment_value_changed)
68 _WRAP_METHOD(void clamp_page(double lower, double upper), gtk_adjustment_clamp_page)
70 _WRAP_METHOD(void set_value(double value), gtk_adjustment_set_value)
71 _WRAP_METHOD(double get_value() const, gtk_adjustment_get_value)
73 // Other internal fields accessors
74 /** Retrieve the @a lower member variable.
75 * @return The current value of @a lower.
77 _MEMBER_GET(lower,lower,double,double)
79 /** Retrieve the @a upper member variable.
80 * @return The current value of @a upper.
82 _MEMBER_GET(upper,upper,double,double)
84 /** Retrieve the @a step_increment variable.
85 * @return The current value of @a step_increment.
87 _MEMBER_GET(step_increment,step_increment,double,double)
89 /** Retrieve the @a page_increment variable.
90 * @return The current value of @a page_increment.
92 _MEMBER_GET(page_increment,page_increment,double,double)
94 /** Retrieve the @a page_size variable.
95 * @return The current value of @a page_size.
97 _MEMBER_GET(page_size,page_size,double,double)
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.
104 void set_lower(double lower);
106 /** Sets the @a upper member variable
107 * @param upper The value to set the @a upper member variable to.
109 void set_upper(double upper);
111 /** Sets the @a step_increment member variable
112 * @param incr The value to set the @a step_incrememnt member variable to.
114 void set_step_increment(double incr);
116 /** Sets the @a page_increment member variable
117 * @param incr The value to set the @a page_increment member variable to.
119 void set_page_increment(double incr);
121 /** Sets the @a page_size member variable
122 * @param size The value to set the @ page_size member varialbe to.
124 void set_page_size(double size);
126 _WRAP_SIGNAL(void changed(), "changed")
127 _WRAP_SIGNAL(void value_changed(), "value_changed")
131 } /* namespace Gtk */