1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2010 AdaCore                    -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  A Gtk_Radio_Action is similar to Gtk_Radio_Menu_Item. A number of radio 
  26. --  actions can be linked together so that only one may be active at any one 
  27. --  time. 
  28. --  </description> 
  29. --  <c_version>2.16.6</c_version> 
  30. --  <group>Action-based menus</group> 
  31. --  <see>Gtk_Action</see> 
  32.  
  33. with Glib.Properties; 
  34. with Gtk.Toggle_Action; 
  35. with Gtk.Widget; 
  36.  
  37. package Gtk.Radio_Action is 
  38.  
  39.    type Gtk_Radio_Action_Record is 
  40.      new Gtk.Toggle_Action.Gtk_Toggle_Action_Record with null record; 
  41.    type Gtk_Radio_Action is access all Gtk_Radio_Action_Record'Class; 
  42.  
  43.    procedure Gtk_New 
  44.      (Action   : out Gtk_Radio_Action; 
  45.       Name     : String; 
  46.       Label    : String := ""; 
  47.       Tooltip  : String := ""; 
  48.       Stock_Id : String := ""; 
  49.       Value    : Gint); 
  50.    procedure Initialize 
  51.      (Action   : access Gtk_Radio_Action_Record'Class; 
  52.       Name     : String; 
  53.       Label    : String := ""; 
  54.       Tooltip  : String := ""; 
  55.       Stock_Id : String := ""; 
  56.       Value    : Gint); 
  57.    --  Creates a new Gtk_Radio_Action object. To add the action to 
  58.    --  a Gtk_Action_Group and set the accelerator for the action, 
  59.    --  call Gtk.Action_Group.Add_Action_With_Accel. 
  60.  
  61.    function Get_Type return GType; 
  62.    --  Return the internal type used for a Gtk_Radio_Action 
  63.  
  64.    procedure Set_Current_Value 
  65.      (Action        : access Gtk_Radio_Action_Record; 
  66.       Current_Value : Gint); 
  67.    function Get_Current_Value 
  68.      (Action : access Gtk_Radio_Action_Record) return Glib.Gint; 
  69.    --  Sets/Gets the value property of the currently active member of 
  70.    --  the group to which Action belongs. 
  71.  
  72.    procedure Set_Group 
  73.      (Action : access Gtk_Radio_Action_Record; 
  74.       Group  : Gtk.Widget.Widget_SList.GSlist); 
  75.    function Get_Group 
  76.      (Action : access Gtk_Radio_Action_Record) 
  77.      return Gtk.Widget.Widget_SList.GSlist; 
  78.    --  Returns the list representing the radio group for this object. 
  79.    --  Note that the returned list is only valid until the next change 
  80.    --  to the group. 
  81.    -- 
  82.    --  A common way to set up a group of radio group is the following: 
  83.    --      Group  : GSlist := null; 
  84.    --      Action : Gtk_Radio_Action; 
  85.    --      while ... loop 
  86.    --          Gtk_New (Action, ...); 
  87.    --          Set_Group (Action, Group); 
  88.    --          Group := Get_Group (Action); 
  89.    --      end loop; 
  90.  
  91.    ---------------- 
  92.    -- Properties -- 
  93.    ---------------- 
  94.  
  95.    --  <properties> 
  96.    --  The following properties are defined for this widget. See 
  97.    --  Glib.Properties for more information on properties. 
  98.    -- 
  99.    --  Name:  Current_Value_Property 
  100.    --  Type:  Int 
  101.    --  Descr: The value property of the currently active member of the group 
  102.    --         to which this action belongs. 
  103.    -- 
  104.    --  Name:  Group_Property 
  105.    --  Type:  Object 
  106.    --  Descr: The radio action whose group this action belongs to. 
  107.    -- 
  108.    --  Name:  Value_Property 
  109.    --  Type:  Int 
  110.    --  Descr: The value returned by Gtk.Radio_Action.Get_Current_Value when 
  111.    --         this action is the current action of its group. 
  112.    --  </properties> 
  113.  
  114.    Current_Value_Property : constant Glib.Properties.Property_Int; 
  115.    Group_Property         : constant Glib.Properties.Property_Object; 
  116.    Value_Property         : constant Glib.Properties.Property_Int; 
  117.  
  118.    ------------- 
  119.    -- Signals -- 
  120.    ------------- 
  121.  
  122.    --  <signals> 
  123.    --  The following new signals are defined for this widget: 
  124.    -- 
  125.    --  - "changed" 
  126.    --    procedure Handler 
  127.    --       (Action  : access Gtk_Radio_Action_Record'Class; 
  128.    --        Current : access Gtk_Radio_Action_Record'Class); 
  129.    --    The changed signal is emitted on every member of a radio group when 
  130.    --    the active member is changed. The signal gets emitted after the 
  131.    --    activate signals for the previous and current active members. 
  132.    --    Current is the action that is currently active 
  133.    --  </signals> 
  134.  
  135.    Signal_Changed : constant Glib.Signal_Name := "changed"; 
  136.  
  137. private 
  138.    Current_Value_Property : constant Glib.Properties.Property_Int := 
  139.      Glib.Properties.Build ("current-value"); 
  140.    Group_Property : constant Glib.Properties.Property_Object := 
  141.      Glib.Properties.Build ("group"); 
  142.    Value_Property : constant Glib.Properties.Property_Int := 
  143.      Glib.Properties.Build ("value"); 
  144.  
  145.    pragma Import (C, Get_Type, "gtk_radio_action_get_type"); 
  146. end Gtk.Radio_Action; 
  147.  
  148.