A Gtk_Packer is a container that organizes its children according to a given location (North, East, South, West or any combination of them).
The children can be set to expand and/or fill their assigned location.
Widget Hierarchy |
---|
Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Container (see section Package Gtk.Container) \___ Gtk_Packer (see section Package Gtk.Packer) |
Types |
---|
type Gtk_Anchor_Type is (Anchor_Center, Anchor_North, Anchor_North_West, Anchor_North_East, Anchor_South, Anchor_South_East, Anchor_South_West, Anchor_West, Anchor_East); | |
Gtk_Anchor_Type indicates the exact location of the widget on its
side. Note that not all anchors are relevant for each side.
For instance, if you put a widget on Side_Right, with an anchor of
Anchor_North, Anchor_North_West or Anchor_North_East, the widget will
in fact appear on the upper right side of the remaining space in the
container.
Thus, if a previous child was added on Side_North, then the new child
will only appear on the second line in the container. The order the
children are inserted into the container is important.
| |
type Gtk_Packer_Child is new Gdk.C_Proxy; | |
A child of the packer.
It includes both the widget and its position in the packer.
| |
type Gtk_Packer_Options is new Guint; | |
Indicate how the child should fill its allocated area.
If Gtk_Pack_Expand is set, the child allocated area is expanded to
occupy the whole width (or height) or the Package. The orientation
depends on the side of the child (if Top or Bottom, the expansion
is done vertically, otherwise it is done horizontally).
If Gtk_Fill_X or Gtk_Fill_Y is set, the child is resized till it
occupies all the area allocated to it.
If the side of the widget is top or bottom, the widget can always
be filled horizontally with Gtk_Fill_X (and will thus be as wide as
the Gtk_Packer itself. However, it can be filled vertically with
Gtk_Fill_Y only if Gtk_Pack_Expand is set.
| |
type Gtk_Side_Type is (Side_Top, Side_Bottom, Side_Left, Side_Right); | |
Gtk_Side_Type indicates on which the widget should be inserted.
The children are displayed in the order they were inserted into the
container.
Each time a child is displayed, the available space for the remaining
child is restrained. For instance, every time you put a child on the
Side_Top or Side_Bottom, the available space is decreased so that no
other widget is inserted in the same line.
For instance, if you put two widgets on Side_Top, the second one will
appear below the first one. If you add two widgets on Side_Right, the
second one will be placed on the left of the first.
|
Subprograms |
---|
Modifying the Packer | ||
procedure Gtk_New (Widget : out Gtk_Packer); | ||
Create a new empty packer.
| ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Packer.
| ||
procedure Add_Defaults (Packer : access Gtk_Packer_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Side : in Gtk_Side_Type; Anchor : in Gtk_Anchor_Type; Options : in Gtk_Packer_Options); | ||
Add a new child in the container, with default values for its border | ||
procedure Add (Packer : access Gtk_Packer_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Side : in Gtk_Side_Type; Anchor : in Gtk_Anchor_Type; Options : in Gtk_Packer_Options; Border_Width : in Guint; Pad_X : in Guint; Pad_Y : in Guint; I_Pad_X : in Guint; I_Pad_Y : in Guint); | ||
Add a new child in the container.
Border_Width is the space left on each side of the child.
Pad_X is additional space left on each horizontal side of the child
when it is not centered (the anchor is NE, E, NW, SW, W, SE)
Pad_Y is additional space left on each vertical side of the child
when it is not centered (the anchor is NW, N, NE, SE, S, SW)
I_Pad_X is additional space left on each horizontal side of the
child when it is on the borders (anchor is N, Center, S)
I_Pad_Y is additional space left on each vertical side of the
child when it is on the borders (anchor is E, Center, W)
| ||
procedure Set_Child_Packing (Packer : access Gtk_Packer_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Side : in Gtk_Side_Type; Anchor : in Gtk_Anchor_Type; Options : in Gtk_Packer_Options; Border_Width : in Guint; Pad_X : in Guint; Pad_Y : in Guint; I_Pad_X : in Guint; I_Pad_Y : in Guint); | ||
Change the packing options for Child. | ||
procedure Reorder_Child (Packer : access Gtk_Packer_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Position : in Gint); | ||
Change the position of the child in the list of children. | ||
procedure Set_Default_Border_Width (Packer : access Gtk_Packer_Record; Border : in Guint); | ||
Modify the default border width for all the children of Packer. | ||
procedure Set_Default_Ipad (Packer : access Gtk_Packer_Record; I_Pad_X : in Guint; I_Pad_Y : in Guint); | ||
Set the default Ipadding for all the children of Packer. | ||
procedure Set_Default_Pad (Packer : access Gtk_Packer_Record; Pad_X : in Guint; Pad_Y : in Guint); | ||
Set the default Padding for all the children of Packer. | ||
Accessing children | ||
Some functions give access to the children of a Gtk_Packer. | ||
function Find_Child (Packer : access Gtk_Packer_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class) return Gtk_Packer_Child; | ||
Return the child of Packer that is associated with the widget Child. | ||
function Get_Nth_Child (Packer : access Gtk_Packer_Record; N : Guint) return Gtk_Packer_Child; | ||
Returns the Nth child of the packer. | ||
function Get_Anchor (Child : Gtk_Packer_Child) return Gtk_Anchor_Type; | ||
Return the Anchor type for the child.
| ||
function Get_Side (Child : Gtk_Packer_Child) return Gtk_Side_Type; | ||
Return the side of the child.
| ||
function Get_Options (Chlid : Gtk_Packer_Child) return Gtk_Packer_Options; | ||
Return the options set for the child.
| ||
function Get_Border_Width (Child : Gtk_Packer_Child) return Guint; | ||
Return the border width for the child.
| ||
function Get_Pad_X (Child : Gtk_Packer_Child) return Guint; | ||
Return the X padding for the child (when on the borders).
| ||
function Get_Pad_Y (Child : Gtk_Packer_Child) return Guint; | ||
Return the Y padding for the child (when on the borders).
| ||
function Get_I_Pad_X (Child : Gtk_Packer_Child) return Guint; | ||
Return the X i_padding for the child (when not on the borders).
| ||
function Get_I_Pad_Y (Child : Gtk_Packer_Child) return Guint; | ||
Return the Y i_padding for the child (when not on the borders).
|