gtk.frame

Module for [Frame] class

Types 3

gtk.frame.Frame 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 gtk.frame.Frame.setLabelAlign.

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

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>

gtk.frame.Frame 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

gtk.frame.Frame uses the gtk.types.AccessibleRole.Group role.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Frame self() nothrowReturns `this`, for use in `with` statements.
FrameGidBuilder builder() static nothrowGet builder for [gtk.frame.Frame] Returns: New builder object
gtk.widget.Widget child() @property nothrowGet `child` property. Returns: The child widget.
void child(gtk.widget.Widget propval) @property nothrowSet `child` property. Params: propval = The child widget.
string label() @property nothrowGet `label` property. Returns: Text of the frame's label.
void label(string propval) @property nothrowSet `label` property. Params: propval = Text of the frame's label.
gtk.widget.Widget labelWidget() @property nothrowGet `labelWidget` property. Returns: Widget to display in place of the usual frame label.
void labelWidget(gtk.widget.Widget propval) @property nothrowSet `labelWidget` property. Params: propval = Widget to display in place of the usual frame label.
float labelXalign() @property nothrowGet `labelXalign` property. Returns: The horizontal alignment of the label.
void labelXalign(float propval) @property nothrowSet `labelXalign` property. Params: propval = The horizontal alignment of the label.
gtk.widget.Widget getChild() nothrowGets the child widget of frame. Returns: the child widget of frame
string getLabel() nothrowReturns the frame labels text.
float getLabelAlign() nothrowRetrieves the X alignment of the frame’s label. Returns: the frames X alignment
gtk.widget.Widget getLabelWidget() nothrowRetrieves the label widget for the frame. Returns: the label widget
void setChild(gtk.widget.Widget child = null) nothrowSets the child widget of frame.
void setLabel(string label = null) nothrowCreates a new [gtk.label.Label] with the label and sets it as the frame's label widget.
void setLabelAlign(float xalign) nothrowSets the X alignment of the frame widget’s label.
void setLabelWidget(gtk.widget.Widget labelWidget = null) nothrowSets the label widget for the frame.
Constructors
this(void * ptr, Flag!"Take" take)
this(string label = null)Creates a new [gtk.frame.Frame], with optional label label.

Fluent builder implementation template for gtk.frame.Frame

Methods
T child(gtk.widget.Widget propval) nothrowSet `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chaining
T label(string propval) nothrowSet `label` property. Params: propval = Text of the frame's label. Returns: Builder instance for fluent chaining
T labelWidget(gtk.widget.Widget propval) nothrowSet `labelWidget` property. Params: propval = Widget to display in place of the usual frame label. Returns: Builder instance for fluent chaining
T labelXalign(float propval) nothrowSet `labelXalign` property. Params: propval = The horizontal alignment of the label. Returns: Builder instance for fluent chaining

Fluent builder for gtk.frame.Frame

Methods
Frame build() nothrowCreate object from builder. Returns: New object