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.Switch.Gtk_Switch is a widget that has two states: on or off. The user 
  26. --  can control which state should be active by clicking the empty area, or by 
  27. --  dragging the handle. 
  28. -- 
  29. --  </description> 
  30. pragma Ada_2005; 
  31.  
  32. pragma Warnings (Off, "*is already use-visible*"); 
  33. with Glib;            use Glib; 
  34. with Glib.Object;     use Glib.Object; 
  35. with Glib.Properties; use Glib.Properties; 
  36. with Glib.Types;      use Glib.Types; 
  37. with Glib.Variant;    use Glib.Variant; 
  38. with Gtk.Action;      use Gtk.Action; 
  39. with Gtk.Actionable;  use Gtk.Actionable; 
  40. with Gtk.Activatable; use Gtk.Activatable; 
  41. with Gtk.Buildable;   use Gtk.Buildable; 
  42. with Gtk.Widget;      use Gtk.Widget; 
  43.  
  44. package Gtk.Switch is 
  45.  
  46.    type Gtk_Switch_Record is new Gtk_Widget_Record with null record; 
  47.    type Gtk_Switch is access all Gtk_Switch_Record'Class; 
  48.  
  49.    ------------------ 
  50.    -- Constructors -- 
  51.    ------------------ 
  52.  
  53.    procedure Gtk_New (Self : out Gtk_Switch); 
  54.    procedure Initialize (Self : not null access Gtk_Switch_Record'Class); 
  55.    --  Creates a new Gtk.Switch.Gtk_Switch widget. 
  56.    --  Since: gtk+ 3.0 
  57.  
  58.    function Gtk_Switch_New return Gtk_Switch; 
  59.    --  Creates a new Gtk.Switch.Gtk_Switch widget. 
  60.    --  Since: gtk+ 3.0 
  61.  
  62.    function Get_Type return Glib.GType; 
  63.    pragma Import (C, Get_Type, "gtk_switch_get_type"); 
  64.  
  65.    ------------- 
  66.    -- Methods -- 
  67.    ------------- 
  68.  
  69.    function Get_Active 
  70.       (Self : not null access Gtk_Switch_Record) return Boolean; 
  71.    --  Gets whether the Gtk.Switch.Gtk_Switch is in its "on" or "off" state. 
  72.    --  Since: gtk+ 3.0 
  73.  
  74.    procedure Set_Active 
  75.       (Self      : not null access Gtk_Switch_Record; 
  76.        Is_Active : Boolean); 
  77.    --  Changes the state of Sw to the desired one. 
  78.    --  Since: gtk+ 3.0 
  79.    --  "is_active": True if Sw should be active, and False otherwise 
  80.  
  81.    --------------------------------------------- 
  82.    -- Inherited subprograms (from interfaces) -- 
  83.    --------------------------------------------- 
  84.    --  Methods inherited from the Buildable interface are not duplicated here 
  85.    --  since they are meant to be used by tools, mostly. If you need to call 
  86.    --  them, use an explicit cast through the "-" operator below. 
  87.  
  88.    function Get_Action_Name 
  89.       (Self : not null access Gtk_Switch_Record) return UTF8_String; 
  90.  
  91.    procedure Set_Action_Name 
  92.       (Self        : not null access Gtk_Switch_Record; 
  93.        Action_Name : UTF8_String); 
  94.  
  95.    function Get_Action_Target_Value 
  96.       (Self : not null access Gtk_Switch_Record) 
  97.        return Glib.Variant.Gvariant; 
  98.  
  99.    procedure Set_Action_Target_Value 
  100.       (Self         : not null access Gtk_Switch_Record; 
  101.        Target_Value : Glib.Variant.Gvariant); 
  102.  
  103.    procedure Set_Detailed_Action_Name 
  104.       (Self                 : not null access Gtk_Switch_Record; 
  105.        Detailed_Action_Name : UTF8_String); 
  106.  
  107.    procedure Do_Set_Related_Action 
  108.       (Self   : not null access Gtk_Switch_Record; 
  109.        Action : not null access Gtk.Action.Gtk_Action_Record'Class); 
  110.  
  111.    function Get_Related_Action 
  112.       (Self : not null access Gtk_Switch_Record) 
  113.        return Gtk.Action.Gtk_Action; 
  114.  
  115.    procedure Set_Related_Action 
  116.       (Self   : not null access Gtk_Switch_Record; 
  117.        Action : not null access Gtk.Action.Gtk_Action_Record'Class); 
  118.  
  119.    function Get_Use_Action_Appearance 
  120.       (Self : not null access Gtk_Switch_Record) return Boolean; 
  121.  
  122.    procedure Set_Use_Action_Appearance 
  123.       (Self           : not null access Gtk_Switch_Record; 
  124.        Use_Appearance : Boolean); 
  125.  
  126.    procedure Sync_Action_Properties 
  127.       (Self   : not null access Gtk_Switch_Record; 
  128.        Action : access Gtk.Action.Gtk_Action_Record'Class); 
  129.  
  130.    ---------------- 
  131.    -- Properties -- 
  132.    ---------------- 
  133.    --  The following properties are defined for this widget. See 
  134.    --  Glib.Properties for more information on properties) 
  135.  
  136.    Active_Property : constant Glib.Properties.Property_Boolean; 
  137.    --  Whether the Gtk.Switch.Gtk_Switch widget is in its on or off state. 
  138.  
  139.    ------------- 
  140.    -- Signals -- 
  141.    ------------- 
  142.  
  143.    type Cb_Gtk_Switch_Void is not null access procedure (Self : access Gtk_Switch_Record'Class); 
  144.  
  145.    type Cb_GObject_Void is not null access procedure 
  146.      (Self : access Glib.Object.GObject_Record'Class); 
  147.  
  148.    Signal_Activate : constant Glib.Signal_Name := "activate"; 
  149.    procedure On_Activate 
  150.       (Self  : not null access Gtk_Switch_Record; 
  151.        Call  : Cb_Gtk_Switch_Void; 
  152.        After : Boolean := False); 
  153.    procedure On_Activate 
  154.       (Self  : not null access Gtk_Switch_Record; 
  155.        Call  : Cb_GObject_Void; 
  156.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  157.        After : Boolean := False); 
  158.    --  The ::activate signal on GtkSwitch is an action signal and emitting it 
  159.    --  causes the switch to animate. Applications should never connect to this 
  160.    --  signal, but use the notify::active signal. 
  161.  
  162.    ---------------- 
  163.    -- Interfaces -- 
  164.    ---------------- 
  165.    --  This class implements several interfaces. See Glib.Types 
  166.    -- 
  167.    --  - "Actionable" 
  168.    -- 
  169.    --  - "Activatable" 
  170.    -- 
  171.    --  - "Buildable" 
  172.  
  173.    package Implements_Gtk_Actionable is new Glib.Types.Implements 
  174.      (Gtk.Actionable.Gtk_Actionable, Gtk_Switch_Record, Gtk_Switch); 
  175.    function "+" 
  176.      (Widget : access Gtk_Switch_Record'Class) 
  177.    return Gtk.Actionable.Gtk_Actionable 
  178.    renames Implements_Gtk_Actionable.To_Interface; 
  179.    function "-" 
  180.      (Interf : Gtk.Actionable.Gtk_Actionable) 
  181.    return Gtk_Switch 
  182.    renames Implements_Gtk_Actionable.To_Object; 
  183.  
  184.    package Implements_Gtk_Activatable is new Glib.Types.Implements 
  185.      (Gtk.Activatable.Gtk_Activatable, Gtk_Switch_Record, Gtk_Switch); 
  186.    function "+" 
  187.      (Widget : access Gtk_Switch_Record'Class) 
  188.    return Gtk.Activatable.Gtk_Activatable 
  189.    renames Implements_Gtk_Activatable.To_Interface; 
  190.    function "-" 
  191.      (Interf : Gtk.Activatable.Gtk_Activatable) 
  192.    return Gtk_Switch 
  193.    renames Implements_Gtk_Activatable.To_Object; 
  194.  
  195.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  196.      (Gtk.Buildable.Gtk_Buildable, Gtk_Switch_Record, Gtk_Switch); 
  197.    function "+" 
  198.      (Widget : access Gtk_Switch_Record'Class) 
  199.    return Gtk.Buildable.Gtk_Buildable 
  200.    renames Implements_Gtk_Buildable.To_Interface; 
  201.    function "-" 
  202.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  203.    return Gtk_Switch 
  204.    renames Implements_Gtk_Buildable.To_Object; 
  205.  
  206. private 
  207.    Active_Property : constant Glib.Properties.Property_Boolean := 
  208.      Glib.Properties.Build ("active"); 
  209. end Gtk.Switch;