Package org.gnome.gtk
Interface Scrollable
- All Superinterfaces:
Proxy
- All Known Implementing Classes:
ClampScrollable
,ColumnView
,GridView
,IconView
,ListBase
,ListBase.ListBaseImpl
,ListView
,Map
,Scrollable.ScrollableImpl
,TextView
,TreeView
,View
,Viewport
GtkScrollable
is an interface for widgets with native scrolling ability.
To implement this interface you should override the
Gtk.Scrollable:hadjustment
and
Gtk.Scrollable:vadjustment
properties.
Creating a scrollable widget
All scrollable widgets should do the following.
- When a parent widget sets the scrollable child widget’s adjustments,
the widget should connect to the
Gtk.Adjustment::value-changed
signal. The child widget should then populate the adjustments’ properties as soon as possible, which usually means queueing an allocation right away and populating the properties in theWidget.sizeAllocate(org.gnome.gtk.Allocation, int)
implementation.
- Because its preferred size is the size for a fully expanded widget,
the scrollable widget must be able to cope with underallocations.
This means that it must accept any value passed to its
Widget.sizeAllocate(org.gnome.gtk.Allocation, int)
implementation.
- When the parent allocates space to the scrollable child widget,
the widget must ensure the adjustments’ property values are correct and up
to date, for example using
Adjustment.configure(double, double, double, double, double, double)
.
- When any of the adjustments emits the
Gtk.Adjustment::value-changed
signal, the scrollable widget should scroll its contents.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Scrollable.Builder<B extends Builder<B>>
static class
The ScrollableImpl type represents a native instance of the Scrollable interface.static class
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Returns the size of a non-scrolling border around the outside of the scrollable.default Adjustment
Retrieves theGtkAdjustment
used for horizontal scrolling.default ScrollablePolicy
Gets the horizontalGtkScrollablePolicy
.static Type
getType()
Get the GType of the Scrollable classdefault Adjustment
Retrieves theGtkAdjustment
used for vertical scrolling.default ScrollablePolicy
Gets the verticalGtkScrollablePolicy
.default void
setHadjustment
(@Nullable Adjustment hadjustment) Sets the horizontal adjustment of theGtkScrollable
.default void
setHscrollPolicy
(ScrollablePolicy policy) Sets theGtkScrollablePolicy
.default void
setVadjustment
(@Nullable Adjustment vadjustment) Sets the vertical adjustment of theGtkScrollable
.default void
setVscrollPolicy
(ScrollablePolicy policy) Sets theGtkScrollablePolicy
.
-
Method Details
-
getType
-
getBorder
Returns the size of a non-scrolling border around the outside of the scrollable.An example for this would be treeview headers. GTK can use this information to display overlaid graphics, like the overshoot indication, at the right position.
- Parameters:
border
- return location for the results- Returns:
true
ifborder
has been set
-
getHadjustment
Retrieves theGtkAdjustment
used for horizontal scrolling.- Returns:
- horizontal
GtkAdjustment
.
-
getHscrollPolicy
Gets the horizontalGtkScrollablePolicy
.- Returns:
- The horizontal
GtkScrollablePolicy
.
-
getVadjustment
Retrieves theGtkAdjustment
used for vertical scrolling.- Returns:
- vertical
GtkAdjustment
.
-
getVscrollPolicy
Gets the verticalGtkScrollablePolicy
.- Returns:
- The vertical
GtkScrollablePolicy
.
-
setHadjustment
Sets the horizontal adjustment of theGtkScrollable
.- Parameters:
hadjustment
- aGtkAdjustment
-
setHscrollPolicy
Sets theGtkScrollablePolicy
.The policy determines whether horizontal scrolling should start below the minimum width or below the natural width.
- Parameters:
policy
- the horizontalGtkScrollablePolicy
-
setVadjustment
Sets the vertical adjustment of theGtkScrollable
.- Parameters:
vadjustment
- aGtkAdjustment
-
setVscrollPolicy
Sets theGtkScrollablePolicy
.The policy determines whether vertical scrolling should start below the minimum height or below the natural height.
- Parameters:
policy
- the verticalGtkScrollablePolicy
-