AspectFrame


Object Hierarchy:

Gtk.AspectFrame Gtk.AspectFrame Gtk.AspectFrame Gtk.Frame Gtk.Frame Gtk.Frame->Gtk.AspectFrame 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.AspectFrame Atk.Implementor->Gtk.Frame Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.AspectFrame Gtk.Buildable->Gtk.Frame Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget

Description:

[ CCode ( type_id = "gtk_aspect_frame_get_type ()" ) ]
public class AspectFrame : Frame, Implementor, Buildable

The AspectFrame is useful when you want pack a widget so that it can resize but always retains the same aspect ratio.

For instance, one might be drawing a small preview of a larger image. AspectFrame derives from Frame, so it can draw a label and a frame around the child. The frame will be “shrink-wrapped” to the size of the child.

CSS nodes

GtkAspectFrame uses a CSS node with name frame.

Example: AspectFrame:

public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.AspectFrame";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
this.set_default_size (200, 200);
this.set_border_width (10);

// The AspectFrame:
Gtk.AspectFrame frame = new Gtk.AspectFrame ("Label", 0.5f, 0.5f, 2.0f, false);
this.add (frame);

// AspectFrame content:
Gtk.Button button = new Gtk.Button.with_label ("My Button");
frame.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.AspectFrame.vala


Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

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