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. --  A Gtk.Tool_Item_Group.Gtk_Tool_Item_Group is used together with 
  26. --  Gtk.Tool_Palette.Gtk_Tool_Palette to add Gtk.Tool_Item.Gtk_Tool_Item<!-- 
  27. --  -->s to a palette like container with different categories and drag and 
  28. --  drop support. 
  29. -- 
  30. --  </description> 
  31. pragma Ada_2005; 
  32.  
  33. pragma Warnings (Off, "*is already use-visible*"); 
  34. with Glib;            use Glib; 
  35. with Glib.Properties; use Glib.Properties; 
  36. with Glib.Types;      use Glib.Types; 
  37. with Gtk.Buildable;   use Gtk.Buildable; 
  38. with Gtk.Container;   use Gtk.Container; 
  39. with Gtk.Enums;       use Gtk.Enums; 
  40. with Gtk.Size_Group;  use Gtk.Size_Group; 
  41. with Gtk.Tool_Item;   use Gtk.Tool_Item; 
  42. with Gtk.Tool_Shell;  use Gtk.Tool_Shell; 
  43. with Gtk.Widget;      use Gtk.Widget; 
  44. with Pango.Layout;    use Pango.Layout; 
  45.  
  46. package Gtk.Tool_Item_Group is 
  47.  
  48.    type Gtk_Tool_Item_Group_Record is new Gtk_Container_Record with null record; 
  49.    type Gtk_Tool_Item_Group is access all Gtk_Tool_Item_Group_Record'Class; 
  50.  
  51.    ------------------ 
  52.    -- Constructors -- 
  53.    ------------------ 
  54.  
  55.    procedure Gtk_New (Self : out Gtk_Tool_Item_Group; Label : UTF8_String); 
  56.    procedure Initialize 
  57.       (Self  : not null access Gtk_Tool_Item_Group_Record'Class; 
  58.        Label : UTF8_String); 
  59.    --  Creates a new tool item group with label Label. 
  60.    --  Since: gtk+ 2.20 
  61.    --  "label": the label of the new group 
  62.  
  63.    function Gtk_Tool_Item_Group_New 
  64.       (Label : UTF8_String) return Gtk_Tool_Item_Group; 
  65.    --  Creates a new tool item group with label Label. 
  66.    --  Since: gtk+ 2.20 
  67.    --  "label": the label of the new group 
  68.  
  69.    function Get_Type return Glib.GType; 
  70.    pragma Import (C, Get_Type, "gtk_tool_item_group_get_type"); 
  71.  
  72.    ------------- 
  73.    -- Methods -- 
  74.    ------------- 
  75.  
  76.    function Get_Collapsed 
  77.       (Self : not null access Gtk_Tool_Item_Group_Record) return Boolean; 
  78.    --  Gets whether Group is collapsed or expanded. 
  79.    --  Since: gtk+ 2.20 
  80.  
  81.    procedure Set_Collapsed 
  82.       (Self      : not null access Gtk_Tool_Item_Group_Record; 
  83.        Collapsed : Boolean); 
  84.    --  Sets whether the Group should be collapsed or expanded. 
  85.    --  Since: gtk+ 2.20 
  86.    --  "collapsed": whether the Group should be collapsed or expanded 
  87.  
  88.    function Get_Drop_Item 
  89.       (Self : not null access Gtk_Tool_Item_Group_Record; 
  90.        X    : Gint; 
  91.        Y    : Gint) return Gtk.Tool_Item.Gtk_Tool_Item; 
  92.    --  Gets the tool item at position (x, y). 
  93.    --  Since: gtk+ 2.20 
  94.    --  "x": the x position 
  95.    --  "y": the y position 
  96.  
  97.    function Get_Ellipsize 
  98.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  99.        return Pango.Layout.Pango_Ellipsize_Mode; 
  100.    --  Gets the ellipsization mode of Group. 
  101.    --  Since: gtk+ 2.20 
  102.  
  103.    procedure Set_Ellipsize 
  104.       (Self      : not null access Gtk_Tool_Item_Group_Record; 
  105.        Ellipsize : Pango.Layout.Pango_Ellipsize_Mode); 
  106.    --  Sets the ellipsization mode which should be used by labels in Group. 
  107.    --  Since: gtk+ 2.20 
  108.    --  "ellipsize": the Pango.Layout.Pango_Ellipsize_Mode labels in Group 
  109.    --  should use 
  110.  
  111.    function Get_Header_Relief 
  112.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  113.        return Gtk.Enums.Gtk_Relief_Style; 
  114.    --  Gets the relief mode of the header button of Group. 
  115.    --  Since: gtk+ 2.20 
  116.  
  117.    procedure Set_Header_Relief 
  118.       (Self  : not null access Gtk_Tool_Item_Group_Record; 
  119.        Style : Gtk.Enums.Gtk_Relief_Style); 
  120.    --  Set the button relief of the group header. See Gtk.Button.Set_Relief 
  121.    --  for details. 
  122.    --  Since: gtk+ 2.20 
  123.    --  "style": the Gtk.Enums.Gtk_Relief_Style 
  124.  
  125.    function Get_Item_Position 
  126.       (Self : not null access Gtk_Tool_Item_Group_Record; 
  127.        Item : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class) 
  128.        return Gint; 
  129.    --  Gets the position of Item in Group as index. 
  130.    --  Since: gtk+ 2.20 
  131.    --  "item": a Gtk.Tool_Item.Gtk_Tool_Item 
  132.  
  133.    procedure Set_Item_Position 
  134.       (Self     : not null access Gtk_Tool_Item_Group_Record; 
  135.        Item     : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class; 
  136.        Position : Gint); 
  137.    --  Sets the position of Item in the list of children of Group. 
  138.    --  Since: gtk+ 2.20 
  139.    --  "item": the Gtk.Tool_Item.Gtk_Tool_Item to move to a new position, 
  140.    --  should be a child of Group. 
  141.    --  "position": the new position of Item in Group, starting with 0. The 
  142.    --  position -1 means end of list. 
  143.  
  144.    function Get_Label 
  145.       (Self : not null access Gtk_Tool_Item_Group_Record) return UTF8_String; 
  146.    --  Gets the label of Group. 
  147.    --  Since: gtk+ 2.20 
  148.  
  149.    procedure Set_Label 
  150.       (Self  : not null access Gtk_Tool_Item_Group_Record; 
  151.        Label : UTF8_String); 
  152.    --  Sets the label of the tool item group. The label is displayed in the 
  153.    --  header of the group. 
  154.    --  Since: gtk+ 2.20 
  155.    --  "label": the new human-readable label of of the group 
  156.  
  157.    function Get_Label_Widget 
  158.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  159.        return Gtk.Widget.Gtk_Widget; 
  160.    --  Gets the label widget of Group. See 
  161.    --  Gtk.Tool_Item_Group.Set_Label_Widget. 
  162.    --  Since: gtk+ 2.20 
  163.  
  164.    procedure Set_Label_Widget 
  165.       (Self         : not null access Gtk_Tool_Item_Group_Record; 
  166.        Label_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  167.    --  Sets the label of the tool item group. The label widget is displayed in 
  168.    --  the header of the group, in place of the usual label. 
  169.    --  Since: gtk+ 2.20 
  170.    --  "label_widget": the widget to be displayed in place of the usual label 
  171.  
  172.    function Get_N_Items 
  173.       (Self : not null access Gtk_Tool_Item_Group_Record) return Guint; 
  174.    --  Gets the number of tool items in Group. 
  175.    --  Since: gtk+ 2.20 
  176.  
  177.    function Get_Nth_Item 
  178.       (Self  : not null access Gtk_Tool_Item_Group_Record; 
  179.        Index : Guint) return Gtk.Tool_Item.Gtk_Tool_Item; 
  180.    --  Gets the tool item at Index in group. 
  181.    --  Since: gtk+ 2.20 
  182.    --  "index": the index 
  183.  
  184.    procedure Insert 
  185.       (Self     : not null access Gtk_Tool_Item_Group_Record; 
  186.        Item     : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class; 
  187.        Position : Gint); 
  188.    --  Inserts Item at Position in the list of children of Group. 
  189.    --  Since: gtk+ 2.20 
  190.    --  "item": the Gtk.Tool_Item.Gtk_Tool_Item to insert into Group 
  191.    --  "position": the position of Item in Group, starting with 0. The 
  192.    --  position -1 means end of list. 
  193.  
  194.    --------------------------------------------- 
  195.    -- Inherited subprograms (from interfaces) -- 
  196.    --------------------------------------------- 
  197.    --  Methods inherited from the Buildable interface are not duplicated here 
  198.    --  since they are meant to be used by tools, mostly. If you need to call 
  199.    --  them, use an explicit cast through the "-" operator below. 
  200.  
  201.    function Get_Ellipsize_Mode 
  202.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  203.        return Pango.Layout.Pango_Ellipsize_Mode; 
  204.  
  205.    function Get_Icon_Size 
  206.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  207.        return Gtk.Enums.Gtk_Icon_Size; 
  208.  
  209.    function Get_Orientation 
  210.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  211.        return Gtk.Enums.Gtk_Orientation; 
  212.  
  213.    function Get_Relief_Style 
  214.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  215.        return Gtk.Enums.Gtk_Relief_Style; 
  216.  
  217.    function Get_Style 
  218.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  219.        return Gtk.Enums.Gtk_Toolbar_Style; 
  220.  
  221.    function Get_Text_Alignment 
  222.       (Self : not null access Gtk_Tool_Item_Group_Record) return Gfloat; 
  223.  
  224.    function Get_Text_Orientation 
  225.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  226.        return Gtk.Enums.Gtk_Orientation; 
  227.  
  228.    function Get_Text_Size_Group 
  229.       (Self : not null access Gtk_Tool_Item_Group_Record) 
  230.        return Gtk.Size_Group.Gtk_Size_Group; 
  231.  
  232.    procedure Rebuild_Menu 
  233.       (Self : not null access Gtk_Tool_Item_Group_Record); 
  234.  
  235.    ---------------- 
  236.    -- Properties -- 
  237.    ---------------- 
  238.    --  The following properties are defined for this widget. See 
  239.    --  Glib.Properties for more information on properties) 
  240.  
  241.    Collapsed_Property : constant Glib.Properties.Property_Boolean; 
  242.  
  243.    Ellipsize_Property : constant Pango.Layout.Property_Pango_Ellipsize_Mode; 
  244.    --  Type: Pango.Layout.Pango_Ellipsize_Mode 
  245.  
  246.    Header_Relief_Property : constant Gtk.Enums.Property_Gtk_Relief_Style; 
  247.  
  248.    Label_Property : constant Glib.Properties.Property_String; 
  249.  
  250.    Label_Widget_Property : constant Glib.Properties.Property_Object; 
  251.    --  Type: Gtk.Widget.Gtk_Widget 
  252.  
  253.    ---------------- 
  254.    -- Interfaces -- 
  255.    ---------------- 
  256.    --  This class implements several interfaces. See Glib.Types 
  257.    -- 
  258.    --  - "Buildable" 
  259.    -- 
  260.    --  - "ToolShell" 
  261.  
  262.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  263.      (Gtk.Buildable.Gtk_Buildable, Gtk_Tool_Item_Group_Record, Gtk_Tool_Item_Group); 
  264.    function "+" 
  265.      (Widget : access Gtk_Tool_Item_Group_Record'Class) 
  266.    return Gtk.Buildable.Gtk_Buildable 
  267.    renames Implements_Gtk_Buildable.To_Interface; 
  268.    function "-" 
  269.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  270.    return Gtk_Tool_Item_Group 
  271.    renames Implements_Gtk_Buildable.To_Object; 
  272.  
  273.    package Implements_Gtk_Tool_Shell is new Glib.Types.Implements 
  274.      (Gtk.Tool_Shell.Gtk_Tool_Shell, Gtk_Tool_Item_Group_Record, Gtk_Tool_Item_Group); 
  275.    function "+" 
  276.      (Widget : access Gtk_Tool_Item_Group_Record'Class) 
  277.    return Gtk.Tool_Shell.Gtk_Tool_Shell 
  278.    renames Implements_Gtk_Tool_Shell.To_Interface; 
  279.    function "-" 
  280.      (Interf : Gtk.Tool_Shell.Gtk_Tool_Shell) 
  281.    return Gtk_Tool_Item_Group 
  282.    renames Implements_Gtk_Tool_Shell.To_Object; 
  283.  
  284. private 
  285.    Label_Widget_Property : constant Glib.Properties.Property_Object := 
  286.      Glib.Properties.Build ("label-widget"); 
  287.    Label_Property : constant Glib.Properties.Property_String := 
  288.      Glib.Properties.Build ("label"); 
  289.    Header_Relief_Property : constant Gtk.Enums.Property_Gtk_Relief_Style := 
  290.      Gtk.Enums.Build ("header-relief"); 
  291.    Ellipsize_Property : constant Pango.Layout.Property_Pango_Ellipsize_Mode := 
  292.      Pango.Layout.Build ("ellipsize"); 
  293.    Collapsed_Property : constant Glib.Properties.Property_Boolean := 
  294.      Glib.Properties.Build ("collapsed"); 
  295. end Gtk.Tool_Item_Group;