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