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. --  This interface provides a convenient way of associating widgets with 
  26. --  actions on a Gtk.Application_Window.Gtk_Application_Window or 
  27. --  Gtk.Application.Gtk_Application. 
  28. -- 
  29. --  It primarily consists of two properties: 
  30. --  Gtk.Actionable.Gtk_Actionable:action-name and 
  31. --  Gtk.Actionable.Gtk_Actionable:action-target. There are also some 
  32. --  convenience APIs for setting these properties. 
  33. -- 
  34. --  This interface is presently only meaningful if used on a widget that is 
  35. --  (or will be) located inside of a 
  36. --  Gtk.Application_Window.Gtk_Application_Window and can only be used to 
  37. --  associate the widget with actions on that window, or its associated 
  38. --  Gtk.Application.Gtk_Application. 
  39. -- 
  40. --  </description> 
  41. pragma Ada_2005; 
  42.  
  43. pragma Warnings (Off, "*is already use-visible*"); 
  44. with Glib;            use Glib; 
  45. with Glib.Properties; use Glib.Properties; 
  46. with Glib.Types;      use Glib.Types; 
  47. with Glib.Variant;    use Glib.Variant; 
  48.  
  49. package Gtk.Actionable is 
  50.  
  51.    type Gtk_Actionable is new Glib.Types.GType_Interface; 
  52.    Null_Gtk_Actionable : constant Gtk_Actionable; 
  53.  
  54.    ------------------ 
  55.    -- Constructors -- 
  56.    ------------------ 
  57.  
  58.    function Get_Type return Glib.GType; 
  59.    pragma Import (C, Get_Type, "gtk_actionable_get_type"); 
  60.  
  61.    ------------- 
  62.    -- Methods -- 
  63.    ------------- 
  64.  
  65.    function Get_Action_Name (Self : Gtk_Actionable) return UTF8_String; 
  66.    --  Gets the action name for Actionable. 
  67.    --  See Gtk.Actionable.Set_Action_Name for more information. 
  68.    --  Since: gtk+ 3.4 
  69.  
  70.    procedure Set_Action_Name 
  71.       (Self        : Gtk_Actionable; 
  72.        Action_Name : UTF8_String); 
  73.    --  Specifies the name of the action with which this widget should be 
  74.    --  associated. If Action_Name is null then the widget will be unassociated 
  75.    --  from any previous action. 
  76.    --  Usually this function is used when the widget is located (or will be 
  77.    --  located) within the hierarchy of a 
  78.    --  Gtk.Application_Window.Gtk_Application_Window. 
  79.    --  Names are of the form "win.save" or "app.quit" for actions on the 
  80.    --  containing Gtk.Application_Window.Gtk_Application_Window or its 
  81.    --  associated Gtk.Application.Gtk_Application, respectively. This is the 
  82.    --  same form used for actions in the Glib.Menu.Gmenu associated with the 
  83.    --  window. 
  84.    --  Since: gtk+ 3.4 
  85.    --  "action_name": an action name, or null 
  86.  
  87.    function Get_Action_Target_Value 
  88.       (Self : Gtk_Actionable) return Glib.Variant.Gvariant; 
  89.    --  Gets the current target value of Actionabe. 
  90.    --  See Gtk.Actionable.Set_Action_Target_Value for more information. 
  91.    --  Since: gtk+ 3.4 
  92.  
  93.    procedure Set_Action_Target_Value 
  94.       (Self         : Gtk_Actionable; 
  95.        Target_Value : Glib.Variant.Gvariant); 
  96.    --  Sets the target value of an actionable widget. 
  97.    --  If Target_Value is null then the target value is unset. 
  98.    --  The target value has two purposes. First, it is used as the parameter 
  99.    --  to activation of the action associated with the 
  100.    --  Gtk.Actionable.Gtk_Actionable widget. Second, it is used to determine if 
  101.    --  the widget should be rendered as "active" - the widget is active if the 
  102.    --  state is equal to the given target. 
  103.    --  Consider the example of associating a set of buttons with a 
  104.    --  Glib.Action.Gaction with string state in a typical "radio button" 
  105.    --  situation. Each button will be associated with the same action, but with 
  106.    --  a different target value for that action. Clicking on a particular 
  107.    --  button will activate the action with the target of that button, which 
  108.    --  will typically cause the action's state to change to that value. Since 
  109.    --  the action's state is now equal to the target value of the button, the 
  110.    --  button will now be rendered as active (and the other buttons, with 
  111.    --  different targets, rendered inactive). 
  112.    --  Since: gtk+ 3.4 
  113.    --  "target_value": a Glib.Variant.Gvariant to set as the target value, or 
  114.    --  null 
  115.  
  116.    procedure Set_Detailed_Action_Name 
  117.       (Self                 : Gtk_Actionable; 
  118.        Detailed_Action_Name : UTF8_String); 
  119.    --  Sets the action-name and associated string target value of an 
  120.    --  actionable widget. 
  121.    --  This allows for the effect of both Gtk.Actionable.Set_Action_Name and 
  122.    --  Gtk.Actionable.Set_Action_Target_Value in the common case that the 
  123.    --  target is string-valued. 
  124.    --  Detailed_Action_Name is a string of the form '"action::target"' where 
  125.    --  'action' is the action name and 'target' is the string to use as the 
  126.    --  target. 
  127.    --  Since: gtk+ 3.4 
  128.    --  "detailed_action_name": the detailed action name 
  129.  
  130.    ---------------- 
  131.    -- Properties -- 
  132.    ---------------- 
  133.    --  The following properties are defined for this widget. See 
  134.    --  Glib.Properties for more information on properties) 
  135.  
  136.    Action_Name_Property : constant Glib.Properties.Property_String; 
  137.  
  138.    Action_Target_Property : constant Glib.Properties.Property_Object; 
  139.    --  Type: Glib.Variant.Gvariant 
  140.  
  141.    ---------------- 
  142.    -- Interfaces -- 
  143.    ---------------- 
  144.    --  This class implements several interfaces. See Glib.Types 
  145.    -- 
  146.    --  - "Gtk_Actionable" 
  147.  
  148.    function "+" (W : Gtk_Actionable) return Gtk_Actionable; 
  149.    pragma Inline ("+"); 
  150.  
  151. private 
  152.    Action_Target_Property : constant Glib.Properties.Property_Object := 
  153.      Glib.Properties.Build ("action-target"); 
  154.    Action_Name_Property : constant Glib.Properties.Property_String := 
  155.      Glib.Properties.Build ("action-name"); 
  156.  
  157. Null_Gtk_Actionable : constant Gtk_Actionable := 
  158.    Gtk_Actionable (Glib.Types.Null_Interface); 
  159. end Gtk.Actionable;