FrameProtocol
public protocol FrameProtocol : WidgetProtocol
GtkFrame
is a widget that surrounds its child with a decorative
frame and an optional label.
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:
<object class="GtkFrame">
<child type="label">
<object class="GtkLabel" id="frame_label"/>
</child>
<child>
<object class="GtkEntry" id="frame_content"/>
</child>
</object>
CSS nodes
frame
├── <label widget>
╰── <child>
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.
-
Untyped pointer to the underlying
GtkFrame
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
frame_ptr
Default implementationTyped 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)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) 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 transformationtransform_to
ValueTransformer
to use for backwards transformationReturn 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:
Extension methodvalue: ) 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
-
getChild()
Extension methodGets the child widget of
frame
.Declaration
Swift
@inlinable func getChild() -> WidgetRef!
-
getLabel()
Extension methodReturns 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 methodRetrieves the X alignment of the frame’s label.
Declaration
Swift
@inlinable func getLabelAlign() -> CFloat
-
getLabelWidget()
Extension methodRetrieves 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 thelabel
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 methodThe child widget.
Declaration
Swift
@inlinable var child: WidgetRef! { get nonmutating set }
-
label
Extension methodText of the frame’s label.
Declaration
Swift
@inlinable var label: String! { get nonmutating set }
-
labelAlign
Extension methodRetrieves the X alignment of the frame’s label.
Declaration
Swift
@inlinable var labelAlign: CFloat { get nonmutating set }
-
labelWidget
Extension methodRetrieves the label widget for the frame.
Declaration
Swift
@inlinable var labelWidget: WidgetRef! { get nonmutating set }
-
parentInstance
Extension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GtkWidget { get }