[Contents] [Back] [Prev] [Up] [Next] [Forward]

# Package Gtk.Layout

A Gtk_Layout is a widget that can have an almost infinite size, without occupying a lot of memory. Its children can be located anywhere within it, but will only appear on the screen if the visible area of the layout contains them. Just like a Gtk_Viewport, its visible area is indicated by two Gtk_Adjustment widgets, and thus a Gtk_Layout can be put as is in a Gtk_Scrolled_Window. As for Gtk_Fixed containers, the children can be located anywhere in the layout (no automatic organization is done). But, as opposed to Gtk_Fixed widgets, a Gtk_Layout does not try to resize itself to show all its children.

Starting from GtkAda 2.0, you have to call Set_Size and specify the maximum size of the layout, otherwise children added with Put outside the size defined for the layout will never be visible. One way to do this is to systematically call Set_Size before calling Put, and make sure you specify a size big enough for the layout.

- Gtk.Layout Widget Hierarchy
- Gtk.Layout Signals
- Gtk.Layout Subprograms

## Widget Hierarchy

    GObject                       (see section Package Glib.Object)
    Gtk_Object                    (see section Package Gtk.Object)
       \___ Gtk_Widget            (see section Package Gtk.Widget)
          \___ Gtk_Container      (see section Package Gtk.Container)
             \___ Gtk_Layout      (see section Package Gtk.Layout)

## Signals

- "set_scroll_adjustments" procedure Handler (Layout : access Gtk_Layout_Record'Class;
  Hadj : in Gtk.Adjustment.Gtk_Adjustment;
  Vadj : in Gtk.Adjustment.Gtk_Adjustment);
  Emitted whenever at least one of the adjustment of the layout is changed.

## Subprograms

    procedure Gtk_New
      (Layout             : out    Gtk_Layout;
       Hadjustment        :        Adjustment.Gtk_Adjustment
                           := Adjustment.Null_Adjustment;
       Vadjustment        :        Adjustment.Gtk_Adjustment
                           := Adjustment.Null_Adjustment);

| Create new layout. You can either give an explicit couple of adjustments, that will indicate the current visible area. If you don't specify any, they will be created automatically by GtkAda, which is the usual way to do. The Layout does not occupy any area on the screen, and you have to explicitly specify one with Set_Size below.

    function Get_Type              return Gtk.Gtk_Type;

| Return the internal value associated with a Gtk_Layout.

    procedure Put
      (Layout             : access Gtk_Layout_Record;
       Widget             : access Gtk.Widget.Gtk_Widget_Record'Class;
       X                  :        Gint;
       Y                  :        Gint);

| Insert a new child in the layout. The child will be displayed on the screen only if at least part of it intersects the visible area of the layout. The layout does not resize itself to automatically show the widget. You also need to call Set_Size, if the size you initially defined is smaller than (X, Y), or the child will never be visible even if the layout is scrolled.

    procedure Move
      (Layout             : access Gtk_Layout_Record;
       Widget             : access Gtk.Widget.Gtk_Widget_Record'Class;
       X                  :        Gint;
       Y                  :        Gint);

| Move a child of the layout. Nothing is done if Widget is not already a child of Layout.

    function Get_Bin_Window
      (Widget             : access Gtk_Layout_Record)
       return Gdk.Window.Gdk_Window;

| Return the window associated with the layout. You should use this one rather than Gtk.Widget.Get_Window.

    procedure Set_Size
      (Layout             : access Gtk_Layout_Record;
       Width              :        Guint;
       Height             :        Guint);

| Specify an absolute size for the layout. This is not the size on the screen, but the internal size of the widget. The screen's size can be set with Gtk.Widget.Set_Usize.

    procedure Get_Size
      (Layout             : access Gtk_Layout_Record;
       Width              : out    Guint;
       Height             : out    Guint);

| Get the current size in pixels of the layout, as set with Set_Size

    function Get_Hadjustment
      (Layout             : access Gtk_Layout_Record)
       return Gtk.Adjustment.Gtk_Adjustment;

| Return the adjustment that indicate the horizontal visual area of the layout. You generally do not have to modify the value of this adjustment yourself, since this is done automatically when the layout has been put in a Gtk_Scrolled_Window.

    function Get_Vadjustment
      (Layout             : access Gtk_Layout_Record)
       return Gtk.Adjustment.Gtk_Adjustment;

| Return the adjustment that indicate the vertical visual area of the layout. You generally do not have to modify the value of this adjustment yourself, since this is done automatically when the layout has been put in a Gtk_Scrolled_Window.

    procedure Set_Hadjustment
      (Layout             : access Gtk_Layout_Record;
       Adjustment         :        Gtk.Adjustment.Gtk_Adjustment);

| Specify a new adjustment to use for the horizontal visual area.

    procedure Set_Vadjustment
      (Layout             : access Gtk_Layout_Record;
       Adjustment         :        Gtk.Adjustment.Gtk_Adjustment);

| Specify a new adjustment to use for the vertical visual area.

[Contents] [Back] [Prev] [Up] [Next] [Forward]