1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2001-2007 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. --  Gtk_Cell_Renderer_Toggle renders a toggle button in a cell. The button is 
  26. --  drawn as a radio- or checkbutton, depending on the radio property. When 
  27. --  activated, it emits the toggled signal. 
  28. --  </description> 
  29. --  <c_version>2.8.17</c_version> 
  30. --  <group>Trees and Lists</group> 
  31.  
  32. with Glib.Properties; 
  33. with Gtk; 
  34. with Gtk.Cell_Renderer; 
  35.  
  36. package Gtk.Cell_Renderer_Toggle is 
  37.  
  38.    type Gtk_Cell_Renderer_Toggle_Record is 
  39.      new Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record with private; 
  40.    type Gtk_Cell_Renderer_Toggle is 
  41.      access all Gtk_Cell_Renderer_Toggle_Record'Class; 
  42.  
  43.    procedure Gtk_New (Widget : out Gtk_Cell_Renderer_Toggle); 
  44.    procedure Initialize 
  45.      (Widget : access Gtk_Cell_Renderer_Toggle_Record'Class); 
  46.    --  Creates or initializes a new renderer. 
  47.  
  48.    function Get_Type return Gtk.Gtk_Type; 
  49.    --  Return the internal value associated with this widget. 
  50.  
  51.    procedure Set_Radio 
  52.      (Toggle : access Gtk_Cell_Renderer_Toggle_Record; 
  53.       Radio  : Boolean); 
  54.    function Get_Radio 
  55.      (Toggle : access Gtk_Cell_Renderer_Toggle_Record) return Boolean; 
  56.    --  If Setting is True, the cell renderer renders a radio toggle 
  57.    --  (i.e. a toggle in a group of mutually-exclusive toggles). 
  58.    --  If False, it renders a check toggle (a standalone boolean option). 
  59.    -- 
  60.    --  Note that this only affects the visual display, but your application is 
  61.    --  still responsible for enforcing the behavior, through the toggled 
  62.    --  signal. 
  63.  
  64.    procedure Set_Active 
  65.      (Toggle  : access Gtk_Cell_Renderer_Toggle_Record; 
  66.       Setting : Boolean); 
  67.    function Get_Active 
  68.      (Toggle : access Gtk_Cell_Renderer_Toggle_Record) return Boolean; 
  69.    --  Whether the renderer is currently selected 
  70.  
  71.    ------------- 
  72.    -- Signals -- 
  73.    ------------- 
  74.  
  75.    --  <signals> 
  76.    --  The following new signals are defined for this widget: 
  77.    -- 
  78.    --  - "toggled" 
  79.    --    procedure Handler 
  80.    --     (Widget : access Gtk_Cell_Renderer_Toggle_Record'Class; 
  81.    --       Path : UTF8_String); 
  82.    -- 
  83.    --  </signals> 
  84.  
  85.    Signal_Toggled : constant Glib.Signal_Name := "toggled"; 
  86.  
  87.    ---------------- 
  88.    -- Properties -- 
  89.    ---------------- 
  90.  
  91.    --  The following properties are defined for this cell_renderer. 
  92.    --  <properties> 
  93.    -- 
  94.    --  Name:  Activatable_Property 
  95.    --  Type:  Boolean 
  96.    --  Descr: The toggle button can be activated 
  97.    -- 
  98.    --  Name:  Active_Property 
  99.    --  Type:  Boolean 
  100.    --  Descr: The toggle state of the button 
  101.    -- 
  102.    --  Name:  Inconsistent_Property 
  103.    --  Type:  Boolean 
  104.    --  Descr: The inconsistent state of the button 
  105.    -- 
  106.    --  Name: Indicator_Size_Property 
  107.    --  Type: Gint 
  108.    -- 
  109.    --  Name:  Radio_Property 
  110.    --  Type:  Boolean 
  111.    --  Descr: Draw the toggle button as a radio button 
  112.    -- 
  113.    --  </properties> 
  114.  
  115.    Activatable_Property    : constant Glib.Properties.Property_Boolean; 
  116.    Active_Property         : constant Glib.Properties.Property_Boolean; 
  117.    Inconsistent_Property   : constant Glib.Properties.Property_Boolean; 
  118.    Indicator_Size_Property : constant Glib.Properties.Property_Int; 
  119.    Radio_Property          : constant Glib.Properties.Property_Boolean; 
  120.  
  121. private 
  122.    type Gtk_Cell_Renderer_Toggle_Record is 
  123.      new Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record with null record; 
  124.  
  125.    Activatable_Property : constant Glib.Properties.Property_Boolean := 
  126.      Glib.Properties.Build ("activatable"); 
  127.    Active_Property : constant Glib.Properties.Property_Boolean := 
  128.      Glib.Properties.Build ("active"); 
  129.    Inconsistent_Property : constant Glib.Properties.Property_Boolean := 
  130.      Glib.Properties.Build ("inconsistent"); 
  131.    Indicator_Size_Property : constant Glib.Properties.Property_Int := 
  132.      Glib.Properties.Build ("indicator-size"); 
  133.    Radio_Property : constant Glib.Properties.Property_Boolean := 
  134.      Glib.Properties.Build ("radio"); 
  135.  
  136.    pragma Import (C, Get_Type, "gtk_cell_renderer_toggle_get_type"); 
  137. end Gtk.Cell_Renderer_Toggle;