AspectFrame


Object Hierarchy:

Object hierarchy for AspectFrame

Description:

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