### Class

# Gtk Frame

#### Description [src]

    class Gtk.Frame : Gtk.Widget {
      parent_instance: GtkWidget
    }

`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 gtk_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 element. A normal content child can be specified without specifying a 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.

#### Hierarchy

#### Ancestors

- GtkWidget
- GInitiallyUnowned
- GObject

#### Implements

- GtkAccessible
- GtkBuildable
- GtkConstraintTarget

#### Constructors

###### gtk_frame_new

Creates a new `GtkFrame`, with optional label `label`.

#### Instance methods

###### gtk_frame_get_child

Gets the child widget of `frame`.

###### gtk_frame_get_label

Returns the frame labels text.

###### gtk_frame_get_label_align

Retrieves the X alignment of the frame’s label.

###### gtk_frame_get_label_widget

Retrieves the label widget for the frame.

###### gtk_frame_set_child

Sets the child widget of `frame`.

###### gtk_frame_set_label

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

###### gtk_frame_set_label_align

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

###### gtk_frame_set_label_widget

Sets the label widget for the frame.

##### Methods inherited from GtkWidget (159)

##### Methods inherited from GtkAccessible (10)

###### gtk_accessible_get_accessible_role

Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`.

###### gtk_accessible_reset_property

Resets the accessible `property` to its default value.

###### gtk_accessible_reset_relation

Resets the accessible `relation` to its default value.

###### gtk_accessible_reset_state

Resets the accessible `state` to its default value.

###### gtk_accessible_update_property

Updates a list of accessible properties.

###### gtk_accessible_update_property_value

Updates an array of accessible properties.

###### gtk_accessible_update_relation

Updates a list of accessible relations.

###### gtk_accessible_update_relation_value

Updates an array of accessible relations.

###### gtk_accessible_update_state

Updates a list of accessible states. See the `GtkAccessibleState` documentation for the value types of accessible states.

###### gtk_accessible_update_state_value

Updates an array of accessible states.

##### Methods inherited from GtkBuildable (1)

###### gtk_buildable_get_buildable_id

Gets the ID of the `buildable` object.

#### Properties

###### Gtk.Frame:child

The child widget.

###### Gtk.Frame:label

Text of the frame’s label.

###### Gtk.Frame:label-widget

Widget to display in place of the usual frame label.

###### Gtk.Frame:label-xalign

The horizontal alignment of the label.

##### Properties inherited from GtkWidget (34)

###### Gtk.Widget:can-focus

Whether the widget or any of its descendents can accept the input focus.

###### Gtk.Widget:can-target

Whether the widget can receive pointer events.

###### Gtk.Widget:css-classes

A list of css classes applied to this widget.

###### Gtk.Widget:css-name

The name of this widget in the CSS tree.

###### Gtk.Widget:cursor

The cursor used by `widget`.

###### Gtk.Widget:focus-on-click

Whether the widget should grab focus when it is clicked with the mouse.

###### Gtk.Widget:focusable

Whether this widget itself will accept the input focus.

###### Gtk.Widget:halign

How to distribute horizontal space if widget gets extra space.

###### Gtk.Widget:has-default

Whether the widget is the default widget.

###### Gtk.Widget:has-focus

Whether the widget has the input focus.

###### Gtk.Widget:has-tooltip

Enables or disables the emission of the ::query-tooltip signal on `widget`.

###### Gtk.Widget:height-request

Override for height request of the widget.

###### Gtk.Widget:hexpand

Whether to expand horizontally.

###### Gtk.Widget:hexpand-set

Whether to use the `hexpand` property.

###### Gtk.Widget:layout-manager

The `GtkLayoutManager` instance to use to compute the preferred size of the widget, and allocate its children.

###### Gtk.Widget:margin-bottom

Margin on bottom side of widget.

###### Gtk.Widget:margin-end

Margin on end of widget, horizontally.

###### Gtk.Widget:margin-start

Margin on start of widget, horizontally.

###### Gtk.Widget:margin-top

Margin on top side of widget.

###### Gtk.Widget:name

The name of the widget.

###### Gtk.Widget:opacity

The requested opacity of the widget.

###### Gtk.Widget:overflow

How content outside the widget’s content area is treated.

###### Gtk.Widget:parent

The parent widget of this widget.

###### Gtk.Widget:receives-default

Whether the widget will receive the default action when it is focused.

###### Gtk.Widget:root

The `GtkRoot` widget of the widget tree containing this widget.

###### Gtk.Widget:scale-factor

The scale factor of the widget.

###### Gtk.Widget:sensitive

Whether the widget responds to input.

###### Gtk.Widget:tooltip-markup

Sets the text of tooltip to be the given string, which is marked up with Pango markup.

###### Gtk.Widget:tooltip-text

Sets the text of tooltip to be the given string.

###### Gtk.Widget:valign

How to distribute vertical space if widget gets extra space.

###### Gtk.Widget:vexpand

Whether to expand vertically.

###### Gtk.Widget:vexpand-set

Whether to use the `vexpand` property.

###### Gtk.Widget:visible

Whether the widget is visible.

###### Gtk.Widget:width-request

Override for width request of the widget.

##### Properties inherited from GtkAccessible (1)

###### Gtk.Accessible:accessible-role

The accessible role of the given `GtkAccessible` implementation.

#### Class structure

    struct GtkFrameClass {
      GtkWidgetClass parent_class;
      void (* compute_child_allocation) (
        GtkFrame* frame,
        GtkAllocation* allocation
      );

    }

###### Class members

`parent_class` |
    GtkWidgetClass
| The parent class.
`compute_child_allocation` |
    void (* compute_child_allocation) (
        GtkFrame* frame,
        GtkAllocation* allocation
      )
| No description available.

#### Virtual methods

###### Gtk.FrameClass.compute_child_allocation

No description available.