1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  The Gtk.Cell_Area_Box.Gtk_Cell_Area_Box renders cell renderers into a row 
  26. --  or a column depending on its Gtk.Enums.Gtk_Orientation. 
  27. -- 
  28. --  GtkCellAreaBox uses a notion of *packing*. Packing refers to adding cell 
  29. --  renderers with reference to a particular position in a 
  30. --  Gtk.Cell_Area_Box.Gtk_Cell_Area_Box. There are two reference positions: the 
  31. --  *start* and the *end* of the box. When the 
  32. --  Gtk.Cell_Area_Box.Gtk_Cell_Area_Box is oriented in the 
  33. --  Gtk.Enums.Orientation_Vertical orientation, the start is defined as the top 
  34. --  of the box and the end is defined as the bottom. In the 
  35. --  Gtk.Enums.Orientation_Horizontal orientation start is defined as the left 
  36. --  side and the end is defined as the right side. 
  37. -- 
  38. --  Alignments of Gtk_Cell_Renderers rendered in adjacent rows can be 
  39. --  configured by configuring the Gtk.Cell_Area_Box.Gtk_Cell_Area_Box:align 
  40. --  child cell property with Gtk.Cell_Area.Cell_Set_Property or by specifying 
  41. --  the "align" argument to Gtk.Cell_Area_Box.Pack_Start and 
  42. --  Gtk.Cell_Area_Box.Pack_End. 
  43. -- 
  44. --  </description> 
  45. pragma Ada_2005; 
  46.  
  47. pragma Warnings (Off, "*is already use-visible*"); 
  48. with Glib;              use Glib; 
  49. with Glib.Object;       use Glib.Object; 
  50. with Glib.Properties;   use Glib.Properties; 
  51. with Glib.Types;        use Glib.Types; 
  52. with Gtk.Buildable;     use Gtk.Buildable; 
  53. with Gtk.Cell_Area;     use Gtk.Cell_Area; 
  54. with Gtk.Cell_Layout;   use Gtk.Cell_Layout; 
  55. with Gtk.Cell_Renderer; use Gtk.Cell_Renderer; 
  56. with Gtk.Enums;         use Gtk.Enums; 
  57. with Gtk.Orientable;    use Gtk.Orientable; 
  58. with Gtk.Tree_Model;    use Gtk.Tree_Model; 
  59.  
  60. package Gtk.Cell_Area_Box is 
  61.  
  62.    type Gtk_Cell_Area_Box_Record is new Gtk_Cell_Area_Record with null record; 
  63.    type Gtk_Cell_Area_Box is access all Gtk_Cell_Area_Box_Record'Class; 
  64.  
  65.    --------------- 
  66.    -- Callbacks -- 
  67.    --------------- 
  68.  
  69.    type Gtk_Cell_Layout_Data_Func is access procedure 
  70.      (Cell_Layout : Gtk.Cell_Layout.Gtk_Cell_Layout; 
  71.       Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  72.       Tree_Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  73.       Iter        : Gtk.Tree_Model.Gtk_Tree_Iter); 
  74.    --  A function which should set the value of Cell_Layout's cell renderer(s) 
  75.    --  as appropriate. 
  76.    --  "cell_layout": a Gtk.Cell_Layout.Gtk_Cell_Layout 
  77.    --  "cell": the cell renderer whose value is to be set 
  78.    --  "tree_model": the model 
  79.    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to set the 
  80.    --  value for 
  81.  
  82.    ------------------ 
  83.    -- Constructors -- 
  84.    ------------------ 
  85.  
  86.    procedure Gtk_New (Self : out Gtk_Cell_Area_Box); 
  87.    procedure Initialize 
  88.       (Self : not null access Gtk_Cell_Area_Box_Record'Class); 
  89.    --  Creates a new Gtk.Cell_Area_Box.Gtk_Cell_Area_Box. 
  90.    --  Since: gtk+ 3.0 
  91.  
  92.    function Gtk_Cell_Area_Box_New return Gtk_Cell_Area_Box; 
  93.    --  Creates a new Gtk.Cell_Area_Box.Gtk_Cell_Area_Box. 
  94.    --  Since: gtk+ 3.0 
  95.  
  96.    function Get_Type return Glib.GType; 
  97.    pragma Import (C, Get_Type, "gtk_cell_area_box_get_type"); 
  98.  
  99.    ------------- 
  100.    -- Methods -- 
  101.    ------------- 
  102.  
  103.    function Get_Spacing 
  104.       (Self : not null access Gtk_Cell_Area_Box_Record) return Gint; 
  105.    --  Gets the spacing added between cell renderers. 
  106.    --  Since: gtk+ 3.0 
  107.  
  108.    procedure Set_Spacing 
  109.       (Self    : not null access Gtk_Cell_Area_Box_Record; 
  110.        Spacing : Gint); 
  111.    --  Sets the spacing to add between cell renderers in Box. 
  112.    --  Since: gtk+ 3.0 
  113.    --  "spacing": the space to add between Gtk_Cell_Renderers 
  114.  
  115.    procedure Pack_End 
  116.       (Self     : not null access Gtk_Cell_Area_Box_Record; 
  117.        Renderer : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  118.        Expand   : Boolean; 
  119.        Align    : Boolean; 
  120.        Fixed    : Boolean); 
  121.    --  Adds Renderer to Box, packed with reference to the end of Box. 
  122.    --  The Renderer is packed after (away from end of) any other 
  123.    --  Gtk.Cell_Renderer.Gtk_Cell_Renderer packed with reference to the end of 
  124.    --  Box. 
  125.    --  Since: gtk+ 3.0 
  126.    --  "renderer": the Gtk.Cell_Renderer.Gtk_Cell_Renderer to add 
  127.    --  "expand": whether Renderer should receive extra space when the area 
  128.    --  receives more than its natural size 
  129.    --  "align": whether Renderer should be aligned in adjacent rows 
  130.    --  "fixed": whether Renderer should have the same size in all rows 
  131.  
  132.    procedure Pack_Start 
  133.       (Self     : not null access Gtk_Cell_Area_Box_Record; 
  134.        Renderer : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  135.        Expand   : Boolean; 
  136.        Align    : Boolean; 
  137.        Fixed    : Boolean); 
  138.    --  Adds Renderer to Box, packed with reference to the start of Box. 
  139.    --  The Renderer is packed after any other 
  140.    --  Gtk.Cell_Renderer.Gtk_Cell_Renderer packed with reference to the start 
  141.    --  of Box. 
  142.    --  Since: gtk+ 3.0 
  143.    --  "renderer": the Gtk.Cell_Renderer.Gtk_Cell_Renderer to add 
  144.    --  "expand": whether Renderer should receive extra space when the area 
  145.    --  receives more than its natural size 
  146.    --  "align": whether Renderer should be aligned in adjacent rows 
  147.    --  "fixed": whether Renderer should have the same size in all rows 
  148.  
  149.    procedure Set_Cell_Data_Func 
  150.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  151.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  152.        Func        : Gtk_Cell_Layout_Data_Func); 
  153.    --  Sets the Gtk_Cell_Layout_Data_Func to use for Cell_Layout. 
  154.    --  This function is used instead of the standard attributes mapping for 
  155.    --  setting the column value, and should set the value of Cell_Layout's cell 
  156.    --  renderer(s) as appropriate. 
  157.    --  Func may be null to remove a previously set function. 
  158.    --  Since: gtk+ 2.4 
  159.    --  "cell": a Gtk.Cell_Renderer.Gtk_Cell_Renderer 
  160.    --  "func": the Gtk_Cell_Layout_Data_Func to use, or null 
  161.  
  162.    generic 
  163.       type User_Data_Type (<>) is private; 
  164.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  165.    package Set_Cell_Data_Func_User_Data is 
  166.  
  167.       type Gtk_Cell_Layout_Data_Func is access procedure 
  168.         (Cell_Layout : Gtk.Cell_Layout.Gtk_Cell_Layout; 
  169.          Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  170.          Tree_Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  171.          Iter        : Gtk.Tree_Model.Gtk_Tree_Iter; 
  172.          Data        : User_Data_Type); 
  173.       --  A function which should set the value of Cell_Layout's cell renderer(s) 
  174.       --  as appropriate. 
  175.       --  "cell_layout": a Gtk.Cell_Layout.Gtk_Cell_Layout 
  176.       --  "cell": the cell renderer whose value is to be set 
  177.       --  "tree_model": the model 
  178.       --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to set the 
  179.       --  value for 
  180.       --  "data": user data passed to Gtk.Cell_Layout.Set_Cell_Data_Func 
  181.  
  182.       procedure Set_Cell_Data_Func 
  183.          (Cell_Layout : not null access Gtk.Cell_Area_Box.Gtk_Cell_Area_Box_Record'Class; 
  184.           Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  185.           Func        : Gtk_Cell_Layout_Data_Func; 
  186.           Func_Data   : User_Data_Type); 
  187.       --  Sets the Gtk_Cell_Layout_Data_Func to use for Cell_Layout. 
  188.       --  This function is used instead of the standard attributes mapping for 
  189.       --  setting the column value, and should set the value of Cell_Layout's 
  190.       --  cell renderer(s) as appropriate. 
  191.       --  Func may be null to remove a previously set function. 
  192.       --  Since: gtk+ 2.4 
  193.       --  "cell": a Gtk.Cell_Renderer.Gtk_Cell_Renderer 
  194.       --  "func": the Gtk_Cell_Layout_Data_Func to use, or null 
  195.       --  "func_data": user data for Func 
  196.  
  197.    end Set_Cell_Data_Func_User_Data; 
  198.  
  199.    --------------------------------------------- 
  200.    -- Inherited subprograms (from interfaces) -- 
  201.    --------------------------------------------- 
  202.    --  Methods inherited from the Buildable interface are not duplicated here 
  203.    --  since they are meant to be used by tools, mostly. If you need to call 
  204.    --  them, use an explicit cast through the "-" operator below. 
  205.  
  206.    procedure Add_Attribute 
  207.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  208.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  209.        Attribute   : UTF8_String; 
  210.        Column      : Gint); 
  211.  
  212.    procedure Clear (Cell_Layout : not null access Gtk_Cell_Area_Box_Record); 
  213.  
  214.    procedure Clear_Attributes 
  215.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  216.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class); 
  217.  
  218.    function Get_Cells 
  219.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record) 
  220.        return Glib.Object.Object_Simple_List.Glist; 
  221.  
  222.    procedure Pack_End 
  223.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  224.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  225.        Expand      : Boolean); 
  226.  
  227.    procedure Pack_Start 
  228.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  229.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  230.        Expand      : Boolean); 
  231.  
  232.    procedure Reorder 
  233.       (Cell_Layout : not null access Gtk_Cell_Area_Box_Record; 
  234.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  235.        Position    : Gint); 
  236.  
  237.    function Get_Orientation 
  238.       (Self : not null access Gtk_Cell_Area_Box_Record) 
  239.        return Gtk.Enums.Gtk_Orientation; 
  240.  
  241.    procedure Set_Orientation 
  242.       (Self        : not null access Gtk_Cell_Area_Box_Record; 
  243.        Orientation : Gtk.Enums.Gtk_Orientation); 
  244.  
  245.    ---------------- 
  246.    -- Properties -- 
  247.    ---------------- 
  248.    --  The following properties are defined for this widget. See 
  249.    --  Glib.Properties for more information on properties) 
  250.  
  251.    Spacing_Property : constant Glib.Properties.Property_Int; 
  252.    --  The amount of space to reserve between cells. 
  253.  
  254.    ---------------- 
  255.    -- Interfaces -- 
  256.    ---------------- 
  257.    --  This class implements several interfaces. See Glib.Types 
  258.    -- 
  259.    --  - "Buildable" 
  260.    -- 
  261.    --  - "CellLayout" 
  262.    -- 
  263.    --  - "Orientable" 
  264.  
  265.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  266.      (Gtk.Buildable.Gtk_Buildable, Gtk_Cell_Area_Box_Record, Gtk_Cell_Area_Box); 
  267.    function "+" 
  268.      (Widget : access Gtk_Cell_Area_Box_Record'Class) 
  269.    return Gtk.Buildable.Gtk_Buildable 
  270.    renames Implements_Gtk_Buildable.To_Interface; 
  271.    function "-" 
  272.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  273.    return Gtk_Cell_Area_Box 
  274.    renames Implements_Gtk_Buildable.To_Object; 
  275.  
  276.    package Implements_Gtk_Cell_Layout is new Glib.Types.Implements 
  277.      (Gtk.Cell_Layout.Gtk_Cell_Layout, Gtk_Cell_Area_Box_Record, Gtk_Cell_Area_Box); 
  278.    function "+" 
  279.      (Widget : access Gtk_Cell_Area_Box_Record'Class) 
  280.    return Gtk.Cell_Layout.Gtk_Cell_Layout 
  281.    renames Implements_Gtk_Cell_Layout.To_Interface; 
  282.    function "-" 
  283.      (Interf : Gtk.Cell_Layout.Gtk_Cell_Layout) 
  284.    return Gtk_Cell_Area_Box 
  285.    renames Implements_Gtk_Cell_Layout.To_Object; 
  286.  
  287.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  288.      (Gtk.Orientable.Gtk_Orientable, Gtk_Cell_Area_Box_Record, Gtk_Cell_Area_Box); 
  289.    function "+" 
  290.      (Widget : access Gtk_Cell_Area_Box_Record'Class) 
  291.    return Gtk.Orientable.Gtk_Orientable 
  292.    renames Implements_Gtk_Orientable.To_Interface; 
  293.    function "-" 
  294.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  295.    return Gtk_Cell_Area_Box 
  296.    renames Implements_Gtk_Orientable.To_Object; 
  297.  
  298. private 
  299.    Spacing_Property : constant Glib.Properties.Property_Int := 
  300.      Glib.Properties.Build ("spacing"); 
  301. end Gtk.Cell_Area_Box;