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. --  A Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button is a 
  26. --  Gtk.Tool_Item.Gtk_Tool_Item that contains a toggle button. 
  27. -- 
  28. --  Use Gtk.Toggle_Tool_Button.Gtk_New to create a new 
  29. --  Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button. Use 
  30. --  Gtk.Toggle_Tool_Button.Gtk_New_From_Stock to create a new 
  31. --  Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button containing a stock item. 
  32. -- 
  33. --  </description> 
  34. pragma Ada_2005; 
  35.  
  36. pragma Warnings (Off, "*is already use-visible*"); 
  37. with Glib;            use Glib; 
  38. with Glib.Object;     use Glib.Object; 
  39. with Glib.Properties; use Glib.Properties; 
  40. with Glib.Types;      use Glib.Types; 
  41. with Glib.Variant;    use Glib.Variant; 
  42. with Gtk.Action;      use Gtk.Action; 
  43. with Gtk.Actionable;  use Gtk.Actionable; 
  44. with Gtk.Activatable; use Gtk.Activatable; 
  45. with Gtk.Buildable;   use Gtk.Buildable; 
  46. with Gtk.Tool_Button; use Gtk.Tool_Button; 
  47.  
  48. package Gtk.Toggle_Tool_Button is 
  49.  
  50.    type Gtk_Toggle_Tool_Button_Record is new Gtk_Tool_Button_Record with null record; 
  51.    type Gtk_Toggle_Tool_Button is access all Gtk_Toggle_Tool_Button_Record'Class; 
  52.  
  53.    ------------------ 
  54.    -- Constructors -- 
  55.    ------------------ 
  56.  
  57.    procedure Gtk_New (Button : out Gtk_Toggle_Tool_Button); 
  58.    procedure Initialize 
  59.       (Button : not null access Gtk_Toggle_Tool_Button_Record'Class); 
  60.    --  Returns a new Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button 
  61.    --  Since: gtk+ 2.4 
  62.  
  63.    function Gtk_Toggle_Tool_Button_New return Gtk_Toggle_Tool_Button; 
  64.    --  Returns a new Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button 
  65.    --  Since: gtk+ 2.4 
  66.  
  67.    procedure Gtk_New_From_Stock 
  68.       (Button   : out Gtk_Toggle_Tool_Button; 
  69.        Stock_Id : UTF8_String); 
  70.    procedure Initialize_From_Stock 
  71.       (Button   : not null access Gtk_Toggle_Tool_Button_Record'Class; 
  72.        Stock_Id : UTF8_String); 
  73.    --  Creates a new Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button containing 
  74.    --  the image and text from a stock item. Some stock ids have preprocessor 
  75.    --  macros like GTK_STOCK_OK and GTK_STOCK_APPLY. 
  76.    --  It is an error if Stock_Id is not a name of a stock item. 
  77.    --  Since: gtk+ 2.4 
  78.    --  "stock_id": the name of the stock item 
  79.  
  80.    function Gtk_Toggle_Tool_Button_New_From_Stock 
  81.       (Stock_Id : UTF8_String) return Gtk_Toggle_Tool_Button; 
  82.    --  Creates a new Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button containing 
  83.    --  the image and text from a stock item. Some stock ids have preprocessor 
  84.    --  macros like GTK_STOCK_OK and GTK_STOCK_APPLY. 
  85.    --  It is an error if Stock_Id is not a name of a stock item. 
  86.    --  Since: gtk+ 2.4 
  87.    --  "stock_id": the name of the stock item 
  88.  
  89.    function Get_Type return Glib.GType; 
  90.    pragma Import (C, Get_Type, "gtk_toggle_tool_button_get_type"); 
  91.  
  92.    ------------- 
  93.    -- Methods -- 
  94.    ------------- 
  95.  
  96.    function Get_Active 
  97.       (Button : not null access Gtk_Toggle_Tool_Button_Record) 
  98.        return Boolean; 
  99.    --  Queries a Gtk.Toggle_Tool_Button.Gtk_Toggle_Tool_Button and returns its 
  100.    --  current state. Returns True if the toggle button is pressed in and False 
  101.    --  if it is raised. 
  102.    --  Since: gtk+ 2.4 
  103.  
  104.    procedure Set_Active 
  105.       (Button    : not null access Gtk_Toggle_Tool_Button_Record; 
  106.        Is_Active : Boolean); 
  107.    --  Sets the status of the toggle tool button. Set to True if you want the 
  108.    --  GtkToggleButton to be 'pressed in', and False to raise it. This action 
  109.    --  causes the toggled signal to be emitted. 
  110.    --  Since: gtk+ 2.4 
  111.    --  "is_active": whether Button should be active 
  112.  
  113.    --------------------------------------------- 
  114.    -- Inherited subprograms (from interfaces) -- 
  115.    --------------------------------------------- 
  116.    --  Methods inherited from the Buildable interface are not duplicated here 
  117.    --  since they are meant to be used by tools, mostly. If you need to call 
  118.    --  them, use an explicit cast through the "-" operator below. 
  119.  
  120.    function Get_Action_Name 
  121.       (Self : not null access Gtk_Toggle_Tool_Button_Record) 
  122.        return UTF8_String; 
  123.  
  124.    procedure Set_Action_Name 
  125.       (Self        : not null access Gtk_Toggle_Tool_Button_Record; 
  126.        Action_Name : UTF8_String); 
  127.  
  128.    function Get_Action_Target_Value 
  129.       (Self : not null access Gtk_Toggle_Tool_Button_Record) 
  130.        return Glib.Variant.Gvariant; 
  131.  
  132.    procedure Set_Action_Target_Value 
  133.       (Self         : not null access Gtk_Toggle_Tool_Button_Record; 
  134.        Target_Value : Glib.Variant.Gvariant); 
  135.  
  136.    procedure Set_Detailed_Action_Name 
  137.       (Self                 : not null access Gtk_Toggle_Tool_Button_Record; 
  138.        Detailed_Action_Name : UTF8_String); 
  139.  
  140.    procedure Do_Set_Related_Action 
  141.       (Self   : not null access Gtk_Toggle_Tool_Button_Record; 
  142.        Action : not null access Gtk.Action.Gtk_Action_Record'Class); 
  143.  
  144.    function Get_Related_Action 
  145.       (Self : not null access Gtk_Toggle_Tool_Button_Record) 
  146.        return Gtk.Action.Gtk_Action; 
  147.  
  148.    procedure Set_Related_Action 
  149.       (Self   : not null access Gtk_Toggle_Tool_Button_Record; 
  150.        Action : not null access Gtk.Action.Gtk_Action_Record'Class); 
  151.  
  152.    function Get_Use_Action_Appearance 
  153.       (Self : not null access Gtk_Toggle_Tool_Button_Record) return Boolean; 
  154.  
  155.    procedure Set_Use_Action_Appearance 
  156.       (Self           : not null access Gtk_Toggle_Tool_Button_Record; 
  157.        Use_Appearance : Boolean); 
  158.  
  159.    procedure Sync_Action_Properties 
  160.       (Self   : not null access Gtk_Toggle_Tool_Button_Record; 
  161.        Action : access Gtk.Action.Gtk_Action_Record'Class); 
  162.  
  163.    ---------------- 
  164.    -- Properties -- 
  165.    ---------------- 
  166.    --  The following properties are defined for this widget. See 
  167.    --  Glib.Properties for more information on properties) 
  168.  
  169.    Active_Property : constant Glib.Properties.Property_Boolean; 
  170.    --  If the toggle tool button should be pressed in. 
  171.  
  172.    ------------- 
  173.    -- Signals -- 
  174.    ------------- 
  175.  
  176.    type Cb_Gtk_Toggle_Tool_Button_Void is not null access procedure 
  177.      (Self : access Gtk_Toggle_Tool_Button_Record'Class); 
  178.  
  179.    type Cb_GObject_Void is not null access procedure 
  180.      (Self : access Glib.Object.GObject_Record'Class); 
  181.  
  182.    Signal_Toggled : constant Glib.Signal_Name := "toggled"; 
  183.    procedure On_Toggled 
  184.       (Self  : not null access Gtk_Toggle_Tool_Button_Record; 
  185.        Call  : Cb_Gtk_Toggle_Tool_Button_Void; 
  186.        After : Boolean := False); 
  187.    procedure On_Toggled 
  188.       (Self  : not null access Gtk_Toggle_Tool_Button_Record; 
  189.        Call  : Cb_GObject_Void; 
  190.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  191.        After : Boolean := False); 
  192.    --  Emitted whenever the toggle tool button changes state. 
  193.  
  194.    ---------------- 
  195.    -- Interfaces -- 
  196.    ---------------- 
  197.    --  This class implements several interfaces. See Glib.Types 
  198.    -- 
  199.    --  - "Actionable" 
  200.    -- 
  201.    --  - "Activatable" 
  202.    -- 
  203.    --  - "Buildable" 
  204.  
  205.    package Implements_Gtk_Actionable is new Glib.Types.Implements 
  206.      (Gtk.Actionable.Gtk_Actionable, Gtk_Toggle_Tool_Button_Record, Gtk_Toggle_Tool_Button); 
  207.    function "+" 
  208.      (Widget : access Gtk_Toggle_Tool_Button_Record'Class) 
  209.    return Gtk.Actionable.Gtk_Actionable 
  210.    renames Implements_Gtk_Actionable.To_Interface; 
  211.    function "-" 
  212.      (Interf : Gtk.Actionable.Gtk_Actionable) 
  213.    return Gtk_Toggle_Tool_Button 
  214.    renames Implements_Gtk_Actionable.To_Object; 
  215.  
  216.    package Implements_Gtk_Activatable is new Glib.Types.Implements 
  217.      (Gtk.Activatable.Gtk_Activatable, Gtk_Toggle_Tool_Button_Record, Gtk_Toggle_Tool_Button); 
  218.    function "+" 
  219.      (Widget : access Gtk_Toggle_Tool_Button_Record'Class) 
  220.    return Gtk.Activatable.Gtk_Activatable 
  221.    renames Implements_Gtk_Activatable.To_Interface; 
  222.    function "-" 
  223.      (Interf : Gtk.Activatable.Gtk_Activatable) 
  224.    return Gtk_Toggle_Tool_Button 
  225.    renames Implements_Gtk_Activatable.To_Object; 
  226.  
  227.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  228.      (Gtk.Buildable.Gtk_Buildable, Gtk_Toggle_Tool_Button_Record, Gtk_Toggle_Tool_Button); 
  229.    function "+" 
  230.      (Widget : access Gtk_Toggle_Tool_Button_Record'Class) 
  231.    return Gtk.Buildable.Gtk_Buildable 
  232.    renames Implements_Gtk_Buildable.To_Interface; 
  233.    function "-" 
  234.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  235.    return Gtk_Toggle_Tool_Button 
  236.    renames Implements_Gtk_Buildable.To_Object; 
  237.  
  238. private 
  239.    Active_Property : constant Glib.Properties.Property_Boolean := 
  240.      Glib.Properties.Build ("active"); 
  241. end Gtk.Toggle_Tool_Button;