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