ScrollableProtocol
public protocol ScrollableProtocol
GtkScrollable is an interface that is implemented by widgets with native
scrolling ability.
To implement this interface you should override the
GtkScrollable:hadjustment and GtkScrollable: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 populate the adjustments’
GtkAdjustment:lower,GtkAdjustment:upper,GtkAdjustment:step-increment,GtkAdjustment:page-incrementandGtkAdjustment:page-sizeproperties and connect to theGtkAdjustment::value-changedsignal.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
GtkWidgetClass.size_allocate()function.When the parent allocates space to the scrollable child widget, the widget should update the adjustments’ properties with new values.
When any of the adjustments emits the
GtkAdjustment::value-changedsignal, the scrollable widget should scroll its contents.
The ScrollableProtocol protocol exposes the methods and properties of an underlying GtkScrollable instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Scrollable.
Alternatively, use ScrollableRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkScrollableinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
scrollable_ptrDefault implementationTyped pointer to the underlying
GtkScrollableinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkScrollableinstance.Declaration
Swift
var scrollable_ptr: UnsafeMutablePointer<GtkScrollable>! { get } -
Required Initialiser for types conforming to
ScrollableProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ScrollablePropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ScrollablePropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Scrollable property
Declaration
Swift
@inlinable func get(property: ScrollablePropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Scrollable property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ScrollablePropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
get(border:Extension method) 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 overlayed graphics, like the overshoot indication, at the right position.
Declaration
Swift
@inlinable func get<BorderT>(border: BorderT) -> Bool where BorderT : BorderProtocol -
getHadjustment()Extension methodRetrieves the
GtkAdjustmentused for horizontal scrolling.Declaration
Swift
@inlinable func getHadjustment() -> AdjustmentRef! -
getHscrollPolicy()Extension methodGets the horizontal
GtkScrollablePolicy.Declaration
Swift
@inlinable func getHscrollPolicy() -> GtkScrollablePolicy -
getVadjustment()Extension methodRetrieves the
GtkAdjustmentused for vertical scrolling.Declaration
Swift
@inlinable func getVadjustment() -> AdjustmentRef! -
getVscrollPolicy()Extension methodGets the vertical
GtkScrollablePolicy.Declaration
Swift
@inlinable func getVscrollPolicy() -> GtkScrollablePolicy -
set(hadjustment:Extension method) Sets the horizontal adjustment of the
GtkScrollable.Declaration
Swift
@inlinable func set(hadjustment: AdjustmentRef? = nil) -
set(hadjustment:Extension method) Sets the horizontal adjustment of the
GtkScrollable.Declaration
Swift
@inlinable func set<AdjustmentT>(hadjustment: AdjustmentT?) where AdjustmentT : AdjustmentProtocol -
setHscroll(policy:Extension method) Sets the
GtkScrollablePolicyto determine whether horizontal scrolling should start below the minimum width or below the natural width.Declaration
Swift
@inlinable func setHscroll(policy: GtkScrollablePolicy) -
set(vadjustment:Extension method) Sets the vertical adjustment of the
GtkScrollable.Declaration
Swift
@inlinable func set(vadjustment: AdjustmentRef? = nil) -
set(vadjustment:Extension method) Sets the vertical adjustment of the
GtkScrollable.Declaration
Swift
@inlinable func set<AdjustmentT>(vadjustment: AdjustmentT?) where AdjustmentT : AdjustmentProtocol -
setVscroll(policy:Extension method) Sets the
GtkScrollablePolicyto determine whether vertical scrolling should start below the minimum height or below the natural height.Declaration
Swift
@inlinable func setVscroll(policy: GtkScrollablePolicy) -
hadjustmentExtension methodHorizontal
GtkAdjustmentof the scrollable widget. This adjustment is shared between the scrollable widget and its parent.Declaration
Swift
@inlinable var hadjustment: AdjustmentRef! { get nonmutating set } -
hscrollPolicyExtension methodGets the horizontal
GtkScrollablePolicy.Declaration
Swift
@inlinable var hscrollPolicy: GtkScrollablePolicy { get nonmutating set } -
vadjustmentExtension methodVerical
GtkAdjustmentof the scrollable widget. This adjustment is shared between the scrollable widget and its parent.Declaration
Swift
@inlinable var vadjustment: AdjustmentRef! { get nonmutating set } -
vscrollPolicyExtension methodGets the vertical
GtkScrollablePolicy.Declaration
Swift
@inlinable var vscrollPolicy: GtkScrollablePolicy { get nonmutating set }
View on GitHub
Install in Dash
ScrollableProtocol Protocol Reference