1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2006 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  A Gtk_Table is a container that can contain any number of children. 
  27. --  Each of them is attached to a specific row and a specific column in 
  28. --  widget. 
  29. --  Every row in the table must have the same height, and every column must 
  30. --  have the same width if the table was said as Homogeneous. But you can 
  31. --  also decide to have an heterogeneous table, where the width and height 
  32. --  are set by the children contained in the table. 
  33. --  Check out the Gtk_Sheet widget for a different kind of table that can 
  34. --  also contain text and images in a more efficient way. 
  35. --  </description> 
  36. --  <c_version>2.8.17</c_version> 
  37. --  <group>Layout containers</group> 
  38.  
  39. with Glib.Properties; 
  40. with Gtk.Container; 
  41. with Gtk.Enums; 
  42. with Gtk.Widget; 
  43.  
  44. package Gtk.Table is 
  45.  
  46.    use Gtk.Enums; 
  47.  
  48.    type Gtk_Table_Record is new 
  49.      Gtk.Container.Gtk_Container_Record with private; 
  50.    type Gtk_Table is access all Gtk_Table_Record'Class; 
  51.  
  52.    procedure Gtk_New 
  53.      (Widget      : out Gtk_Table; 
  54.       Rows        : Guint; 
  55.       Columns     : Guint; 
  56.       Homogeneous : Boolean); 
  57.    --  Create a new table. 
  58.    --  The width allocated to the table is divided into Columns columns, which 
  59.    --  all have the same width if Homogeneous is True. If Homogeneous is False, 
  60.    --  the width will be calculated with the children contained in the table. 
  61.    --  Same behavior for the rows. 
  62.  
  63.    procedure Initialize 
  64.      (Widget      : access Gtk_Table_Record'Class; 
  65.       Rows        : Guint; 
  66.       Columns     : Guint; 
  67.       Homogeneous : Boolean); 
  68.    --  Internal initialization function. 
  69.    --  See the section "Creating your own widgets" in the documentation. 
  70.  
  71.    function Get_Type return Gtk.Gtk_Type; 
  72.    --  Return the internal value associated with a Gtk_Table. 
  73.  
  74.    procedure Resize 
  75.      (Table       : access Gtk_Table_Record; 
  76.       Rows        : Guint; 
  77.       Columns     : Guint); 
  78.    --  Modify the number of rows and columns in the table. 
  79.  
  80.    procedure Attach 
  81.      (Table         : access Gtk_Table_Record; 
  82.       Child         : access Gtk.Widget.Gtk_Widget_Record'Class; 
  83.       Left_Attach   : Guint; 
  84.       Right_Attach  : Guint; 
  85.       Top_Attach    : Guint; 
  86.       Bottom_Attach : Guint; 
  87.       Xoptions      : Gtk_Attach_Options := Expand or Fill; 
  88.       Yoptions      : Gtk_Attach_Options := Expand or Fill; 
  89.       Xpadding      : Guint := 0; 
  90.       Ypadding      : Guint := 0); 
  91.    --  Insert a new widget in the table. 
  92.    --  All the attachments are relative to the separations between columns and 
  93.    --  rows (for instance, to insert a widget spanning the first two columns 
  94.    --  in the table, you should put Left_Attach=0 and Right_Attach=2). 
  95.    --  Same behavior for the rows. 
  96.    --  Xoptions and Yoptions indicate the behavior of the child when the table 
  97.    --  is resized (whether the child can shrink or expand). See the description 
  98.    --  in Gtk.Box for more information on the possible values. 
  99.    --  Xpadding and Ypadding are the amount of space left around the child. 
  100.  
  101.    procedure Attach_Defaults 
  102.      (Table         : access Gtk_Table_Record; 
  103.       Widget        : access Gtk.Widget.Gtk_Widget_Record'Class; 
  104.       Left_Attach   : Guint; 
  105.       Right_Attach  : Guint; 
  106.       Top_Attach    : Guint; 
  107.       Bottom_Attach : Guint); 
  108.    --  Insert a new widget in the table, with default values. 
  109.    --  No padding is put around the child, and the options are set to 
  110.    --  Expand and Fill. 
  111.    --  This call is similar to Attach with default values and is only provided 
  112.    --  for compatibility. 
  113.  
  114.    procedure Set_Row_Spacing 
  115.      (Table   : access Gtk_Table_Record; 
  116.       Row     : Guint; 
  117.       Spacing : Guint); 
  118.    --  Set the spacing insert between Row and the next one. 
  119.    --  Spacing is in pixels. 
  120.  
  121.    procedure Set_Col_Spacing 
  122.      (Table   : access Gtk_Table_Record; 
  123.       Column  : Guint; 
  124.       Spacing : Guint); 
  125.    --  Set the spacing in pixels between Column and the next one. 
  126.  
  127.    procedure Set_Row_Spacings 
  128.      (Table : access Gtk_Table_Record; Spacing : Guint); 
  129.    --  Set the spacing for all the rows. 
  130.  
  131.    procedure Set_Col_Spacings 
  132.      (Table : access Gtk_Table_Record; Spacing : Guint); 
  133.    --  Set the spacing for all the columns. 
  134.  
  135.    procedure Set_Homogeneous 
  136.      (Table : access Gtk_Table_Record; Homogeneous : Boolean); 
  137.    --  Indicate the homogeneous status of the table. 
  138.    --  If Homogeneous is True, the rows and columns of the table will all 
  139.    --  be allocated the same width or height. 
  140.  
  141.    function Get_Row_Spacing 
  142.      (Table : access Gtk_Table_Record; 
  143.       Row   : Guint) return Guint; 
  144.    --  Return the spacing in pixels between Row and the next one. 
  145.  
  146.    function Get_Col_Spacing 
  147.      (Table  : access Gtk_Table_Record; 
  148.       Column : Guint) return Guint; 
  149.    --  Return the spacing in pixels between Column and the next one. 
  150.  
  151.    function Get_Default_Row_Spacing 
  152.      (Table : access Gtk_Table_Record) return Guint; 
  153.    --  Return the default spacing for the rows. 
  154.  
  155.    function Get_Default_Col_Spacing 
  156.      (Table : access Gtk_Table_Record) return Guint; 
  157.    --  Return the default spacing for the columns. 
  158.  
  159.    function Get_Homogeneous 
  160.      (Table : access Gtk_Table_Record) return Boolean; 
  161.    --  Return the homogeneous status of the table. 
  162.    --  See Set_Homogeneous for more details. 
  163.  
  164.    ---------------- 
  165.    -- Properties -- 
  166.    ---------------- 
  167.    --  The following properties are defined for this widget. See 
  168.    --  Glib.Properties for more information on properties. 
  169.  
  170.    --  <properties> 
  171.    --  - Name:  N_Rows_Property 
  172.    --    Type:  Guint 
  173.    --    Flags: read-write 
  174.    --    Descr: The number of rows in the table 
  175.    --    See also: Resize 
  176.    -- 
  177.    --  - Name:  N_Columns_Property 
  178.    --    Type:  Guint 
  179.    --    Flags: read-write 
  180.    --    Descr: The number of columns in the table 
  181.    --    See also: Resize 
  182.    -- 
  183.    --  - Name:  Row_Spacing_Property 
  184.    --    Type:  Guint 
  185.    --    Flags: read-write 
  186.    --    Descr: The amount of space between two consecutive rows 
  187.    --    See also: Set_Row_Spacing 
  188.    -- 
  189.    --  - Name:  Column_Spacing_Property 
  190.    --    Type:  Guint 
  191.    --    Flags: read-write 
  192.    --    Descr: The amount of space between two consecutive columns 
  193.    --    See also: Set_Row_Spacing 
  194.    -- 
  195.    --  - Name:  Homogeneous_Property 
  196.    --    Type:  Boolean 
  197.    --    Flags: read-write 
  198.    --    Descr: If TRUE this means the table cells are all the same 
  199.    --           width/height 
  200.    --    See also: Set_Homogeneous 
  201.    --  </properties> 
  202.  
  203.    N_Rows_Property         : constant Glib.Properties.Property_Uint; 
  204.    N_Columns_Property      : constant Glib.Properties.Property_Uint; 
  205.    Row_Spacing_Property    : constant Glib.Properties.Property_Uint; 
  206.    Column_Spacing_Property : constant Glib.Properties.Property_Uint; 
  207.    Homogeneous_Property    : constant Glib.Properties.Property_Boolean; 
  208.  
  209.    ---------------------- 
  210.    -- Child Properties -- 
  211.    ---------------------- 
  212.    --  The following properties can be set on children of this widget. See 
  213.    --  in particular Gtk.Containers.Child_Set_Property. 
  214.  
  215.    --  <child_properties> 
  216.    --  Name:  Bottom_Attach_Property 
  217.    --  Type:  Uint 
  218.    --  Descr: The row number to attach the bottom of the child to 
  219.    -- 
  220.    --  Name:  Left_Attach_Property 
  221.    --  Type:  Uint 
  222.    --  Descr: The column number to attach the left side of the child to 
  223.    -- 
  224.    --  Name:  Right_Attach_Property 
  225.    --  Type:  Uint 
  226.    --  Descr: The column number to attach the right side of a child widget to 
  227.    -- 
  228.    --  Name:  Top_Attach_Property 
  229.    --  Type:  Uint 
  230.    --  Descr: The row number to attach the top of a child widget to 
  231.    -- 
  232.    --  Name:  X_Options_Property 
  233.    --  Type:  Flags 
  234.    --  Descr: Options specifying the horizontal behaviour of the child 
  235.    -- 
  236.    --  Name:  X_Padding_Property 
  237.    --  Type:  Uint 
  238.    --  Descr: Extra space to put between the child and its left and right 
  239.    --         neighbors, in pixels 
  240.    -- 
  241.    --  Name:  Y_Options_Property 
  242.    --  Type:  Flags 
  243.    --  Descr: Options specifying the vertical behaviour of the child 
  244.    -- 
  245.    --  Name:  Y_Padding_Property 
  246.    --  Type:  Uint 
  247.    --  Descr: Extra space to put between the child and its upper and lower 
  248.    --         neighbors, in pixels 
  249.    --  </child_properties> 
  250.  
  251.    Bottom_Attach_Property : constant Glib.Properties.Property_Uint; 
  252.    Left_Attach_Property   : constant Glib.Properties.Property_Uint; 
  253.    Right_Attach_Property  : constant Glib.Properties.Property_Uint; 
  254.    Top_Attach_Property    : constant Glib.Properties.Property_Uint; 
  255.    --  X_Options_Property     : constant Glib.Properties.Property_Flags; 
  256.    X_Padding_Property     : constant Glib.Properties.Property_Uint; 
  257.    --  Y_Options_Property     : constant Glib.Properties.Property_Flags; 
  258.    Y_Padding_Property     : constant Glib.Properties.Property_Uint; 
  259.  
  260.    ------------- 
  261.    -- Signals -- 
  262.    ------------- 
  263.  
  264.    --  <signals> 
  265.    --  The following new signals are defined for this widget: 
  266.    --  </signals> 
  267.  
  268. private 
  269.    type Gtk_Table_Record is new Gtk.Container.Gtk_Container_Record 
  270.      with null record; 
  271.  
  272.    N_Rows_Property         : constant Glib.Properties.Property_Uint := 
  273.      Glib.Properties.Build ("n-rows"); 
  274.    N_Columns_Property      : constant Glib.Properties.Property_Uint := 
  275.      Glib.Properties.Build ("n-columns"); 
  276.    Row_Spacing_Property    : constant Glib.Properties.Property_Uint := 
  277.      Glib.Properties.Build ("row-spacing"); 
  278.    Column_Spacing_Property : constant Glib.Properties.Property_Uint := 
  279.      Glib.Properties.Build ("column-spacing"); 
  280.    Homogeneous_Property    : constant Glib.Properties.Property_Boolean := 
  281.      Glib.Properties.Build ("homogeneous"); 
  282.  
  283.    Bottom_Attach_Property : constant Glib.Properties.Property_Uint := 
  284.      Glib.Properties.Build ("bottom-attach"); 
  285.    Left_Attach_Property : constant Glib.Properties.Property_Uint := 
  286.      Glib.Properties.Build ("left-attach"); 
  287.    Right_Attach_Property : constant Glib.Properties.Property_Uint := 
  288.      Glib.Properties.Build ("right-attach"); 
  289.    Top_Attach_Property : constant Glib.Properties.Property_Uint := 
  290.      Glib.Properties.Build ("top-attach"); 
  291. --     X_Options_Property : constant Glib.Properties.Property_Flags := 
  292. --       Glib.Properties.Build ("x-options"); 
  293.    X_Padding_Property : constant Glib.Properties.Property_Uint := 
  294.      Glib.Properties.Build ("x-padding"); 
  295. --     Y_Options_Property : constant Glib.Properties.Property_Flags := 
  296. --       Glib.Properties.Build ("y-options"); 
  297.    Y_Padding_Property : constant Glib.Properties.Property_Uint := 
  298.      Glib.Properties.Build ("y-padding"); 
  299.  
  300.    pragma Import (C, Get_Type, "gtk_table_get_type"); 
  301. end Gtk.Table;