1.79 <GtkFrame>

Class: <GtkFrame>

It derives from <GtkWidget>.

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 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

An example of a UI definition fragment with GtkFrame:

<object class="GtkFrame">
  <property name="label-widget">
    <object class="GtkLabel" id="frame_label"/>
  </property>
  <property name="child">
    <object class="GtkEntry" id="frame_content"/>
  </property>
</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.

Accessibility

<GtkFrame> uses the Gtk.AccessibleRole.group role.

Fields

parent-instance

Properties

Property: frame:child self

The child widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (frame:child self) value).

Property: frame:label self

Text of the frame’s label.

Its value is a string, or #f.

Set it with (set! (frame:label self) value).

Property: frame:label-widget self

Widget to display in place of the usual frame label.

Its value is a <GtkWidget>, or #f.

Set it with (set! (frame:label-widget self) value).

Property: frame:label-xalign self

The horizontal alignment of the label.

Its value is a real number.

Set it with (set! (frame:label-xalign self) value).

Procedures

Method: frame:get-child self ⇒ %return
Method: get-child self ⇒ %return

Gets the child widget of self.

self

Passed: a <GtkFrame>.

a <GtkFrame>

%return

Returned: a <GtkWidget>, or #f.

the child widget of self

Method: frame:get-label self ⇒ %return
Method: get-label self ⇒ %return

Returns the frame labels text.

If the frame’s label widget is not a <GtkLabel>, #f is returned.

self

Passed: a <GtkFrame>.

a <GtkFrame>

%return

Returned: a string, or #f.

the text in the label, or #f if there was no label widget or the label widget was not a <GtkLabel>. This string is owned by GTK and must not be modified or freed.

Method: frame:get-label-align self ⇒ %return
Method: get-label-align self ⇒ %return

Retrieves the X alignment of the frame’s label.

self

Passed: a <GtkFrame>.

a <GtkFrame>

%return

Returned: a real number.

the frames X alignment

Method: frame:get-label-widget self ⇒ %return
Method: get-label-widget self ⇒ %return

Retrieves the label widget for the frame.

self

Passed: a <GtkFrame>.

a <GtkFrame>

%return

Returned: a <GtkWidget>, or #f.

the label widget

Procedure: frame:new [label] ⇒ %return

Creates a new <GtkFrame>, with optional label label.

If label is #f, the label is omitted.

label

Passed, or left out: a string, or #f.

the text to use as the label of the frame

%return

Returned: a <GtkWidget>.

a new <GtkFrame> widget

Method: frame:set-child self [child]
Method: set-child self [child]

Sets the child widget of self.

self

Passed: a <GtkFrame>.

a <GtkFrame>

child

Passed, or left out: a <GtkWidget>, or #f.

the child widget

Method: frame:set-label self [label]
Method: set-label self [label]

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

self

Passed: a <GtkFrame>.

a <GtkFrame>

label

Passed, or left out: a string, or #f.

the text to use as the label of the frame

Method: frame:set-label-align self xalign
Method: set-label-align self xalign

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

The default value for a newly created frame is 0.0.

self

Passed: a <GtkFrame>.

a <GtkFrame>

xalign

Passed: a real number.

The position of the label along the top edge of the widget. A value of 0.0 represents left alignment; 1.0 represents right alignment.

Method: frame:set-label-widget self [label-widget]
Method: set-label-widget self [label-widget]

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.

self

Passed: a <GtkFrame>.

a <GtkFrame>

label-widget

Passed, or left out: a <GtkWidget>, or #f.

the new label widget

Virtual methods

Virtual method: frame:do-compute-child-allocation implementor self allocation

To override it in a new class, give register-type #:vfuncs `((compute-child-allocation . ,procedure)). The procedure is called as (procedure self allocation).

implementor

Passed: the class whose implementation to call: <GtkFrame>, or a class that derives from it, or its GType number.

self

Passed: a <GtkFrame>.

allocation

Passed: a <GdkRectangle>.