1------------------------------------------------------------------------------ 2-- -- 3-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 4-- Copyright (C) 2000-2015, 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_Action.Gtk_Toggle_Action corresponds roughly to a 26-- Gtk.Check_Menu_Item.Gtk_Check_Menu_Item. It has an "active" state 27-- specifying whether the action has been checked or not. 28-- 29-- </description> 30pragma Ada_2005; 31 32pragma Warnings (Off, "*is already use-visible*"); 33with Glib; use Glib; 34with Glib.Object; use Glib.Object; 35with Glib.Properties; use Glib.Properties; 36with Glib.Types; use Glib.Types; 37with Gtk.Action; use Gtk.Action; 38with Gtk.Buildable; use Gtk.Buildable; 39 40package Gtk.Toggle_Action is 41 42 type Gtk_Toggle_Action_Record is new Gtk_Action_Record with null record; 43 type Gtk_Toggle_Action is access all Gtk_Toggle_Action_Record'Class; 44 45 ------------------ 46 -- Constructors -- 47 ------------------ 48 49 procedure Gtk_New 50 (Action : out Gtk_Toggle_Action; 51 Name : UTF8_String; 52 Label : UTF8_String := ""; 53 Tooltip : UTF8_String := ""; 54 Stock_Id : UTF8_String := ""); 55 procedure Initialize 56 (Action : not null access Gtk_Toggle_Action_Record'Class; 57 Name : UTF8_String; 58 Label : UTF8_String := ""; 59 Tooltip : UTF8_String := ""; 60 Stock_Id : UTF8_String := ""); 61 -- Creates a new Gtk.Toggle_Action.Gtk_Toggle_Action object. To add the 62 -- action to a Gtk.Action_Group.Gtk_Action_Group and set the accelerator 63 -- for the action, call Gtk.Action_Group.Add_Action_With_Accel. 64 -- Since: gtk+ 2.4 65 -- "name": A unique name for the action 66 -- "label": The label displayed in menu items and on buttons, or null 67 -- "tooltip": A tooltip for the action, or null 68 -- "stock_id": The stock icon to display in widgets representing the 69 -- action, or null 70 71 function Gtk_Toggle_Action_New 72 (Name : UTF8_String; 73 Label : UTF8_String := ""; 74 Tooltip : UTF8_String := ""; 75 Stock_Id : UTF8_String := "") return Gtk_Toggle_Action; 76 -- Creates a new Gtk.Toggle_Action.Gtk_Toggle_Action object. To add the 77 -- action to a Gtk.Action_Group.Gtk_Action_Group and set the accelerator 78 -- for the action, call Gtk.Action_Group.Add_Action_With_Accel. 79 -- Since: gtk+ 2.4 80 -- "name": A unique name for the action 81 -- "label": The label displayed in menu items and on buttons, or null 82 -- "tooltip": A tooltip for the action, or null 83 -- "stock_id": The stock icon to display in widgets representing the 84 -- action, or null 85 86 function Get_Type return Glib.GType; 87 pragma Import (C, Get_Type, "gtk_toggle_action_get_type"); 88 89 ------------- 90 -- Methods -- 91 ------------- 92 93 function Get_Active 94 (Action : not null access Gtk_Toggle_Action_Record) return Boolean; 95 pragma Obsolescent (Get_Active); 96 -- Returns the checked state of the toggle action. 97 -- Since: gtk+ 2.4 98 -- Deprecated since 3.10, 1 99 100 procedure Set_Active 101 (Action : not null access Gtk_Toggle_Action_Record; 102 Is_Active : Boolean); 103 pragma Obsolescent (Set_Active); 104 -- Sets the checked state on the toggle action. 105 -- Since: gtk+ 2.4 106 -- Deprecated since 3.10, 1 107 -- "is_active": whether the action should be checked or not 108 109 function Get_Draw_As_Radio 110 (Action : not null access Gtk_Toggle_Action_Record) return Boolean; 111 pragma Obsolescent (Get_Draw_As_Radio); 112 -- Returns whether the action should have proxies like a radio action. 113 -- Since: gtk+ 2.4 114 -- Deprecated since 3.10, 1 115 116 procedure Set_Draw_As_Radio 117 (Action : not null access Gtk_Toggle_Action_Record; 118 Draw_As_Radio : Boolean); 119 pragma Obsolescent (Set_Draw_As_Radio); 120 -- Sets whether the action should have proxies like a radio action. 121 -- Since: gtk+ 2.4 122 -- Deprecated since 3.10, 1 123 -- "draw_as_radio": whether the action should have proxies like a radio 124 -- action 125 126 procedure Toggled (Action : not null access Gtk_Toggle_Action_Record); 127 pragma Obsolescent (Toggled); 128 -- Emits the "toggled" signal on the toggle action. 129 -- Since: gtk+ 2.4 130 -- Deprecated since 3.10, 1 131 132 ---------------- 133 -- Properties -- 134 ---------------- 135 -- The following properties are defined for this widget. See 136 -- Glib.Properties for more information on properties) 137 138 Active_Property : constant Glib.Properties.Property_Boolean; 139 -- Whether the toggle action should be active. 140 141 Draw_As_Radio_Property : constant Glib.Properties.Property_Boolean; 142 -- Whether the proxies for this action look like radio action proxies. 143 -- 144 -- This is an appearance property and thus only applies if 145 -- Gtk.Activatable.Gtk_Activatable:use-action-appearance is True. 146 147 ------------- 148 -- Signals -- 149 ------------- 150 151 type Cb_Gtk_Toggle_Action_Void is not null access procedure 152 (Self : access Gtk_Toggle_Action_Record'Class); 153 154 type Cb_GObject_Void is not null access procedure 155 (Self : access Glib.Object.GObject_Record'Class); 156 157 Signal_Toggled : constant Glib.Signal_Name := "toggled"; 158 procedure On_Toggled 159 (Self : not null access Gtk_Toggle_Action_Record; 160 Call : Cb_Gtk_Toggle_Action_Void; 161 After : Boolean := False); 162 procedure On_Toggled 163 (Self : not null access Gtk_Toggle_Action_Record; 164 Call : Cb_GObject_Void; 165 Slot : not null access Glib.Object.GObject_Record'Class; 166 After : Boolean := False); 167 -- Should be connected if you wish to perform an action whenever the 168 -- Gtk.Toggle_Action.Gtk_Toggle_Action state is changed. 169 170 ---------------- 171 -- Interfaces -- 172 ---------------- 173 -- This class implements several interfaces. See Glib.Types 174 -- 175 -- - "Buildable" 176 177 package Implements_Gtk_Buildable is new Glib.Types.Implements 178 (Gtk.Buildable.Gtk_Buildable, Gtk_Toggle_Action_Record, Gtk_Toggle_Action); 179 function "+" 180 (Widget : access Gtk_Toggle_Action_Record'Class) 181 return Gtk.Buildable.Gtk_Buildable 182 renames Implements_Gtk_Buildable.To_Interface; 183 function "-" 184 (Interf : Gtk.Buildable.Gtk_Buildable) 185 return Gtk_Toggle_Action 186 renames Implements_Gtk_Buildable.To_Object; 187 188private 189 Draw_As_Radio_Property : constant Glib.Properties.Property_Boolean := 190 Glib.Properties.Build ("draw-as-radio"); 191 Active_Property : constant Glib.Properties.Property_Boolean := 192 Glib.Properties.Build ("active"); 193end Gtk.Toggle_Action; 194