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. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  A Gtk_Radio_Action is similar to Gtk_Radio_Menu_Item. A number of radio 
  31. --  actions can be linked together so that only one may be active at any one 
  32. --  time. 
  33. --  </description> 
  34. --  <c_version>2.16.6</c_version> 
  35. --  <group>Action-based menus</group> 
  36. --  <see>Gtk_Action</see> 
  37.  
  38. with Glib.Properties; 
  39. with Gtk.Toggle_Action; 
  40. with Gtk.Widget; 
  41.  
  42. package Gtk.Radio_Action is 
  43.  
  44.    type Gtk_Radio_Action_Record is 
  45.      new Gtk.Toggle_Action.Gtk_Toggle_Action_Record with null record; 
  46.    type Gtk_Radio_Action is access all Gtk_Radio_Action_Record'Class; 
  47.  
  48.    procedure Gtk_New 
  49.      (Action   : out Gtk_Radio_Action; 
  50.       Name     : String; 
  51.       Label    : String := ""; 
  52.       Tooltip  : String := ""; 
  53.       Stock_Id : String := ""; 
  54.       Value    : Gint); 
  55.    procedure Initialize 
  56.      (Action   : access Gtk_Radio_Action_Record'Class; 
  57.       Name     : String; 
  58.       Label    : String := ""; 
  59.       Tooltip  : String := ""; 
  60.       Stock_Id : String := ""; 
  61.       Value    : Gint); 
  62.    --  Creates a new Gtk_Radio_Action object. To add the action to 
  63.    --  a Gtk_Action_Group and set the accelerator for the action, 
  64.    --  call Gtk.Action_Group.Add_Action_With_Accel. 
  65.  
  66.    function Get_Type return GType; 
  67.    --  Return the internal type used for a Gtk_Radio_Action 
  68.  
  69.    procedure Set_Current_Value 
  70.      (Action        : access Gtk_Radio_Action_Record; 
  71.       Current_Value : Gint); 
  72.    function Get_Current_Value 
  73.      (Action : access Gtk_Radio_Action_Record) return Glib.Gint; 
  74.    --  Sets/Gets the value property of the currently active member of 
  75.    --  the group to which Action belongs. 
  76.  
  77.    procedure Set_Group 
  78.      (Action : access Gtk_Radio_Action_Record; 
  79.       Group  : Gtk.Widget.Widget_SList.GSlist); 
  80.    function Get_Group 
  81.      (Action : access Gtk_Radio_Action_Record) 
  82.      return Gtk.Widget.Widget_SList.GSlist; 
  83.    --  Returns the list representing the radio group for this object. 
  84.    --  Note that the returned list is only valid until the next change 
  85.    --  to the group. 
  86.    -- 
  87.    --  A common way to set up a group of radio group is the following: 
  88.    --      Group  : GSlist := null; 
  89.    --      Action : Gtk_Radio_Action; 
  90.    --      while ... loop 
  91.    --          Gtk_New (Action, ...); 
  92.    --          Set_Group (Action, Group); 
  93.    --          Group := Get_Group (Action); 
  94.    --      end loop; 
  95.  
  96.    ---------------- 
  97.    -- Properties -- 
  98.    ---------------- 
  99.  
  100.    --  <properties> 
  101.    --  The following properties are defined for this widget. See 
  102.    --  Glib.Properties for more information on properties. 
  103.    -- 
  104.    --  Name:  Current_Value_Property 
  105.    --  Type:  Int 
  106.    --  Descr: The value property of the currently active member of the group 
  107.    --         to which this action belongs. 
  108.    -- 
  109.    --  Name:  Group_Property 
  110.    --  Type:  Object 
  111.    --  Descr: The radio action whose group this action belongs to. 
  112.    -- 
  113.    --  Name:  Value_Property 
  114.    --  Type:  Int 
  115.    --  Descr: The value returned by Gtk.Radio_Action.Get_Current_Value when 
  116.    --         this action is the current action of its group. 
  117.    --  </properties> 
  118.  
  119.    Current_Value_Property : constant Glib.Properties.Property_Int; 
  120.    Group_Property         : constant Glib.Properties.Property_Object; 
  121.    Value_Property         : constant Glib.Properties.Property_Int; 
  122.  
  123.    ------------- 
  124.    -- Signals -- 
  125.    ------------- 
  126.  
  127.    --  <signals> 
  128.    --  The following new signals are defined for this widget: 
  129.    -- 
  130.    --  - "changed" 
  131.    --    procedure Handler 
  132.    --       (Action  : access Gtk_Radio_Action_Record'Class; 
  133.    --        Current : access Gtk_Radio_Action_Record'Class); 
  134.    --    The changed signal is emitted on every member of a radio group when 
  135.    --    the active member is changed. The signal gets emitted after the 
  136.    --    activate signals for the previous and current active members. 
  137.    --    Current is the action that is currently active 
  138.    --  </signals> 
  139.  
  140.    Signal_Changed : constant Glib.Signal_Name := "changed"; 
  141.  
  142. private 
  143.    Current_Value_Property : constant Glib.Properties.Property_Int := 
  144.      Glib.Properties.Build ("current-value"); 
  145.    Group_Property : constant Glib.Properties.Property_Object := 
  146.      Glib.Properties.Build ("group"); 
  147.    Value_Property : constant Glib.Properties.Property_Int := 
  148.      Glib.Properties.Build ("value"); 
  149.  
  150.    pragma Import (C, Get_Type, "gtk_radio_action_get_type"); 
  151. end Gtk.Radio_Action; 
  152.  
  153.