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 = GtkScrolledWindow.html
27 * outFile = ScrolledWindow
28 * strct = GtkScrolledWindow
31 * clss = ScrolledWindow
39 * - gtk_scrolled_window_
44 * - gtk_scrolled_window_new
49 * - GtkAdjustment* -> Adjustment
50 * - GtkWidget* -> Widget
54 module gtk
.ScrolledWindow
;
56 private import gtk
.gtktypes
;
58 private import lib
.gtk
;
60 private import gtk
.Widget
;
61 private import gtk
.Adjustment
;
65 * GtkScrolledWindow is a GtkBin subclass: it's a container
66 * the accepts a single child widget. GtkScrolledWindow adds scrollbars
67 * to the child widget and optionally draws a beveled frame around the
69 * The scrolled window can work in two ways. Some widgets have native
70 * scrolling support; these widgets have "slots" for GtkAdjustment
73 * Widgets with native scroll support include GtkTreeView, GtkTextView,
75 * For widgets that lack native scrolling support, the GtkViewport
76 * widget acts as an adaptor class, implementing scrollability for child
77 * widgets that lack their own scrolling capabilities. Use GtkViewport
78 * to scroll child widgets such as GtkTable, GtkBox, and so on.
79 * If a widget has native scrolling abilities, it can be added to the
80 * GtkScrolledWindow with gtk_container_add(). If a widget does not, you
81 * must first add the widget to a GtkViewport, then add the GtkViewport
82 * to the scrolled window. The convenience function
83 * gtk_scrolled_window_add_with_viewport() does exactly this, so you can
84 * ignore the presence of the viewport.
85 * The position of the scrollbars is controlled by the scroll
86 * adjustments. See GtkAdjustment for the fields in an adjustment - for
87 * GtkScrollbar, used by GtkScrolledWindow, the "value" field
88 * represents the position of the scrollbar, which must be between the
89 * "lower" field and "upper - page_size." The "page_size" field
90 * represents the size of the visible scrollable area. The
91 * "step_increment" and "page_increment" fields are used when the user
92 * asks to step down (using the small stepper arrows) or page down (using
93 * for example the PageDown key).
94 * If a GtkScrolledWindow doesn't behave quite as you would like, or
95 * doesn't have exactly the right layout, it's very possible to set up
96 * your own scrolling with GtkScrollbar and for example a GtkTable.
98 private import gtk
.Bin
;
99 public class ScrolledWindow
: Bin
102 /** the main Gtk struct */
103 protected GtkScrolledWindow
* gtkScrolledWindow
;
106 public GtkScrolledWindow
* getScrolledWindowStruct()
108 return gtkScrolledWindow
;
112 /** the main Gtk struct as a void* */
113 protected void* getStruct()
115 return cast(void*)gtkScrolledWindow
;
119 * Sets our main struct and passes it to the parent class
121 public this (GtkScrolledWindow
* gtkScrolledWindow
)
123 super(cast(GtkBin
*)gtkScrolledWindow
);
124 this.gtkScrolledWindow
= gtkScrolledWindow
;
132 public this(Widget widget
)
135 addWithViewport(widget
);
139 * Creates a new scrolled window. The two arguments are the scrolled
140 * window's adjustments; these will be shared with the scrollbars and the
141 * child widget to keep the bars in sync with the child. Usually you want
142 * to pass NULL for the adjustments, which will cause the scrolled window
143 * to create them for you.
145 * Horizontal adjustment.
147 * Vertical adjustment.
149 * New scrolled window.
151 public this (Adjustment hadjustment
, Adjustment vadjustment
)
153 // GtkWidget* gtk_scrolled_window_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment);
154 this(cast(GtkScrolledWindow
*)gtk_scrolled_window_new(
155 hadjustment
is null ?
null : hadjustment
.getAdjustmentStruct(),
156 vadjustment
is null ?
null : vadjustment
.getAdjustmentStruct())
161 * Creates a new Scrolled window and set the policy type
162 * @param hPolicy the horizontal policy
163 * @param vPolicy the vertical policy
165 this(PolicyType hPolicy
, PolicyType vPolicy
)
168 setPolicy(hPolicy
, vPolicy
);
174 // imports for the signal processing
175 private import gobject
.Signals
;
176 private import gdk
.gdktypes
;
177 int[char[]] connectedSignals
;
179 void delegate(GtkDirectionType
, ScrolledWindow
)[] onMoveFocusOutListeners
;
180 void addOnMoveFocusOut(void delegate(GtkDirectionType
, ScrolledWindow
) dlg
)
182 if ( !("move-focus-out" in connectedSignals
) )
187 cast(GCallback
)&callBackMoveFocusOut
,
190 cast(ConnectFlags
)0);
191 connectedSignals
["move-focus-out"] = 1;
193 onMoveFocusOutListeners
~= dlg
;
195 extern(C
) static void callBackMoveFocusOut(GtkScrolledWindow
* scrolledwindowStruct
, GtkDirectionType arg1
, ScrolledWindow scrolledWindow
)
197 bit consumed
= false;
199 foreach ( void delegate(GtkDirectionType
, ScrolledWindow
) dlg
; scrolledWindow
.onMoveFocusOutListeners
)
201 dlg(arg1
, scrolledWindow
);
207 void delegate(GtkScrollType
, gboolean
, ScrolledWindow
)[] onScrollChildListeners
;
208 void addOnScrollChild(void delegate(GtkScrollType
, gboolean
, ScrolledWindow
) dlg
)
210 if ( !("scroll-child" in connectedSignals
) )
215 cast(GCallback
)&callBackScrollChild
,
218 cast(ConnectFlags
)0);
219 connectedSignals
["scroll-child"] = 1;
221 onScrollChildListeners
~= dlg
;
223 extern(C
) static void callBackScrollChild(GtkScrolledWindow
* scrolledwindowStruct
, GtkScrollType arg1
, gboolean arg2
, ScrolledWindow scrolledWindow
)
225 bit consumed
= false;
227 foreach ( void delegate(GtkScrollType
, gboolean
, ScrolledWindow
) dlg
; scrolledWindow
.onScrollChildListeners
)
229 dlg(arg1
, arg2
, scrolledWindow
);
239 * Returns the horizontal scrollbar's adjustment, used to connect the
240 * horizontal scrollbar to the child widget's horizontal scroll
243 * A GtkScrolledWindow.
245 * The horizontal GtkAdjustment.
247 public Adjustment
getHadjustment()
249 // GtkAdjustment* gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window);
250 return new Adjustment( gtk_scrolled_window_get_hadjustment(gtkScrolledWindow
) );
254 * Returns the vertical scrollbar's adjustment, used to connect the
255 * vertical scrollbar to the child widget's vertical scroll
258 * A GtkScrolledWindow.
260 * The vertical GtkAdjustment.
262 public Adjustment
getVadjustment()
264 // GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window);
265 return new Adjustment( gtk_scrolled_window_get_vadjustment(gtkScrolledWindow
) );
269 * Returns the horizontal scrollbar of scrolled_window.
271 * a GtkScrolledWindow
273 * the horizontal scrollbar of the scrolled window, or
274 * NULL if it does not have one.
277 public Widget
getHscrollbar()
279 // GtkWidget* gtk_scrolled_window_get_hscrollbar (GtkScrolledWindow *scrolled_window);
280 return new Widget( gtk_scrolled_window_get_hscrollbar(gtkScrolledWindow
) );
284 * Returns the vertical scrollbar of scrolled_window.
286 * a GtkScrolledWindow
288 * the vertical scrollbar of the scrolled window, or
289 * NULL if it does not have one.
292 public Widget
getVscrollbar()
294 // GtkWidget* gtk_scrolled_window_get_vscrollbar (GtkScrolledWindow *scrolled_window);
295 return new Widget( gtk_scrolled_window_get_vscrollbar(gtkScrolledWindow
) );
299 * Sets the scrollbar policy for the horizontal and vertical scrollbars.
300 * The policy determines when the scrollbar should appear; it is a value
301 * from the GtkPolicyType enumeration. If GTK_POLICY_ALWAYS, the
302 * scrollbar is always present; if GTK_POLICY_NEVER, the scrollbar is
303 * never present; if GTK_POLICY_AUTOMATIC, the scrollbar is present only
304 * if needed (that is, if the slider part of the bar would be smaller
305 * than the trough - the display is larger than the page size).
307 * A GtkScrolledWindow.
309 * Policy for horizontal bar.
311 * Policy for vertical bar.
313 public void setPolicy(GtkPolicyType hscrollbarPolicy
, GtkPolicyType vscrollbarPolicy
)
315 // void gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy);
316 gtk_scrolled_window_set_policy(gtkScrolledWindow
, hscrollbarPolicy
, vscrollbarPolicy
);
320 * Used to add children without native scrolling capabilities. This is
321 * simply a convenience function; it is equivalent to adding the
322 * unscrollable child to a viewport, then adding the viewport to the
323 * scrolled window. If a child has native scrolling, use
324 * gtk_container_add() instead of this function.
325 * The viewport scrolls the child by moving its GdkWindow, and takes the
326 * size of the child to be the size of its toplevel GdkWindow. This will
327 * be very wrong for most widgets that support native scrolling; for
328 * example, if you add a widget such as GtkTreeView with a viewport, the
329 * whole widget will scroll, including the column headings. Thus, widgets
330 * with native scrolling support should not be used with the GtkViewport proxy.
331 * A widget supports scrolling natively if the
332 * set_scroll_adjustments_signal field in GtkWidgetClass is non-zero,
333 * i.e. has been filled in with a valid signal identifier.
335 * A GtkScrolledWindow.
337 * Widget you want to scroll.
339 public void addWithViewport(Widget child
)
341 // void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window, GtkWidget *child);
342 gtk_scrolled_window_add_with_viewport(gtkScrolledWindow
, (child
is null) ?
null : child
.getWidgetStruct());
346 * Sets the placement of the contents with respect to the scrollbars
347 * for the scrolled window.
348 * See also gtk_scrolled_window_get_placement() and
349 * gtk_scrolled_window_unset_placement().
350 * Determines the location of the child widget with respect to the
351 * scrollbars. The default is GTK_CORNER_TOP_LEFT, meaning the child is
352 * in the top left, with the scrollbars underneath and to the right.
353 * Other values in GtkCornerType are GTK_CORNER_TOP_RIGHT,
354 * GTK_CORNER_BOTTOM_LEFT, and GTK_CORNER_BOTTOM_RIGHT.
356 * a GtkScrolledWindow
358 * Position of the child window.
360 public void setPlacement(GtkCornerType windowPlacement
)
362 // void gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window, GtkCornerType window_placement);
363 gtk_scrolled_window_set_placement(gtkScrolledWindow
, windowPlacement
);
367 * Unsets the placement of the contents with respect to the scrollbars
368 * for the scrolled window. If no window placement is set for a scrolled
369 * window, it obeys the "gtk-scrolled-window-placement" XSETTING.
370 * See also gtk_scrolled_window_set_placement() and
371 * gtk_scrolled_window_get_placement().
373 * a GtkScrolledWindow
376 public void unsetPlacement()
378 // void gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window);
379 gtk_scrolled_window_unset_placement(gtkScrolledWindow
);
383 * Changes the type of shadow drawn around the contents of
386 * a GtkScrolledWindow
388 * kind of shadow to draw around scrolled window contents
390 public void setShadowType(GtkShadowType type
)
392 // void gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, GtkShadowType type);
393 gtk_scrolled_window_set_shadow_type(gtkScrolledWindow
, type
);
397 * Sets the GtkAdjustment for the horizontal scrollbar.
399 * A GtkScrolledWindow.
401 * Horizontal scroll adjustment.
403 public void setHadjustment(Adjustment hadjustment
)
405 // void gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window, GtkAdjustment *hadjustment);
406 gtk_scrolled_window_set_hadjustment(gtkScrolledWindow
, (hadjustment
is null) ?
null : hadjustment
.getAdjustmentStruct());
410 * Sets the GtkAdjustment for the vertical scrollbar.
412 * A GtkScrolledWindow.
414 * Vertical scroll adjustment.
416 public void setVadjustment(Adjustment vadjustment
)
418 // void gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window, GtkAdjustment *vadjustment);
419 gtk_scrolled_window_set_vadjustment(gtkScrolledWindow
, (vadjustment
is null) ?
null : vadjustment
.getAdjustmentStruct());
423 * Gets the placement of the contents with respect to the scrollbars
424 * for the scrolled window. See gtk_scrolled_window_set_placement().
426 * a GtkScrolledWindow
428 * the current placement value.
429 * See also gtk_scrolled_window_set_placement() and
430 * gtk_scrolled_window_unset_placement().
432 public GtkCornerType
getPlacement()
434 // GtkCornerType gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window);
435 return gtk_scrolled_window_get_placement(gtkScrolledWindow
);
439 * Retrieves the current policy values for the horizontal and vertical
440 * scrollbars. See gtk_scrolled_window_set_policy().
442 * a GtkScrolledWindow
444 * location to store the policy for the horizontal scrollbar, or NULL.
446 * location to store the policy for the horizontal scrollbar, or NULL.
448 public void getPolicy(GtkPolicyType
* hscrollbarPolicy
, GtkPolicyType
* vscrollbarPolicy
)
450 // void gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window, GtkPolicyType *hscrollbar_policy, GtkPolicyType *vscrollbar_policy);
451 gtk_scrolled_window_get_policy(gtkScrolledWindow
, hscrollbarPolicy
, vscrollbarPolicy
);
455 * Gets the shadow type of the scrolled window. See
456 * gtk_scrolled_window_set_shadow_type().
458 * a GtkScrolledWindow
460 * the current shadow type
462 * The "hadjustment" property
463 * "hadjustment" GtkAdjustment : Read / Write / Construct
464 * The GtkAdjustment for the horizontal position.
466 public GtkShadowType
getShadowType()
468 // GtkShadowType gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window);
469 return gtk_scrolled_window_get_shadow_type(gtkScrolledWindow
);