Class Frame

All Implemented Interfaces:
PointerInterface

public class Frame extends Widget
`GtkFrame` is a widget that surrounds its child with a decorative
frame and an optional label.

![An example GtkFrame](frame.png)

If present, the label is drawn inside the top edge of the frame.
The horizontal position of the label can be controlled with
[method@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 <child> element. A normal content child can
be specified without specifying a <child> type attribute.

An example of a UI definition fragment with GtkFrame:
```xml
<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.

https://docs.gtk.org/gtk4/class.Frame.html

  • Constructor Details

    • Frame

      public Frame(PointerContainer pointer)
    • Frame

      public Frame(@Nullable Str label)
      Creates a new `GtkFrame`, with optional label @label.

      If @label is %NULL, the label is omitted.
      Parameters:
      label - the text to use as the label of the frame
    • Frame

      public Frame(String label)
      Creates a new `GtkFrame`, with optional label @label.

      If @label is %NULL, the label is omitted.
      Parameters:
      label - the text to use as the label of the frame
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getChild

      public Widget getChild()
      Gets the child widget of @frame.
      Returns:
      the child widget of @frame
    • getLabel

      public Str getLabel()
      Returns the frame labels text.

      If the frame's label widget is not a `GtkLabel`, %NULL
      is returned.
      Returns:
      the text in the label, or %NULL 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.
    • getLabelAlign

      public float getLabelAlign()
      Retrieves the X alignment of the frame’s label.
      Returns:
      the frames X alignment
    • getLabelWidget

      public Widget getLabelWidget()
      Retrieves the label widget for the frame.
      Returns:
      the label widget
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of @frame.
      Parameters:
      child - the child widget
    • setLabel

      public void setLabel(@Nullable Str label)
      Creates a new `GtkLabel` with the @label and sets it as the frame's
      label widget.
      Parameters:
      label - the text to use as the label of the frame
    • setLabel

      public void setLabel(String label)
      Creates a new `GtkLabel` with the @label and sets it as the frame's
      label widget.
      Parameters:
      label - the text to use as the label of the frame
    • setLabelAlign

      public void setLabelAlign(float xalign)
      Sets the X alignment of the frame widget’s label.

      The default value for a newly created frame is 0.0.
      Parameters:
      xalign - 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.
    • setLabelWidget

      public void setLabelWidget(@Nullable Widget 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.
      Parameters:
      label_widget - the new label widget
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()