Object Hierarchy:

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


[ CCode ( type_id = "gtk_alignment_get_type ()" ) ]
[ Version ( deprecated = true , deprecated_since = "3.14" ) ]
public class Alignment : Bin, Implementor, Buildable

Warning: Alignment is deprecated since 3.14.

The Alignment widget controls the alignment and size of its child widget.

It has four settings: xscale, yscale, xalign, and yalign.

The scale settings are used to specify how much the child widget should expand to fill the space allocated to the Alignment . The values can range from 0 (meaning the child doesn’t expand at all) to 1 (meaning the child expands to fill all of the available space).

The align settings are used to place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect.

GtkAlignment has been deprecated in 3.14 and should not be used in newly-written code. The desired effect can be achieved by using the halign, valign and margin properties on the child widget.

Example: Alignment:

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

// Alignment:
Gtk.Alignment alignment = new Gtk.Alignment (0.50f, 0.25f, 1.0f, 0.5f);
alignment.right_padding = 20;
alignment.left_padding = 10;
this.add (alignment);

// Alignment content:
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.Alignment.vala

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