ScrollableProtocol

public protocol ScrollableProtocol

GtkScrollable is an interface for widgets with native scrolling ability.

To implement this interface you should override the [propertyGtk.Scrollable:hadjustment] and [propertyGtk.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 populate the adjustments’ [propertyGtk.Adjustment:lower], [propertyGtk.Adjustment:upper], [propertyGtk.Adjustment:step-increment], [propertyGtk.Adjustment:page-increment] and [propertyGtk.Adjustment:page-size] properties and connect to the [signalGtk.Adjustment::value-changed] signal.

  • 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 [vfuncGtk.Widget.size_allocate] implementation.

  • 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 [signalGtk.Adjustment::value-changed] signal, 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.

  • ptr

    Untyped pointer to the underlying GtkScrollable instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • scrollable_ptr Default implementation

    Typed pointer to the underlying GtkScrollable instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkScrollable instance.

    Declaration

    Swift

    var scrollable_ptr: UnsafeMutablePointer<GtkScrollable>! { get }
  • Required Initialiser for types conforming to ScrollableProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Scrollable Interface

  • Bind a ScrollablePropertyName source 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 : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Scrollable property

    Declaration

    Swift

    @inlinable
    func get(property: ScrollablePropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    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

    property

    the property to get the value for

    Return Value

    the value of the named property

Scrollable Interface: ScrollableProtocol extension (methods and fields)

  • 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 overlaid graphics, like the overshoot indication, at the right position.

    Declaration

    Swift

    @inlinable
    func get<BorderT>(border: BorderT) -> Bool where BorderT : BorderProtocol
  • getHadjustment() Extension method

    Retrieves the GtkAdjustment used for horizontal scrolling.

    Declaration

    Swift

    @inlinable
    func getHadjustment() -> AdjustmentRef!
  • getHscrollPolicy() Extension method

    Gets the horizontal GtkScrollablePolicy.

    Declaration

    Swift

    @inlinable
    func getHscrollPolicy() -> GtkScrollablePolicy
  • getVadjustment() Extension method

    Retrieves the GtkAdjustment used for vertical scrolling.

    Declaration

    Swift

    @inlinable
    func getVadjustment() -> AdjustmentRef!
  • getVscrollPolicy() Extension method

    Gets 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 GtkScrollablePolicy.

    The policy determines 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 GtkScrollablePolicy.

    The policy determines whether vertical scrolling should start below the minimum height or below the natural height.

    Declaration

    Swift

    @inlinable
    func setVscroll(policy: GtkScrollablePolicy)
  • hadjustment Extension method

    Horizontal GtkAdjustment of the scrollable widget.

    This adjustment is shared between the scrollable widget and its parent.

    Declaration

    Swift

    @inlinable
    var hadjustment: AdjustmentRef! { get nonmutating set }
  • hscrollPolicy Extension method

    Gets the horizontal GtkScrollablePolicy.

    Declaration

    Swift

    @inlinable
    var hscrollPolicy: GtkScrollablePolicy { get nonmutating set }
  • vadjustment Extension method

    Vertical GtkAdjustment of the scrollable widget.

    This adjustment is shared between the scrollable widget and its parent.

    Declaration

    Swift

    @inlinable
    var vadjustment: AdjustmentRef! { get nonmutating set }
  • vscrollPolicy Extension method

    Gets the vertical GtkScrollablePolicy.

    Declaration

    Swift

    @inlinable
    var vscrollPolicy: GtkScrollablePolicy { get nonmutating set }