LayoutProtocol

public protocol LayoutProtocol : ContainerProtocol, ScrollableProtocol

GtkLayout is similar to GtkDrawingArea in that it’s a “blank slate” and doesn’t do anything except paint a blank background by default. It’s different in that it supports scrolling natively due to implementing GtkScrollable, and can contain child widgets since it’s a GtkContainer.

If you just want to draw, a GtkDrawingArea is a better choice since it has lower overhead. If you just need to position child widgets at specific points, then GtkFixed provides that functionality on its own.

When handling expose events on a GtkLayout, you must draw to the GdkWindow returned by gtk_layout_get_bin_window(), rather than to the one returned by gtk_widget_get_window() as you would for a GtkDrawingArea.

The LayoutProtocol protocol exposes the methods and properties of an underlying GtkLayout 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 Layout. Alternatively, use LayoutRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkLayout instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkLayout instance.

    Default Implementation

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

    Declaration

    Swift

    var layout_ptr: UnsafeMutablePointer<GtkLayout>! { get }
  • Required Initialiser for types conforming to LayoutProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Layout Class

  • Bind a LayoutPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: LayoutPropertyName, 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 Layout property

    Declaration

    Swift

    @inlinable
    func get(property: LayoutPropertyName) -> 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 Layout property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: LayoutPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Layout Class: LayoutProtocol extension (methods and fields)

  • getBinWindow() Extension method

    Retrieve the bin window of the layout used for drawing operations.

    Declaration

    Swift

    @inlinable
    func getBinWindow() -> Gdk.WindowRef!
  • getHadjustment() Extension method

    This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the horizontal scrollbar and layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    get_hadjustment is deprecated: Use gtk_scrollable_get_hadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getHadjustment() -> AdjustmentRef!
  • getSize(width:height:) Extension method

    Gets the size that has been set on the layout, and that determines the total extents of the layout’s scrollbar area. See gtk_layout_set_size ().

    Declaration

    Swift

    @inlinable
    func getSize(width: UnsafeMutablePointer<guint>! = nil, height: UnsafeMutablePointer<guint>! = nil)
  • getVadjustment() Extension method

    This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the vertical scrollbar and layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    get_vadjustment is deprecated: Use gtk_scrollable_get_vadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getVadjustment() -> AdjustmentRef!
  • move(childWidget:x:y:) Extension method

    Moves a current child of layout to a new position.

    Declaration

    Swift

    @inlinable
    func move<WidgetT>(childWidget: WidgetT, x: Int, y: Int) where WidgetT : WidgetProtocol
  • put(childWidget:x:y:) Extension method

    Adds child_widget to layout, at position (x,y). layout becomes the new parent container of child_widget.

    Declaration

    Swift

    @inlinable
    func put<WidgetT>(childWidget: WidgetT, x: Int, y: Int) where WidgetT : WidgetProtocol
  • setHadjustment(adjustment:) Extension method

    Sets the horizontal scroll adjustment for the layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    set_hadjustment is deprecated: Use gtk_scrollable_set_hadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setHadjustment(adjustment: AdjustmentRef? = nil)
  • setHadjustment(adjustment:) Extension method

    Sets the horizontal scroll adjustment for the layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    set_hadjustment is deprecated: Use gtk_scrollable_set_hadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setHadjustment<AdjustmentT>(adjustment: AdjustmentT?) where AdjustmentT : AdjustmentProtocol
  • setSize(width:height:) Extension method

    Sets the size of the scrollable area of the layout.

    Declaration

    Swift

    @inlinable
    func setSize(width: Int, height: Int)
  • setVadjustment(adjustment:) Extension method

    Sets the vertical scroll adjustment for the layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    set_vadjustment is deprecated: Use gtk_scrollable_set_vadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setVadjustment(adjustment: AdjustmentRef? = nil)
  • setVadjustment(adjustment:) Extension method

    Sets the vertical scroll adjustment for the layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    set_vadjustment is deprecated: Use gtk_scrollable_set_vadjustment()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setVadjustment<AdjustmentT>(adjustment: AdjustmentT?) where AdjustmentT : AdjustmentProtocol
  • binWindow Extension method

    Retrieve the bin window of the layout used for drawing operations.

    Declaration

    Swift

    @inlinable
    var binWindow: Gdk.WindowRef! { get }
  • hadjustment Extension method

    This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the horizontal scrollbar and layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    get_hadjustment is deprecated: Use gtk_scrollable_get_hadjustment()

    Declaration

    Swift

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

    This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the vertical scrollbar and layout.

    See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

    get_vadjustment is deprecated: Use gtk_scrollable_get_vadjustment()

    Declaration

    Swift

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

    Undocumented

    Declaration

    Swift

    @inlinable
    var container: GtkContainer { get }