A ScrolledWindow is a Bin subclass; it's a container that accepts a
single child widget. ScrolledWindow adds scrollbars to the child
widget and optionally draws a beveled frame around the child widget.
The ScrolledWindow works in two ways. Some Widgets have native
scrolling support; these widgets have "slots" for
Adjustment
objects.
For Widgets that lack native scrolling support the
Viewport
Widget acts as an adaptor class, implementing scrollability for
child Widgets that lack their own scrolling capability.
If a Widget has native scrolling capabilities it can be added with the
add
method. If a Widget does not, you must first add the
Widget to a
Viewport
and then add the
Viewport
to the ScrolledWindow. The convenience method
addWithViewport
does exactly this, so you can ignore the
presence of the
Viewport
.
The position of the scrollbars is controlled by the scroll adjustments.
See
Adjustment
for details on how to determine the position
of the layout.
addWithViewport
public void addWithViewport(Widget child)
Used to add children without native scrolling capability. This is
simply a convenience method, it is equivalent to adding the unscrollable
child to a Viewport, then adding the Viewport to the
ScrolledWindow.
child
- The Widget to add to the ScrolledWindow.
getHAdjustment
public Adjustment getHAdjustment()
Returns the horizontal Scrollbar's Adjustment. This can be used
to connect the horizontal Scrollbar to the child Widget's
horizontal scroll functionality.
- The horizontal Scrollbar's Adjustment.
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
- getType in interface Bin
getVAdjustment
public Adjustment getVAdjustment()
Returns the vertical Scrollbar's Adjustment. This can be used
to connect the vertical Scrollbar to the child Widget's
vertical scroll functionality.
- The vertical Scrollbar's Adjustment.
gtk_scrolled_window_add_with_viewport
protected static final void gtk_scrolled_window_add_with_viewport(Handle scrolled_window,
Handle child)
gtk_scrolled_window_get_hadjustment
protected static final Handle gtk_scrolled_window_get_hadjustment(Handle scrolled_window)
gtk_scrolled_window_get_placement
protected static final int gtk_scrolled_window_get_placement(Handle scrolled_window)
gtk_scrolled_window_get_policy
protected static final void gtk_scrolled_window_get_policy(Handle scrolled_window,
int[] hscrollbarPolicy,
int[] vscrollbarPolicy)
gtk_scrolled_window_get_shadow_type
protected static final int gtk_scrolled_window_get_shadow_type(Handle scrolled_window)
gtk_scrolled_window_get_type
protected static final int gtk_scrolled_window_get_type()
gtk_scrolled_window_get_vadjustment
protected static final Handle gtk_scrolled_window_get_vadjustment(Handle scrolled_window)
gtk_scrolled_window_new
protected static final Handle gtk_scrolled_window_new(Handle hadjustment,
Handle vadjustment)
gtk_scrolled_window_set_hadjustment
protected static final void gtk_scrolled_window_set_hadjustment(Handle scrolled_window,
Handle hadjustment)
gtk_scrolled_window_set_placement
protected static final void gtk_scrolled_window_set_placement(Handle scrolled_window,
int windowPlacement)
gtk_scrolled_window_set_policy
protected static final void gtk_scrolled_window_set_policy(Handle scrolled_window,
int hscrollbarPolicy,
int vscrollbarPolicy)
gtk_scrolled_window_set_shadow_type
protected static final void gtk_scrolled_window_set_shadow_type(Handle scrolled_window,
int type)
gtk_scrolled_window_set_vadjustment
protected static final void gtk_scrolled_window_set_vadjustment(Handle scrolled_window,
Handle vadjustment)
setHAdjustment
public void setHAdjustment(Adjustment hadj)
Sets the horizontal Scrollbar's Adjustment.
hadj
- The horizontal Adjustment.
setPlacement
public void setPlacement(CornerType windowPlacement)
Determines the location of the child widget with respect to the
scrollbars. The default is CORNER_TOP_LEFT, meaning the
child is in the top left, with the scrollbar underneath and to
the right.
windowPlacement
- The placement for the child widget.
setPolicy
public void setPolicy(PolicyType hScrollBarPolicy,
PolicyType vScrollBarPolicy)
Sets the scrollbar policy for the horizontal and vertical scrollbars.
The policy determines when the scrollbar should appear.
hScrollBarPolicy
- The policy for the horizontal ScrollBar.vScrollBarPolicy
- The policy for the vertical ScrollBar.
setShadowType
public void setShadowType(ShadowType type)
Changes the type of shadow drawn around the contents of the
ScrolledWindow.
type
- The type of shadow to draw.
setVAdjustment
public void setVAdjustment(Adjustment vadj)
Sets the vertical Scrollbar's Adjustment.
vadj
- The vertical Adjustment.