Package: gtk

Class gtk:frame

Superclasses

Documented Subclasses

None

Direct Slots

child
The child property of type gtk:widget (Read / Write)
The child widget of the frame.
label
The label property of type :string (Read / Write)
The text of the label of the frame.
Default value: nil
label-widget
The label-widget property of type gtk:widget (Read / Write)
The widget to display in place of the usual frame label.
label-xalign
The label-xalign property of type :float (Read / Write)
The horizontal alignment of the label.
Allowed values: [0.0, 1.0]
Default value: 0.0

Details

The gtk:frame widget is a widget that surrounds its child widget with a frame and an optional label.

Figure: GtkFrame

If present, the label is drawn inside the top edge of the frame. The horizontal position of the label can be controlled with the gtk:frame-label-xalign function.

The gtk:frame widget clips its child widget. You can use this to add rounded corners to widgets, but be aware that it also cuts off shadows. See the gtk:aspect-frame widget for a frame that constrains its child to a particular aspect ratio.

GtkFrame as GtkBuildable

The gtk:frame implementation of the gtk:buildable 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.

Example: A UI definition fragment with a gtk:frame widget
<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>    
The gtk:frame implementation 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.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2024-4-19