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