FrameProtocol

public protocol FrameProtocol : WidgetProtocol

GtkFrame is a widget that surrounds its child with a decorative frame and an optional label.

An example GtkFrame

If present, the label is drawn inside the top edge of the frame. The horizontal position of the label can be controlled with [methodGtk.Frame.set_label_align].

GtkFrame clips its child. You can use this to add rounded corners to widgets, but be aware that it also cuts off shadows.

GtkFrame as GtkBuildable

The GtkFrame implementation of the GtkBuildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.

An example of a UI definition fragment with GtkFrame:

&lt;object class="GtkFrame"&gt;
  &lt;child type="label"&gt;
    &lt;object class="GtkLabel" id="frame_label"/&gt;
  &lt;/child&gt;
  &lt;child&gt;
    &lt;object class="GtkEntry" id="frame_content"/&gt;
  &lt;/child&gt;
&lt;/object&gt;

CSS nodes

frame
├── &lt;label widget&gt;
╰── &lt;child&gt;

GtkFrame has a main CSS node with name “frame”, which is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on this node.

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

  • ptr

    Untyped pointer to the underlying GtkFrame instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkFrame instance.

    Default Implementation

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

    Declaration

    Swift

    var frame_ptr: UnsafeMutablePointer<GtkFrame>! { get }
  • Required Initialiser for types conforming to FrameProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Frame Class

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Frame Class: FrameProtocol extension (methods and fields)

  • getChild() Extension method

    Gets the child widget of frame.

    Declaration

    Swift

    @inlinable
    func getChild() -> WidgetRef!
  • getLabel() Extension method

    Returns the frame labels text.

    If the frame’s label widget is not a GtkLabel, nil is returned.

    Declaration

    Swift

    @inlinable
    func getLabel() -> String!
  • getLabelAlign() Extension method

    Retrieves the X alignment of the frame’s label.

    Declaration

    Swift

    @inlinable
    func getLabelAlign() -> CFloat
  • getLabelWidget() Extension method

    Retrieves the label widget for the frame.

    Declaration

    Swift

    @inlinable
    func getLabelWidget() -> WidgetRef!
  • set(child:) Extension method

    Sets the child widget of frame.

    Declaration

    Swift

    @inlinable
    func set(child: WidgetRef? = nil)
  • set(child:) Extension method

    Sets the child widget of frame.

    Declaration

    Swift

    @inlinable
    func set<WidgetT>(child: WidgetT?) where WidgetT : WidgetProtocol
  • set(label:) Extension method

    Creates a new GtkLabel with the label and sets it as the frame’s label widget.

    Declaration

    Swift

    @inlinable
    func set(label: UnsafePointer<CChar>? = nil)
  • setLabelAlign(xalign:) Extension method

    Sets the X alignment of the frame widget’s label.

    The default value for a newly created frame is 0.0.

    Declaration

    Swift

    @inlinable
    func setLabelAlign(xalign: CFloat)
  • set(labelWidget:) Extension method

    Sets the label widget for the frame.

    This is the widget that will appear embedded in the top edge of the frame as a title.

    Declaration

    Swift

    @inlinable
    func set(labelWidget: WidgetRef? = nil)
  • set(labelWidget:) Extension method

    Sets the label widget for the frame.

    This is the widget that will appear embedded in the top edge of the frame as a title.

    Declaration

    Swift

    @inlinable
    func set<WidgetT>(labelWidget: WidgetT?) where WidgetT : WidgetProtocol
  • child Extension method

    The child widget.

    Declaration

    Swift

    @inlinable
    var child: WidgetRef! { get nonmutating set }
  • label Extension method

    Text of the frame’s label.

    Declaration

    Swift

    @inlinable
    var label: String! { get nonmutating set }
  • labelAlign Extension method

    Retrieves the X alignment of the frame’s label.

    Declaration

    Swift

    @inlinable
    var labelAlign: CFloat { get nonmutating set }
  • labelWidget Extension method

    Retrieves the label widget for the frame.

    Declaration

    Swift

    @inlinable
    var labelWidget: WidgetRef! { get nonmutating set }
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GtkWidget { get }