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
27 * outFile = Adjustment
28 * strct = GtkAdjustment
47 * - GtkObject* -> ObjectGtk
51 module gtk
.Adjustment
;
53 private import gtk
.gtktypes
;
55 private import lib
.gtk
;
57 private import gtk
.ObjectGtk
;
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()
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gtkAdjustment
;
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
) )
118 cast(GCallback
)&callBackChanged
,
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
)
138 void delegate(Adjustment
)[] onValueChangedListeners
;
139 void addOnValueChanged(void delegate(Adjustment
) dlg
)
141 if ( !("value-changed" in connectedSignals
) )
146 cast(GCallback
)&callBackValueChanged
,
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
)
169 * Creates a new GtkAdjustment.
177 * the step increment.
179 * the page increment.
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().
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
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.
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 +
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.
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.
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.
263 * The "lower" property
264 * "lower" gdouble : Read / Write
265 * The minimum value of the adjustment.
269 public void valueChanged()
271 // void gtk_adjustment_value_changed (GtkAdjustment *adjustment);
272 gtk_adjustment_value_changed(gtkAdjustment
);