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