I've no idea here...
[gtkD.git] / src / gtk / Adjustment.d
blob2eb24cf70176c3f7a01e6366eac9ed6d0d811fef
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkAdjustment.html
26 * outPack = gtk
27 * outFile = Adjustment
28 * strct = GtkAdjustment
29 * realStrct=
30 * ctorStrct=
31 * clss = Adjustment
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_adjustment_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.ObjectGtk
46 * structWrap:
47 * - GtkObject* -> ObjectGtk
48 * local aliases:
51 module gtk.Adjustment;
53 private import gtk.gtktypes;
55 private import lib.gtk;
57 private import gtk.ObjectGtk;
59 /**
60 * Description
61 * The GtkAdjustment object represents a value which has an associated lower
62 * and upper bound, together with step and page increments, and a page size.
63 * It is used within several GTK+ widgets, including
64 * GtkSpinButton, GtkViewport, and GtkRange (which is a base class for
65 * GtkHScrollbar, GtkVScrollbar, GtkHScale, and GtkVScale).
66 * The GtkAdjustment object does not update the value itself. Instead
67 * it is left up to the owner of the GtkAdjustment to control the value.
68 * The owner of the GtkAdjustment typically calls the
69 * gtk_adjustment_value_changed() and gtk_adjustment_changed() functions
70 * after changing the value and its bounds. This results in the emission of the
71 * "value_changed" or "changed" signal respectively.
73 private import gtk.ObjectGtk;
74 public class Adjustment : ObjectGtk
77 /** the main Gtk struct */
78 protected GtkAdjustment* gtkAdjustment;
81 public GtkAdjustment* getAdjustmentStruct()
83 return gtkAdjustment;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gtkAdjustment;
93 /**
94 * Sets our main struct and passes it to the parent class
96 public this (GtkAdjustment* gtkAdjustment)
98 super(cast(GtkObject*)gtkAdjustment);
99 this.gtkAdjustment = gtkAdjustment;
105 // imports for the signal processing
106 private import gobject.Signals;
107 private import gdk.gdktypes;
108 int[char[]] connectedSignals;
110 void delegate(Adjustment)[] onChangedListeners;
111 void addOnChanged(void delegate(Adjustment) dlg)
113 if ( !("changed" in connectedSignals) )
115 Signals.connectData(
116 getStruct(),
117 "changed",
118 cast(GCallback)&callBackChanged,
119 this,
120 null,
121 cast(ConnectFlags)0);
122 connectedSignals["changed"] = 1;
124 onChangedListeners ~= dlg;
126 extern(C) static void callBackChanged(GtkAdjustment* adjustmentStruct, Adjustment adjustment)
128 bit consumed = false;
130 foreach ( void delegate(Adjustment) dlg ; adjustment.onChangedListeners )
132 dlg(adjustment);
135 return consumed;
138 void delegate(Adjustment)[] onValueChangedListeners;
139 void addOnValueChanged(void delegate(Adjustment) dlg)
141 if ( !("value-changed" in connectedSignals) )
143 Signals.connectData(
144 getStruct(),
145 "value-changed",
146 cast(GCallback)&callBackValueChanged,
147 this,
148 null,
149 cast(ConnectFlags)0);
150 connectedSignals["value-changed"] = 1;
152 onValueChangedListeners ~= dlg;
154 extern(C) static void callBackValueChanged(GtkAdjustment* adjustmentStruct, Adjustment adjustment)
156 bit consumed = false;
158 foreach ( void delegate(Adjustment) dlg ; adjustment.onValueChangedListeners )
160 dlg(adjustment);
163 return consumed;
169 * Creates a new GtkAdjustment.
170 * value:
171 * the initial value.
172 * lower:
173 * the minimum value.
174 * upper:
175 * the maximum value.
176 * step_increment:
177 * the step increment.
178 * page_increment:
179 * the page increment.
180 * page_size:
181 * the page size.
182 * Returns:
183 * a new GtkAdjustment.
185 public this (double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize)
187 // GtkObject* gtk_adjustment_new (gdouble value, gdouble lower, gdouble upper, gdouble step_increment, gdouble page_increment, gdouble page_size);
188 this(cast(GtkAdjustment*)gtk_adjustment_new(value, lower, upper, stepIncrement, pageIncrement, pageSize) );
192 * Gets the current value of the adjustment. See
193 * gtk_adjustment_set_value().
194 * adjustment:
195 * a GtkAdjustment
196 * Returns:
197 * The current value of the adjustment.
199 public double getValue()
201 // gdouble gtk_adjustment_get_value (GtkAdjustment *adjustment);
202 return gtk_adjustment_get_value(gtkAdjustment);
206 * Sets the GtkAdjustment value. The value is clamped to lie between
207 * adjustment->lower and
208 * adjustment->upper.
209 * Note that for adjustments which are used in a GtkScrollbar, the effective
210 * range of allowed values goes from adjustment->lower to
211 * adjustment->upper - adjustment->page_size.
212 * adjustment:
213 * a GtkAdjustment.
214 * value:
215 * the new value.
217 public void setValue(double value)
219 // void gtk_adjustment_set_value (GtkAdjustment *adjustment, gdouble value);
220 gtk_adjustment_set_value(gtkAdjustment, value);
224 * Updates the GtkAdjustment value to ensure that the range between lower
225 * and upper is in the current page (i.e. between value and value +
226 * page_size).
227 * If the range is larger than the page size, then only the start of it will
228 * be in the current page.
229 * A "changed" signal will be emitted if the value is changed.
230 * adjustment:
231 * a GtkAdjustment.
232 * lower:
233 * the lower value.
234 * upper:
235 * the upper value.
237 public void clampPage(double lower, double upper)
239 // void gtk_adjustment_clamp_page (GtkAdjustment *adjustment, gdouble lower, gdouble upper);
240 gtk_adjustment_clamp_page(gtkAdjustment, lower, upper);
244 * Emits a "changed" signal from the GtkAdjustment.
245 * This is typically called by the owner of the GtkAdjustment after it has
246 * changed any of the GtkAdjustment fields other than the value.
247 * adjustment:
248 * a GtkAdjustment
250 public void changed()
252 // void gtk_adjustment_changed (GtkAdjustment *adjustment);
253 gtk_adjustment_changed(gtkAdjustment);
257 * Emits a "value_changed" signal from the GtkAdjustment.
258 * This is typically called by the owner of the GtkAdjustment after it has
259 * changed the GtkAdjustment value field.
260 * adjustment:
261 * a GtkAdjustment
262 * Property Details
263 * The "lower" property
264 * "lower" gdouble : Read / Write
265 * The minimum value of the adjustment.
266 * Default value: 0
267 * Since 2.4
269 public void valueChanged()
271 // void gtk_adjustment_value_changed (GtkAdjustment *adjustment);
272 gtk_adjustment_value_changed(gtkAdjustment);