1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  Gtk.Cell_Renderer_Toggle.Gtk_Cell_Renderer_Toggle renders a toggle button 
  26. --  in a cell. The button is drawn as a radio or a checkbutton, depending on 
  27. --  the Gtk.Cell_Renderer_Toggle.Gtk_Cell_Renderer_Toggle:radio property. When 
  28. --  activated, it emits the 
  29. --  Gtk.Cell_Renderer_Toggle.Gtk_Cell_Renderer_Toggle::toggled signal. 
  30. -- 
  31. --  </description> 
  32. pragma Ada_2005; 
  33.  
  34. pragma Warnings (Off, "*is already use-visible*"); 
  35. with Glib;              use Glib; 
  36. with Glib.Object;       use Glib.Object; 
  37. with Glib.Properties;   use Glib.Properties; 
  38. with Gtk.Cell_Renderer; use Gtk.Cell_Renderer; 
  39.  
  40. package Gtk.Cell_Renderer_Toggle is 
  41.  
  42.    type Gtk_Cell_Renderer_Toggle_Record is new Gtk_Cell_Renderer_Record with null record; 
  43.    type Gtk_Cell_Renderer_Toggle is access all Gtk_Cell_Renderer_Toggle_Record'Class; 
  44.  
  45.    ------------------ 
  46.    -- Constructors -- 
  47.    ------------------ 
  48.  
  49.    procedure Gtk_New (Self : out Gtk_Cell_Renderer_Toggle); 
  50.    procedure Initialize 
  51.       (Self : not null access Gtk_Cell_Renderer_Toggle_Record'Class); 
  52.    --  Creates a new Gtk.Cell_Renderer_Toggle.Gtk_Cell_Renderer_Toggle. Adjust 
  53.    --  rendering parameters using object properties. Object properties can be 
  54.    --  set globally (with g_object_set). Also, with 
  55.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column, you can bind a property to a 
  56.    --  value in a Gtk.Tree_Model.Gtk_Tree_Model. For example, you can bind the 
  57.    --  "active" property on the cell renderer to a boolean value in the model, 
  58.    --  thus causing the check button to reflect the state of the model. 
  59.  
  60.    function Gtk_Cell_Renderer_Toggle_New return Gtk_Cell_Renderer_Toggle; 
  61.    --  Creates a new Gtk.Cell_Renderer_Toggle.Gtk_Cell_Renderer_Toggle. Adjust 
  62.    --  rendering parameters using object properties. Object properties can be 
  63.    --  set globally (with g_object_set). Also, with 
  64.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column, you can bind a property to a 
  65.    --  value in a Gtk.Tree_Model.Gtk_Tree_Model. For example, you can bind the 
  66.    --  "active" property on the cell renderer to a boolean value in the model, 
  67.    --  thus causing the check button to reflect the state of the model. 
  68.  
  69.    function Get_Type return Glib.GType; 
  70.    pragma Import (C, Get_Type, "gtk_cell_renderer_toggle_get_type"); 
  71.  
  72.    ------------- 
  73.    -- Methods -- 
  74.    ------------- 
  75.  
  76.    function Get_Activatable 
  77.       (Self : not null access Gtk_Cell_Renderer_Toggle_Record) 
  78.        return Boolean; 
  79.    --  Returns whether the cell renderer is activatable. See 
  80.    --  Gtk.Cell_Renderer_Toggle.Set_Activatable. 
  81.    --  Since: gtk+ 2.18 
  82.  
  83.    procedure Set_Activatable 
  84.       (Self    : not null access Gtk_Cell_Renderer_Toggle_Record; 
  85.        Setting : Boolean); 
  86.    --  Makes the cell renderer activatable. 
  87.    --  Since: gtk+ 2.18 
  88.    --  "setting": the value to set. 
  89.  
  90.    function Get_Active 
  91.       (Self : not null access Gtk_Cell_Renderer_Toggle_Record) 
  92.        return Boolean; 
  93.    --  Returns whether the cell renderer is active. See 
  94.    --  Gtk.Cell_Renderer_Toggle.Set_Active. 
  95.  
  96.    procedure Set_Active 
  97.       (Self    : not null access Gtk_Cell_Renderer_Toggle_Record; 
  98.        Setting : Boolean); 
  99.    --  Activates or deactivates a cell renderer. 
  100.    --  "setting": the value to set. 
  101.  
  102.    function Get_Radio 
  103.       (Self : not null access Gtk_Cell_Renderer_Toggle_Record) 
  104.        return Boolean; 
  105.    --  Returns whether we're rendering radio toggles rather than checkboxes. 
  106.  
  107.    procedure Set_Radio 
  108.       (Self  : not null access Gtk_Cell_Renderer_Toggle_Record; 
  109.        Radio : Boolean); 
  110.    --  If Radio is True, the cell renderer renders a radio toggle (i.e. a 
  111.    --  toggle in a group of mutually-exclusive toggles). If False, it renders a 
  112.    --  check toggle (a standalone boolean option). This can be set globally for 
  113.    --  the cell renderer, or changed just before rendering each cell in the 
  114.    --  model (for Gtk.Tree_View.Gtk_Tree_View, you set up a per-row setting 
  115.    --  using Gtk.Tree_View_Column.Gtk_Tree_View_Column to associate model 
  116.    --  columns with cell renderer properties). 
  117.    --  "radio": True to make the toggle look like a radio button 
  118.  
  119.    ---------------- 
  120.    -- Properties -- 
  121.    ---------------- 
  122.    --  The following properties are defined for this widget. See 
  123.    --  Glib.Properties for more information on properties) 
  124.  
  125.    Activatable_Property : constant Glib.Properties.Property_Boolean; 
  126.  
  127.    Active_Property : constant Glib.Properties.Property_Boolean; 
  128.  
  129.    Inconsistent_Property : constant Glib.Properties.Property_Boolean; 
  130.  
  131.    Indicator_Size_Property : constant Glib.Properties.Property_Int; 
  132.  
  133.    Radio_Property : constant Glib.Properties.Property_Boolean; 
  134.  
  135.    ------------- 
  136.    -- Signals -- 
  137.    ------------- 
  138.  
  139.    type Cb_Gtk_Cell_Renderer_Toggle_UTF8_String_Void is not null access procedure 
  140.      (Self : access Gtk_Cell_Renderer_Toggle_Record'Class; 
  141.       Path : UTF8_String); 
  142.  
  143.    type Cb_GObject_UTF8_String_Void is not null access procedure 
  144.      (Self : access Glib.Object.GObject_Record'Class; 
  145.       Path : UTF8_String); 
  146.  
  147.    Signal_Toggled : constant Glib.Signal_Name := "toggled"; 
  148.    procedure On_Toggled 
  149.       (Self  : not null access Gtk_Cell_Renderer_Toggle_Record; 
  150.        Call  : Cb_Gtk_Cell_Renderer_Toggle_UTF8_String_Void; 
  151.        After : Boolean := False); 
  152.    procedure On_Toggled 
  153.       (Self  : not null access Gtk_Cell_Renderer_Toggle_Record; 
  154.        Call  : Cb_GObject_UTF8_String_Void; 
  155.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  156.        After : Boolean := False); 
  157.    --  The ::toggled signal is emitted when the cell is toggled. 
  158.  
  159. private 
  160.    Radio_Property : constant Glib.Properties.Property_Boolean := 
  161.      Glib.Properties.Build ("radio"); 
  162.    Indicator_Size_Property : constant Glib.Properties.Property_Int := 
  163.      Glib.Properties.Build ("indicator-size"); 
  164.    Inconsistent_Property : constant Glib.Properties.Property_Boolean := 
  165.      Glib.Properties.Build ("inconsistent"); 
  166.    Active_Property : constant Glib.Properties.Property_Boolean := 
  167.      Glib.Properties.Build ("active"); 
  168.    Activatable_Property : constant Glib.Properties.Property_Boolean := 
  169.      Glib.Properties.Build ("activatable"); 
  170. end Gtk.Cell_Renderer_Toggle;