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-2007 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. --  A Gtk_Check_Menu_Item is a menu item that maintains the state of a boolean 
  32. --  value in addition to a Gtk_Menu_Item's usual role in activating application 
  33. --  code. 
  34. -- 
  35. --  A check box indicating the state of the boolean value is displayed at the 
  36. --  left side of the Gtk_Menu_Item. Activating the Gtk_Menu_Item toggles the 
  37. --  value. 
  38. --  </description> 
  39. --  <c_version>2.8.17</c_version> 
  40. --  <group>Menus and Toolbars</group> 
  41.  
  42. with Glib.Properties; 
  43. with Gtk.Menu_Item; 
  44.  
  45. package Gtk.Check_Menu_Item is 
  46.  
  47.    type Gtk_Check_Menu_Item_Record is new 
  48.      Gtk.Menu_Item.Gtk_Menu_Item_Record with private; 
  49.    type Gtk_Check_Menu_Item is access all Gtk_Check_Menu_Item_Record'Class; 
  50.  
  51.    procedure Gtk_New 
  52.      (Check_Menu_Item : out Gtk_Check_Menu_Item; 
  53.       Label           : UTF8_String := ""); 
  54.    procedure Initialize 
  55.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record'Class; 
  56.       Label           : UTF8_String := ""); 
  57.    --  Creates or initializes a new Gtk_Check_Menu_Item with a label, if label 
  58.    --  isn't null. 
  59.  
  60.    procedure Gtk_New_With_Mnemonic 
  61.      (Check_Menu_Item : out Gtk_Check_Menu_Item; 
  62.       Label           : UTF8_String); 
  63.    procedure Initialize_With_Mnemonic 
  64.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record'Class; 
  65.       Label           : UTF8_String); 
  66.    --  Creates or initializes a new Gtk_Check_Menu_Item containing a label. The 
  67.    --  label will be created will be created using Gtk.Label.New_With_Mnemonic, 
  68.    --  so underscores in the label indicate the mnemonic for the menu item. 
  69.  
  70.    function Get_Type return Gtk.Gtk_Type; 
  71.    --  Return the internal value associated with a Gtk_Calendar. 
  72.  
  73.    procedure Set_Active 
  74.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record; 
  75.       Is_Active       : Boolean); 
  76.    function Get_Active 
  77.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record) return Boolean; 
  78.    --  Set the active state of the menu item's check box. 
  79.  
  80.    procedure Set_Inconsistent 
  81.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record; 
  82.       Setting         : Boolean); 
  83.    function Get_Inconsistent 
  84.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record) return Boolean; 
  85.    --  If the user has selected a range of elements (such as some text or 
  86.    --  spreadsheet cells) that are affected by a boolean setting, and the 
  87.    --  current values in that range are inconsistent, you may want to 
  88.    --  display the check in an "in between" state. This function turns on 
  89.    --  "in between" display.  Normally you would turn off the inconsistent 
  90.    --  state again if the user explicitly selects a setting. This has to be 
  91.    --  done manually, Set_Inconsistent only affects visual appearance, it 
  92.    --  doesn't affect the semantics of the widget. 
  93.  
  94.    procedure Set_Draw_As_Radio 
  95.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record; 
  96.       Draw_As_Radio   : Boolean); 
  97.    function Get_Draw_As_Radio 
  98.      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record) return Boolean; 
  99.    --  Sets whether Check_Menu_Item is drawn like a Radio_Menu_Item. 
  100.  
  101.    procedure Toggled (Check_Menu_Item : access Gtk_Check_Menu_Item_Record); 
  102.    --  Emit the "toggled" signal. 
  103.  
  104.    ---------------- 
  105.    -- Properties -- 
  106.    ---------------- 
  107.  
  108.    --  <properties> 
  109.    --  The following properties are defined for this widget. See 
  110.    --  Glib.Properties for more information on properties. 
  111.    -- 
  112.    --  Name:  Active_Property 
  113.    --  Type:  Boolean 
  114.    --  Flags: read-write 
  115.    --  Descr: Whether the menu item is checked. 
  116.    --  See also:  Set_Active and Get_Active 
  117.    -- 
  118.    --  Name:  Inconsistent_Property 
  119.    --  Type:  Boolean 
  120.    --  Flags: read-write 
  121.    --  Descr: Whether to display an "inconsistent" state. 
  122.    --  See also:  Set_Inconsistent and Get_Inconsistent 
  123.    -- 
  124.    --  Name:  Draw_As_Radio_Property 
  125.    --  Type:  Boolean 
  126.    --  Descr: Whether the menu item looks like a radio menu item 
  127.    -- 
  128.    --  </properties> 
  129.  
  130.    Active_Property        : constant Glib.Properties.Property_Boolean; 
  131.    Inconsistent_Property  : constant Glib.Properties.Property_Boolean; 
  132.    Draw_As_Radio_Property : constant Glib.Properties.Property_Boolean; 
  133.  
  134.    ------------- 
  135.    -- Signals -- 
  136.    ------------- 
  137.  
  138.    --  <signals> 
  139.    --  The following new signals are defined for this widget: 
  140.    --  - "toggled" 
  141.    --    procedure Handler 
  142.    --      (Check_Menu_Item : access Gtk_Check_Menu_Item_Record'Class); 
  143.    -- 
  144.    --  Emitted when the state of the check box is changed. 
  145.    --  A signal handler can call Get_Active to discover the new state. 
  146.    --  </signals> 
  147.  
  148.    Signal_Toggled : constant Glib.Signal_Name := "toggled"; 
  149.  
  150. private 
  151.    type Gtk_Check_Menu_Item_Record is new Gtk.Menu_Item.Gtk_Menu_Item_Record 
  152.      with null record; 
  153.  
  154.    Active_Property : constant Glib.Properties.Property_Boolean := 
  155.      Glib.Properties.Build ("active"); 
  156.    Inconsistent_Property : constant Glib.Properties.Property_Boolean := 
  157.      Glib.Properties.Build ("inconsistent"); 
  158.    Draw_As_Radio_Property : constant Glib.Properties.Property_Boolean := 
  159.      Glib.Properties.Build ("draw-as-radio"); 
  160.  
  161.    pragma Import (C, Get_Type, "gtk_check_menu_item_get_type"); 
  162. end Gtk.Check_Menu_Item; 
  163.  
  164. --  The following subprogram never had a binding, and is now obsolescent 
  165. --  No binding: gtk_check_menu_item_set_show_toggle