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-2013, 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. --  Activatable widgets can be connected to a Gtk_Action and reflects the 
  32. --  state of its action. A Gtk_Activatable can also provide feedback through 
  33. --  its action, as they are responsible for activating their related actions. 
  34. -- 
  35. --  </description> 
  36.  
  37. pragma Warnings (Off, "*is already use-visible*"); 
  38. with Glib;            use Glib; 
  39. with Glib.Properties; use Glib.Properties; 
  40. with Glib.Types;      use Glib.Types; 
  41. with Gtk.Action;      use Gtk.Action; 
  42.  
  43. package Gtk.Activatable is 
  44.  
  45.    type Gtk_Activatable is new Glib.Types.GType_Interface; 
  46.  
  47.    ------------------ 
  48.    -- Constructors -- 
  49.    ------------------ 
  50.  
  51.    function Get_Type return Glib.GType; 
  52.    pragma Import (C, Get_Type, "gtk_activatable_get_type"); 
  53.  
  54.    ------------- 
  55.    -- Methods -- 
  56.    ------------- 
  57.  
  58.    procedure Do_Set_Related_Action 
  59.       (Self   : Gtk_Activatable; 
  60.        Action : access Gtk.Action.Gtk_Action_Record'Class); 
  61.    --  This is a utility function for Gtk.Activatable.Gtk_Activatable 
  62.    --  implementors. When implementing Gtk.Activatable.Gtk_Activatable you must 
  63.    --  call this when handling changes of the 
  64.    --  Gtk.Activatable.Gtk_Activatable:related-action, and you must also use 
  65.    --  this to break references in GObject->dispose. This function adds a 
  66.    --  reference to the currently set related action for you, it also makes 
  67.    --  sure the Gtk.Activatable.Gtk_Activatable->update method is called when 
  68.    --  the related Gtk.Action.Gtk_Action properties change and registers to the 
  69.    --  action's proxy list. 
  70.    --  Note: Be careful to call this before setting the local copy of the 
  71.    --  Gtk.Action.Gtk_Action property, since this function uses 
  72.    --  Gtk.Activatable.Get_Action to retrieve the previous action 
  73.    --  Since: gtk+ 2.16 
  74.    --  "action": the Gtk.Action.Gtk_Action to set 
  75.  
  76.    function Get_Related_Action 
  77.       (Self : Gtk_Activatable) return Gtk.Action.Gtk_Action; 
  78.    procedure Set_Related_Action 
  79.       (Self   : Gtk_Activatable; 
  80.        Action : access Gtk.Action.Gtk_Action_Record'Class); 
  81.    --  Sets the related action on the Activatable object. 
  82.    --  Note: Gtk.Activatable.Gtk_Activatable implementors need to handle the 
  83.    --  Gtk.Activatable.Gtk_Activatable:related-action property and call 
  84.    --  Gtk.Toggle_Button.Do_Set_Related_Action when it changes. 
  85.    --  Since: gtk+ 2.16 
  86.    --  "action": the Gtk.Action.Gtk_Action to set 
  87.  
  88.    function Get_Use_Action_Appearance 
  89.       (Self : Gtk_Activatable) return Boolean; 
  90.    procedure Set_Use_Action_Appearance 
  91.       (Self           : Gtk_Activatable; 
  92.        Use_Appearance : Boolean); 
  93.    --  Sets whether this activatable should reset its layout and appearance 
  94.    --  when setting the related action or when the action changes appearance 
  95.    --  Note: Gtk.Activatable.Gtk_Activatable implementors need to handle the 
  96.    --  Gtk.Activatable.Gtk_Activatable:use-action-appearance property and call 
  97.    --  Gtk.Toggle_Button.Sync_Action_Properties to update Activatable if 
  98.    --  needed. 
  99.    --  Since: gtk+ 2.16 
  100.    --  "use_appearance": whether to use the actions appearance 
  101.  
  102.    procedure Sync_Action_Properties 
  103.       (Self   : Gtk_Activatable; 
  104.        Action : access Gtk.Action.Gtk_Action_Record'Class); 
  105.    --  This is called to update the activatable completely, this is called 
  106.    --  internally when the Gtk.Activatable.Gtk_Activatable::related-action 
  107.    --  property is set or unset and by the implementing class when 
  108.    --  Gtk.Activatable.Gtk_Activatable::use-action-appearance changes. 
  109.    --  Since: gtk+ 2.16 
  110.    --  "action": the related Gtk.Action.Gtk_Action or null 
  111.  
  112.    ---------------- 
  113.    -- Properties -- 
  114.    ---------------- 
  115.    --  The following properties are defined for this widget. See 
  116.    --  Glib.Properties for more information on properties) 
  117.    -- 
  118.    --  Name: Related_Action_Property 
  119.    --  Type: Gtk.Action.Gtk_Action 
  120.    --  Flags: read-write 
  121.    --  The action that this activatable will activate and receive updates from 
  122.    --  for various states and possibly appearance. 
  123.    --  Note: Gtk.Activatable.Gtk_Activatable implementors need to handle the 
  124.    --  this property and call Gtk.Activatable.Do_Set_Related_Action when it 
  125.    --  changes. 
  126.    -- 
  127.    --  Name: Use_Action_Appearance_Property 
  128.    --  Type: Boolean 
  129.    --  Flags: read-write 
  130.    --  Whether this activatable should reset its layout and appearance when 
  131.    --  setting the related action or when the action changes appearance. See 
  132.    --  the Gtk.Action.Gtk_Action documentation directly to find which 
  133.    --  properties should be ignored by the Gtk.Activatable.Gtk_Activatable when 
  134.    --  this property is False. 
  135.    --  Note: Gtk.Activatable.Gtk_Activatable implementors need to handle this 
  136.    --  property and call Gtk.Activatable.Sync_Action_Properties on the 
  137.    --  activatable widget when it changes. 
  138.  
  139.    Related_Action_Property : constant Glib.Properties.Property_Object; 
  140.    Use_Action_Appearance_Property : constant Glib.Properties.Property_Boolean; 
  141.  
  142. private 
  143.    Related_Action_Property : constant Glib.Properties.Property_Object := 
  144.      Glib.Properties.Build ("related-action"); 
  145.    Use_Action_Appearance_Property : constant Glib.Properties.Property_Boolean := 
  146.      Glib.Properties.Build ("use-action-appearance"); 
  147. end Gtk.Activatable;