Libraries:Gtk:Gtk:ScrolledWindow
Types
T
Inherits from:T is a Gtk.Gtk.Bin.T subclass: it's a container the accepts a single child widget. T adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.
The scrolled window can work in two ways. Some widgets have native scrolling support; these widgets have "slots" for Gtk.Gtk.Adjustment.T objects. [5] Widgets with native scroll support include Gtk.Gtk.TreeView.T, Gtk.Gtk.TextView.T, and Gtk.Gtk.Layout.T.
For widgets that lack native scrolling support, the Gtk.Gtk.Viewport.T widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use Gtk.Gtk.Viewport.T to scroll child widgets such as Gtk.Gtk.Table.T, Gtk.Gtk.Box.T, and so on.
If a widget has native scrolling abilities, it can be added to the T with Gtk.Gtk.Container.Add. If a widget does not, you must first add the widget to a Gtk.Gtk.Viewport.T, then add the Gtk.Gtk.Viewport.T to the scrolled window. The convenience function 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 Gtk.Gtk.Adjustment.T for the fields in an adjustment - for Gtk.Gtk.Scrollbar.T, used by T, the "value" field represents the position of the scrollbar, which must be between the "lower" field and "upper - page_size." The "page_size" field represents the size of the visible scrollable area. The "step_increment" and "page_increment" fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the PageDown key).
If a T doesn't behave quite as you would like, or doesn't have exactly the right layout, it's very possible to set up your own scrolling with Gtk.Gtk.Scrollbar.T and for example a Gtk.Gtk.Table.T.
Constants
Nil : T
Functions
GetType() : Gtk.GObject.Type.T
New(hadjustment @ Gtk.Gtk.Adjustment.T, vadjustment @ Gtk.Gtk.Adjustment.T) : Gtk.Gtk.ScrolledWindow.T
Creates a new scrolled window.
The two arguments are the scrolled window's adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Usually you want to pass NULL for the adjustments, which will cause the scrolled window to create them for you.
hadjustment | horizontal adjustment. [allow-none] |
vadjustment | vertical adjustment. [allow-none] |
Returns | a new scrolled window |
Methods
:AddWithViewport(self @ T, child @ Gtk.Gtk.Widget.T) : Std.Object.T
Used to add children without native scrolling capabilities. This is simply a convenience function; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use Gtk.Gtk.Container.Add instead of this function.
The viewport scrolls the child by moving its Gtk.Gdk.Window.T, and takes the size of the child to be the size of its toplevel Gtk.Gdk.Window.T. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as Gtk.Gtk.TreeView.T with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the Gtk.Gtk.Viewport.T proxy.
A widget supports scrolling natively if the set_scroll_adjustments_signal field in GtkWidgetClass is non-zero, i.e. has been filled in with a valid signal identifier.
scrolled_window | a T |
child | the widget you want to scroll |
:GetHadjustment(self @ T) : Gtk.Gtk.Adjustment.T
Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.
scrolled_window | a T |
Returns | the horizontal Gtk.Gtk.Adjustment.T. [transfer none] |
:GetHscrollbar(self @ T) : Gtk.Gtk.Widget.T
Returns the horizontal scrollbar of scrolled_window.
scrolled_window | a T |
Returns | the horizontal scrollbar of the scrolled window, or NULL if it does not have one. [transfer none] |
:GetPlacement(self @ T) : Gtk.Gtk.CornerType.T
Gets the placement of the contents with respect to the scrollbars for the scrolled window. See SetPlacement.
scrolled_window | a T |
Returns | the current placement value. See also SetPlacement and UnsetPlacement. |
:GetPolicy(self @ T, hscrollbar_policy @ Std.Object.T, vscrollbar_policy @ Std.Object.T) : Std.Object.T
Retrieves the current policy values for the horizontal and vertical scrollbars. See SetPolicy.
scrolled_window | a T |
hscrollbar_policy | location to store the policy for the horizontal scrollbar, or NULL. [out][allow-none] |
vscrollbar_policy | location to store the policy for the vertical scrollbar, or NULL. [out][allow-none] |
:GetShadowType(self @ T) : Gtk.Gtk.ShadowType.T
Gets the shadow type of the scrolled window. See SetShadowType.
scrolled_window | a T |
Returns | the current shadow type |
:GetVadjustment(self @ T) : Gtk.Gtk.Adjustment.T
Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.
scrolled_window | a T |
Returns | the vertical Gtk.Gtk.Adjustment.T. [transfer none] |
:GetVscrollbar(self @ T) : Gtk.Gtk.Widget.T
Returns the vertical scrollbar of scrolled_window.
scrolled_window | a T |
Returns | the vertical scrollbar of the scrolled window, or NULL if it does not have one. [transfer none] |
:SetHadjustment(self @ T, hadjustment @ Gtk.Gtk.Adjustment.T) : Std.Object.T
Sets the Gtk.Gtk.Adjustment.T for the horizontal scrollbar.
scrolled_window | a T |
hadjustment | horizontal scroll adjustment |
:SetPlacement(self @ T, window_placement @ Gtk.Gtk.CornerType.T) : Std.Object.T
Sets the placement of the contents with respect to the scrollbars for the scrolled window.
The default is Gtk.Gtk.CornerType.TopLeft, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in Gtk.Gtk.CornerType.T are Gtk.Gtk.CornerType.TopRight, Gtk.Gtk.CornerType.BottomLeft, and Gtk.Gtk.CornerType.BottomRight.
See also GetPlacement and UnsetPlacement.
scrolled_window | a T |
window_placement | position of the child window |
:SetPolicy(self @ T, hscrollbar_policy @ Gtk.Gtk.PolicyType.T, vscrollbar_policy @ Gtk.Gtk.PolicyType.T) : Std.Object.T
Sets the scrollbar policy for the horizontal and vertical scrollbars.
The policy determines when the scrollbar should appear; it is a value from the Gtk.Gtk.PolicyType.T enumeration. If Gtk.Gtk.PolicyType.Always, the scrollbar is always present; if Gtk.Gtk.PolicyType.Never, the scrollbar is never present; if Gtk.Gtk.PolicyType.Automatic, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough - the display is larger than the page size).
scrolled_window | a T |
hscrollbar_policy | policy for horizontal bar |
vscrollbar_policy | policy for vertical bar |
:SetShadowType(self @ T, type @ Gtk.Gtk.ShadowType.T) : Std.Object.T
Changes the type of shadow drawn around the contents of scrolled_window.
scrolled_window | a T |
type | kind of shadow to draw around scrolled window contents |
:SetVadjustment(self @ T, vadjustment @ Gtk.Gtk.Adjustment.T) : Std.Object.T
Sets the Gtk.Gtk.Adjustment.T for the vertical scrollbar.
scrolled_window | a T |
vadjustment | vertical scroll adjustment |
:UnsetPlacement(self @ T) : Std.Object.T
Unsets the placement of the contents with respect to the scrollbars for the scrolled window. If no window placement is set for a scrolled window, it obeys the "gtk-scrolled-window-placement" XSETTING.
See also SetPlacement and GetPlacement.
scrolled_window | a T |