2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
55 module gtk
.ScrolledWindow
;
61 import tango
.io
.Stdout
; // use the tango loging?
65 private import gtkc
.gtktypes
;
67 private import gtkc
.gtk
;
70 private import gtk
.Widget
;
71 private import gtk
.Adjustment
;
78 * GtkScrolledWindow is a GtkBin subclass: it's a container
79 * the accepts a single child widget. GtkScrolledWindow adds scrollbars
80 * to the child widget and optionally draws a beveled frame around the
82 * The scrolled window can work in two ways. Some widgets have native
83 * scrolling support; these widgets have "slots" for GtkAdjustment
86 * Widgets with native scroll support include GtkTreeView, GtkTextView,
88 * For widgets that lack native scrolling support, the GtkViewport
89 * widget acts as an adaptor class, implementing scrollability for child
90 * widgets that lack their own scrolling capabilities. Use GtkViewport
91 * to scroll child widgets such as GtkTable, GtkBox, and so on.
92 * If a widget has native scrolling abilities, it can be added to the
93 * GtkScrolledWindow with gtk_container_add(). If a widget does not, you
94 * must first add the widget to a GtkViewport, then add the GtkViewport
95 * to the scrolled window. The convenience function
96 * gtk_scrolled_window_add_with_viewport() does exactly this, so you can
97 * ignore the presence of the viewport.
98 * The position of the scrollbars is controlled by the scroll
99 * adjustments. See GtkAdjustment for the fields in an adjustment - for
100 * GtkScrollbar, used by GtkScrolledWindow, the "value" field
101 * represents the position of the scrollbar, which must be between the
102 * "lower" field and "upper - page_size." The "page_size" field
103 * represents the size of the visible scrollable area. The
104 * "step_increment" and "page_increment" fields are used when the user
105 * asks to step down (using the small stepper arrows) or page down (using
106 * for example the PageDown key).
107 * If a GtkScrolledWindow doesn't behave quite as you would like, or
108 * doesn't have exactly the right layout, it's very possible to set up
109 * your own scrolling with GtkScrollbar and for example a GtkTable.
111 private import gtk
.Bin
;
112 public class ScrolledWindow
: Bin
115 /** the main Gtk struct */
116 protected GtkScrolledWindow
* gtkScrolledWindow
;
119 public GtkScrolledWindow
* getScrolledWindowStruct()
121 return gtkScrolledWindow
;
125 /** the main Gtk struct as a void* */
126 protected void* getStruct()
128 return cast(void*)gtkScrolledWindow
;
132 * Sets our main struct and passes it to the parent class
134 public this (GtkScrolledWindow
* gtkScrolledWindow
)
138 if ( gtkScrolledWindow
is null )
143 Stdout("struct gtkScrolledWindow is null on constructor").newline
;
147 printf("struct gtkScrolledWindow is null on constructor");
154 assert(gtkScrolledWindow
!is null, "struct gtkScrolledWindow is null on constructor");
156 super(cast(GtkBin
*)gtkScrolledWindow
);
157 this.gtkScrolledWindow
= gtkScrolledWindow
;
165 public this(Widget widget
)
168 addWithViewport(widget
);
172 * Creates a new scrolled window. The two arguments are the scrolled
173 * window's adjustments; these will be shared with the scrollbars and the
174 * child widget to keep the bars in sync with the child. Usually you want
175 * to pass NULL for the adjustments, which will cause the scrolled window
176 * to create them for you.
178 * Horizontal adjustment.
180 * Vertical adjustment.
182 * New scrolled window.
184 public this (Adjustment hadjustment
, Adjustment vadjustment
)
186 // GtkWidget* gtk_scrolled_window_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment);
187 this(cast(GtkScrolledWindow
*)gtk_scrolled_window_new(
188 hadjustment
is null ?
null : hadjustment
.getAdjustmentStruct(),
189 vadjustment
is null ?
null : vadjustment
.getAdjustmentStruct())
194 * Creates a new Scrolled window and set the policy type
195 * @param hPolicy the horizontal policy
196 * @param vPolicy the vertical policy
198 this(PolicyType hPolicy
, PolicyType vPolicy
)
201 setPolicy(hPolicy
, vPolicy
);
207 // imports for the signal processing
208 private import gobject
.Signals
;
209 private import gtkc
.gdktypes
;
210 int[char[]] connectedSignals
;
212 void delegate(GtkDirectionType
, ScrolledWindow
)[] onMoveFocusOutListeners
;
213 void addOnMoveFocusOut(void delegate(GtkDirectionType
, ScrolledWindow
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
215 if ( !("move-focus-out" in connectedSignals
) )
220 cast(GCallback
)&callBackMoveFocusOut
,
224 connectedSignals
["move-focus-out"] = 1;
226 onMoveFocusOutListeners
~= dlg
;
228 extern(C
) static void callBackMoveFocusOut(GtkScrolledWindow
* scrolledwindowStruct
, GtkDirectionType arg1
, ScrolledWindow scrolledWindow
)
230 bool consumed
= false;
232 foreach ( void delegate(GtkDirectionType
, ScrolledWindow
) dlg
; scrolledWindow
.onMoveFocusOutListeners
)
234 dlg(arg1
, scrolledWindow
);
240 gboolean
delegate(GtkScrollType
, gboolean
, ScrolledWindow
)[] onScrollChildListeners
;
241 void addOnScrollChild(gboolean
delegate(GtkScrollType
, gboolean
, ScrolledWindow
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
243 if ( !("scroll-child" in connectedSignals
) )
248 cast(GCallback
)&callBackScrollChild
,
252 connectedSignals
["scroll-child"] = 1;
254 onScrollChildListeners
~= dlg
;
256 extern(C
) static void callBackScrollChild(GtkScrolledWindow
* scrolledwindowStruct
, GtkScrollType arg1
, gboolean arg2
, ScrolledWindow scrolledWindow
)
258 bool consumed
= false;
260 foreach ( gboolean
delegate(GtkScrollType
, gboolean
, ScrolledWindow
) dlg
; scrolledWindow
.onScrollChildListeners
)
262 dlg(arg1
, arg2
, scrolledWindow
);
272 * Returns the horizontal scrollbar's adjustment, used to connect the
273 * horizontal scrollbar to the child widget's horizontal scroll
276 * A GtkScrolledWindow.
278 * The horizontal GtkAdjustment.
280 public Adjustment
getHadjustment()
282 // GtkAdjustment* gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window);
283 return new Adjustment( gtk_scrolled_window_get_hadjustment(gtkScrolledWindow
) );
287 * Returns the vertical scrollbar's adjustment, used to connect the
288 * vertical scrollbar to the child widget's vertical scroll
291 * A GtkScrolledWindow.
293 * The vertical GtkAdjustment.
295 public Adjustment
getVadjustment()
297 // GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window);
298 return new Adjustment( gtk_scrolled_window_get_vadjustment(gtkScrolledWindow
) );
302 * Returns the horizontal scrollbar of scrolled_window.
304 * a GtkScrolledWindow
306 * the horizontal scrollbar of the scrolled window, or
307 * NULL if it does not have one.
310 public Widget
getHscrollbar()
312 // GtkWidget* gtk_scrolled_window_get_hscrollbar (GtkScrolledWindow *scrolled_window);
313 return new Widget( gtk_scrolled_window_get_hscrollbar(gtkScrolledWindow
) );
317 * Returns the vertical scrollbar of scrolled_window.
319 * a GtkScrolledWindow
321 * the vertical scrollbar of the scrolled window, or
322 * NULL if it does not have one.
325 public Widget
getVscrollbar()
327 // GtkWidget* gtk_scrolled_window_get_vscrollbar (GtkScrolledWindow *scrolled_window);
328 return new Widget( gtk_scrolled_window_get_vscrollbar(gtkScrolledWindow
) );
332 * Sets the scrollbar policy for the horizontal and vertical scrollbars.
333 * The policy determines when the scrollbar should appear; it is a value
334 * from the GtkPolicyType enumeration. If GTK_POLICY_ALWAYS, the
335 * scrollbar is always present; if GTK_POLICY_NEVER, the scrollbar is
336 * never present; if GTK_POLICY_AUTOMATIC, the scrollbar is present only
337 * if needed (that is, if the slider part of the bar would be smaller
338 * than the trough - the display is larger than the page size).
340 * A GtkScrolledWindow.
342 * Policy for horizontal bar.
344 * Policy for vertical bar.
346 public void setPolicy(GtkPolicyType hscrollbarPolicy
, GtkPolicyType vscrollbarPolicy
)
348 // void gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy);
349 gtk_scrolled_window_set_policy(gtkScrolledWindow
, hscrollbarPolicy
, vscrollbarPolicy
);
353 * Used to add children without native scrolling capabilities. This is
354 * simply a convenience function; it is equivalent to adding the
355 * unscrollable child to a viewport, then adding the viewport to the
356 * scrolled window. If a child has native scrolling, use
357 * gtk_container_add() instead of this function.
358 * The viewport scrolls the child by moving its GdkWindow, and takes the
359 * size of the child to be the size of its toplevel GdkWindow. This will
360 * be very wrong for most widgets that support native scrolling; for
361 * example, if you add a widget such as GtkTreeView with a viewport, the
362 * whole widget will scroll, including the column headings. Thus, widgets
363 * with native scrolling support should not be used with the GtkViewport proxy.
364 * A widget supports scrolling natively if the
365 * set_scroll_adjustments_signal field in GtkWidgetClass is non-zero,
366 * i.e. has been filled in with a valid signal identifier.
368 * A GtkScrolledWindow.
370 * Widget you want to scroll.
372 public void addWithViewport(Widget child
)
374 // void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window, GtkWidget *child);
375 gtk_scrolled_window_add_with_viewport(gtkScrolledWindow
, (child
is null) ?
null : child
.getWidgetStruct());
379 * Sets the placement of the contents with respect to the scrollbars
380 * for the scrolled window.
381 * See also gtk_scrolled_window_get_placement() and
382 * gtk_scrolled_window_unset_placement().
383 * Determines the location of the child widget with respect to the
384 * scrollbars. The default is GTK_CORNER_TOP_LEFT, meaning the child is
385 * in the top left, with the scrollbars underneath and to the right.
386 * Other values in GtkCornerType are GTK_CORNER_TOP_RIGHT,
387 * GTK_CORNER_BOTTOM_LEFT, and GTK_CORNER_BOTTOM_RIGHT.
389 * a GtkScrolledWindow
391 * Position of the child window.
393 public void setPlacement(GtkCornerType windowPlacement
)
395 // void gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window, GtkCornerType window_placement);
396 gtk_scrolled_window_set_placement(gtkScrolledWindow
, windowPlacement
);
400 * Unsets the placement of the contents with respect to the scrollbars
401 * for the scrolled window. If no window placement is set for a scrolled
402 * window, it obeys the "gtk-scrolled-window-placement" XSETTING.
403 * See also gtk_scrolled_window_set_placement() and
404 * gtk_scrolled_window_get_placement().
406 * a GtkScrolledWindow
409 public void unsetPlacement()
411 // void gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window);
412 gtk_scrolled_window_unset_placement(gtkScrolledWindow
);
416 * Changes the type of shadow drawn around the contents of
419 * a GtkScrolledWindow
421 * kind of shadow to draw around scrolled window contents
423 public void setShadowType(GtkShadowType type
)
425 // void gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, GtkShadowType type);
426 gtk_scrolled_window_set_shadow_type(gtkScrolledWindow
, type
);
430 * Sets the GtkAdjustment for the horizontal scrollbar.
432 * A GtkScrolledWindow.
434 * Horizontal scroll adjustment.
436 public void setHadjustment(Adjustment hadjustment
)
438 // void gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window, GtkAdjustment *hadjustment);
439 gtk_scrolled_window_set_hadjustment(gtkScrolledWindow
, (hadjustment
is null) ?
null : hadjustment
.getAdjustmentStruct());
443 * Sets the GtkAdjustment for the vertical scrollbar.
445 * A GtkScrolledWindow.
447 * Vertical scroll adjustment.
449 public void setVadjustment(Adjustment vadjustment
)
451 // void gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window, GtkAdjustment *vadjustment);
452 gtk_scrolled_window_set_vadjustment(gtkScrolledWindow
, (vadjustment
is null) ?
null : vadjustment
.getAdjustmentStruct());
456 * Gets the placement of the contents with respect to the scrollbars
457 * for the scrolled window. See gtk_scrolled_window_set_placement().
459 * a GtkScrolledWindow
461 * the current placement value.
462 * See also gtk_scrolled_window_set_placement() and
463 * gtk_scrolled_window_unset_placement().
465 public GtkCornerType
getPlacement()
467 // GtkCornerType gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window);
468 return gtk_scrolled_window_get_placement(gtkScrolledWindow
);
472 * Retrieves the current policy values for the horizontal and vertical
473 * scrollbars. See gtk_scrolled_window_set_policy().
475 * a GtkScrolledWindow
477 * location to store the policy for the horizontal scrollbar, or NULL.
479 * location to store the policy for the horizontal scrollbar, or NULL.
481 public void getPolicy(GtkPolicyType
* hscrollbarPolicy
, GtkPolicyType
* vscrollbarPolicy
)
483 // void gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window, GtkPolicyType *hscrollbar_policy, GtkPolicyType *vscrollbar_policy);
484 gtk_scrolled_window_get_policy(gtkScrolledWindow
, hscrollbarPolicy
, vscrollbarPolicy
);
488 * Gets the shadow type of the scrolled window. See
489 * gtk_scrolled_window_set_shadow_type().
491 * a GtkScrolledWindow
493 * the current shadow type
495 * The "hadjustment" property
496 * "hadjustment" GtkAdjustment : Read / Write / Construct
497 * The GtkAdjustment for the horizontal position.
499 public GtkShadowType
getShadowType()
501 // GtkShadowType gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window);
502 return gtk_scrolled_window_get_shadow_type(gtkScrolledWindow
);