Object Hierarchy:

Gtk.Frame Gtk.Frame Gtk.Frame Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Frame Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.Frame Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Frame Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget


[ CCode ( type_id = "gtk_frame_get_type ()" ) ]
public class Frame : Bin, Implementor, Buildable

The frame widget is a bin that surrounds its child with a decorative frame and an optional label.

If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with set_label_align.

GtkFrame as GtkBuildable

The GtkFrame implementation of the 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"/>
<object class="GtkEntry" id="frame-content"/>

CSS nodes

├── border[.flat]
├── <label widget>
╰── <child>
ain CSS node named “frame” and a subnode named “border”. The “border” node is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on the “border” node.

The border node can be given the style class “.flat”, which is used by themes to disable drawing of the border. To do this from code, call set_shadow_type with gtk_shadow_none to add the “.flat” class or any other shadow type to remove it.


Example: Frame:

public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.Frame";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
this.set_default_size (350, 70);

// The frame:
Gtk.Frame frame = new Gtk.Frame ("<b>My title:</b>");
(frame.label_widget as Gtk.Label).use_markup = true;
this.add (frame);

// Frame content:
Gtk.Alignment alignment = new Gtk.Alignment (0.50f, 0.50f, 1.0f, 1.0f);
alignment.left_padding = 12;
frame.add (alignment);

Gtk.Button button = new Gtk.Button.with_label ("Frame content");
alignment.add (button);

public static int main (string[] args) {
Gtk.init (ref args);

Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;

valac --pkg gtk+-3.0 Gtk.Frame.vala

All known sub-classes:

Namespace: Gtk
Package: gtk+-3.0



Creation methods:


Inherited Members:

All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor