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. --  Glib.Simple_Action_Group.Gsimple_Action_Group is a hash table filled with 
  26. --  Glib.Action.Gaction objects, implementing the 
  27. --  Glib.Action_Group.Gaction_Group and Glib.Action_Map.Gaction_Map interfaces. 
  28. -- 
  29. --  </description> 
  30. pragma Ada_2005; 
  31.  
  32. pragma Warnings (Off, "*is already use-visible*"); 
  33. with GNAT.Strings;      use GNAT.Strings; 
  34. with Glib;              use Glib; 
  35. with Glib.Action;       use Glib.Action; 
  36. with Glib.Action_Group; use Glib.Action_Group; 
  37. with Glib.Action_Map;   use Glib.Action_Map; 
  38. with Glib.Object;       use Glib.Object; 
  39. with Glib.Types;        use Glib.Types; 
  40. with Glib.Variant;      use Glib.Variant; 
  41.  
  42. package Glib.Simple_Action_Group is 
  43.  
  44.    type Gsimple_Action_Group_Record is new GObject_Record with null record; 
  45.    type Gsimple_Action_Group is access all Gsimple_Action_Group_Record'Class; 
  46.  
  47.    ------------------ 
  48.    -- Constructors -- 
  49.    ------------------ 
  50.  
  51.    procedure G_New (Self : out Gsimple_Action_Group); 
  52.    --  Creates a new, empty, Glib.Simple_Action_Group.Gsimple_Action_Group. 
  53.    --  Since: gtk+ 2.28 
  54.  
  55.    procedure Initialize 
  56.       (Self : not null access Gsimple_Action_Group_Record'Class); 
  57.    --  Creates a new, empty, Glib.Simple_Action_Group.Gsimple_Action_Group. 
  58.    --  Since: gtk+ 2.28 
  59.  
  60.    function Gsimple_Action_Group_New return Gsimple_Action_Group; 
  61.    --  Creates a new, empty, Glib.Simple_Action_Group.Gsimple_Action_Group. 
  62.    --  Since: gtk+ 2.28 
  63.  
  64.    function Get_Type return Glib.GType; 
  65.    pragma Import (C, Get_Type, "g_simple_action_group_get_type"); 
  66.  
  67.    ------------- 
  68.    -- Methods -- 
  69.    ------------- 
  70.  
  71.    procedure Add_Entries 
  72.       (Self      : not null access Gsimple_Action_Group_Record; 
  73.        Entries   : Glib.Action_Map.GAction_Entry_Array; 
  74.        User_Data : System.Address := System.Null_Address); 
  75.    --  A convenience function for creating multiple 
  76.    --  Glib.Simple_Action.Gsimple_Action instances and adding them to the 
  77.    --  action group. 
  78.    --  Since: gtk+ 2.30 
  79.    --  "entries": a pointer to the first item in an array of 
  80.    --  Glib.Action_Map.GAction_Entry structs 
  81.    --  "user_data": the user data for signal connections 
  82.  
  83.    procedure Insert 
  84.       (Self   : not null access Gsimple_Action_Group_Record; 
  85.        Action : Glib.Action.Gaction); 
  86.    --  Adds an action to the action group. 
  87.    --  If the action group already contains an action with the same name as 
  88.    --  Action then the old action is dropped from the group. 
  89.    --  The action group takes its own reference on Action. 
  90.    --  Since: gtk+ 2.28 
  91.    --  "action": a Glib.Action.Gaction 
  92.  
  93.    function Lookup 
  94.       (Self        : not null access Gsimple_Action_Group_Record; 
  95.        Action_Name : UTF8_String) return Glib.Action.Gaction; 
  96.    --  Looks up the action with the name Action_Name in the group. 
  97.    --  If no such action exists, returns null. 
  98.    --  Since: gtk+ 2.28 
  99.    --  "action_name": the name of an action 
  100.  
  101.    procedure Remove 
  102.       (Self        : not null access Gsimple_Action_Group_Record; 
  103.        Action_Name : UTF8_String); 
  104.    --  Removes the named action from the action group. 
  105.    --  If no action of this name is in the group then nothing happens. 
  106.    --  Since: gtk+ 2.28 
  107.    --  "action_name": the name of the action 
  108.  
  109.    --------------------------------------------- 
  110.    -- Inherited subprograms (from interfaces) -- 
  111.    --------------------------------------------- 
  112.  
  113.    procedure Action_Added 
  114.       (Self        : not null access Gsimple_Action_Group_Record; 
  115.        Action_Name : UTF8_String); 
  116.  
  117.    procedure Action_Enabled_Changed 
  118.       (Self        : not null access Gsimple_Action_Group_Record; 
  119.        Action_Name : UTF8_String; 
  120.        Enabled     : Boolean); 
  121.  
  122.    procedure Action_Removed 
  123.       (Self        : not null access Gsimple_Action_Group_Record; 
  124.        Action_Name : UTF8_String); 
  125.  
  126.    procedure Action_State_Changed 
  127.       (Self        : not null access Gsimple_Action_Group_Record; 
  128.        Action_Name : UTF8_String; 
  129.        State       : Glib.Variant.Gvariant); 
  130.  
  131.    procedure Activate_Action 
  132.       (Self        : not null access Gsimple_Action_Group_Record; 
  133.        Action_Name : UTF8_String; 
  134.        Parameter   : Glib.Variant.Gvariant); 
  135.  
  136.    procedure Change_Action_State 
  137.       (Self        : not null access Gsimple_Action_Group_Record; 
  138.        Action_Name : UTF8_String; 
  139.        Value       : Glib.Variant.Gvariant); 
  140.  
  141.    function Get_Action_Enabled 
  142.       (Self        : not null access Gsimple_Action_Group_Record; 
  143.        Action_Name : UTF8_String) return Boolean; 
  144.  
  145.    function Get_Action_Parameter_Type 
  146.       (Self        : not null access Gsimple_Action_Group_Record; 
  147.        Action_Name : UTF8_String) return Glib.Variant.Gvariant_Type; 
  148.  
  149.    function Get_Action_State 
  150.       (Self        : not null access Gsimple_Action_Group_Record; 
  151.        Action_Name : UTF8_String) return Glib.Variant.Gvariant; 
  152.  
  153.    function Get_Action_State_Hint 
  154.       (Self        : not null access Gsimple_Action_Group_Record; 
  155.        Action_Name : UTF8_String) return Glib.Variant.Gvariant; 
  156.  
  157.    function Get_Action_State_Type 
  158.       (Self        : not null access Gsimple_Action_Group_Record; 
  159.        Action_Name : UTF8_String) return Glib.Variant.Gvariant_Type; 
  160.  
  161.    function Has_Action 
  162.       (Self        : not null access Gsimple_Action_Group_Record; 
  163.        Action_Name : UTF8_String) return Boolean; 
  164.  
  165.    function List_Actions 
  166.       (Self : not null access Gsimple_Action_Group_Record) 
  167.        return GNAT.Strings.String_List; 
  168.  
  169.    function Query_Action 
  170.       (Self           : not null access Gsimple_Action_Group_Record; 
  171.        Action_Name    : UTF8_String; 
  172.        Enabled        : access Boolean; 
  173.        Parameter_Type : access Glib.Variant.Gvariant_Type; 
  174.        State_Type     : access Glib.Variant.Gvariant_Type; 
  175.        State_Hint     : access Glib.Variant.Gvariant; 
  176.        State          : access Glib.Variant.Gvariant) return Boolean; 
  177.  
  178.    procedure Add_Action 
  179.       (Self   : not null access Gsimple_Action_Group_Record; 
  180.        Action : Glib.Action.Gaction); 
  181.  
  182.    procedure Add_Action_Entries 
  183.       (Self      : not null access Gsimple_Action_Group_Record; 
  184.        Entries   : GAction_Entry_Array; 
  185.        User_Data : System.Address := System.Null_Address); 
  186.  
  187.    function Lookup_Action 
  188.       (Self        : not null access Gsimple_Action_Group_Record; 
  189.        Action_Name : UTF8_String) return Glib.Action.Gaction; 
  190.  
  191.    procedure Remove_Action 
  192.       (Self        : not null access Gsimple_Action_Group_Record; 
  193.        Action_Name : UTF8_String); 
  194.  
  195.    ---------------- 
  196.    -- Interfaces -- 
  197.    ---------------- 
  198.    --  This class implements several interfaces. See Glib.Types 
  199.    -- 
  200.    --  - "ActionGroup" 
  201.    -- 
  202.    --  - "ActionMap" 
  203.  
  204.    package Implements_Gaction_Group is new Glib.Types.Implements 
  205.      (Glib.Action_Group.Gaction_Group, Gsimple_Action_Group_Record, Gsimple_Action_Group); 
  206.    function "+" 
  207.      (Widget : access Gsimple_Action_Group_Record'Class) 
  208.    return Glib.Action_Group.Gaction_Group 
  209.    renames Implements_Gaction_Group.To_Interface; 
  210.    function "-" 
  211.      (Interf : Glib.Action_Group.Gaction_Group) 
  212.    return Gsimple_Action_Group 
  213.    renames Implements_Gaction_Group.To_Object; 
  214.  
  215.    package Implements_Gaction_Map is new Glib.Types.Implements 
  216.      (Glib.Action_Map.Gaction_Map, Gsimple_Action_Group_Record, Gsimple_Action_Group); 
  217.    function "+" 
  218.      (Widget : access Gsimple_Action_Group_Record'Class) 
  219.    return Glib.Action_Map.Gaction_Map 
  220.    renames Implements_Gaction_Map.To_Interface; 
  221.    function "-" 
  222.      (Interf : Glib.Action_Map.Gaction_Map) 
  223.    return Gsimple_Action_Group 
  224.    renames Implements_Gaction_Map.To_Object; 
  225.  
  226. end Glib.Simple_Action_Group;