FrameProtocol

public protocol FrameProtocol : BinProtocol

The frame widget is a bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with gtk_frame_set_label_align().

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:

<object class="GtkFrame">
  <child type="label">
    <object class="GtkLabel" id="frame-label"/>
  </child>
  <child>
    <object class="GtkEntry" id="frame-content"/>
  </child>
</object>

CSS nodes

(plain Language Example):

frame
├── border[.flat]
├── <label widget>
╰── <child>

GtkFrame has a main CSS node named “frame” and a subnode named “border”. The “border” node is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on the “border” node.

The border node can be given the style class “.flat”, which is used by themes to disable drawing of the border. To do this from code, call gtk_frame_set_shadow_type() with GTK_SHADOW_NONE to add the “.flat” class or any other shadow type to remove it.

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)

  • getLabel() Extension method

    If the frame’s label widget is a GtkLabel, returns the text in the label widget. (The frame will have a GtkLabel for the label widget if a non-nil argument was passed to gtk_frame_new().)

    Declaration

    Swift

    @inlinable
    func getLabel() -> String!
  • Retrieves the X and Y alignment of the frame’s label. See gtk_frame_set_label_align().

    Declaration

    Swift

    @inlinable
    func getLabelAlign(xalign: UnsafeMutablePointer<gfloat>! = nil, yalign: UnsafeMutablePointer<gfloat>! = nil)
  • getLabelWidget() Extension method

    Retrieves the label widget for the frame. See gtk_frame_set_label_widget().

    Declaration

    Swift

    @inlinable
    func getLabelWidget() -> WidgetRef!
  • getShadowType() Extension method

    Retrieves the shadow type of the frame. See gtk_frame_set_shadow_type().

    Declaration

    Swift

    @inlinable
    func getShadowType() -> GtkShadowType
  • set(label:) Extension method

    Removes the current GtkFrame:label-widget. If label is not nil, creates a new GtkLabel with that text and adds it as the GtkFrame:label-widget.

    Declaration

    Swift

    @inlinable
    func set(label: UnsafePointer<gchar>? = nil)
  • Sets the alignment of the frame widget’s label. The default values for a newly created frame are 0.0 and 0.5.

    Declaration

    Swift

    @inlinable
    func setLabelAlign(xalign: Double, yalign: Double)
  • set(labelWidget:) Extension method

    Sets the GtkFrame: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 GtkFrame: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
  • setShadow(type:) Extension method

    Sets the GtkFrame:shadow-type for frame, i.e. whether it is drawn without (GTK_SHADOW_NONE) or with (other values) a visible border. Values other than GTK_SHADOW_NONE are treated identically by GtkFrame. The chosen type is applied by removing or adding the .flat class to the CSS node named border.

    Declaration

    Swift

    @inlinable
    func setShadow(type: GtkShadowType)
  • label Extension method

    Undocumented

    Declaration

    Swift

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

    Retrieves the label widget for the frame. See gtk_frame_set_label_widget().

    Declaration

    Swift

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

    Retrieves the shadow type of the frame. See gtk_frame_set_shadow_type().

    Declaration

    Swift

    @inlinable
    var shadowType: GtkShadowType { get nonmutating set }
  • bin Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var bin: GtkBin { get }