1
-----------------------------------------------------------------------
2
-- GtkAda - Ada95 binding for Gtk+/Gnome --
4
-- Copyright (C) 2006-2008, AdaCore --
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. --
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. --
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. --
21
-----------------------------------------------------------------------
23
with Gtkada.Bindings; use Gtkada.Bindings;
24
with Interfaces.C.Strings; use Interfaces.C.Strings;
26
with Glib.Type_Conversion_Hooks;
28
package body Gtk.Toggle_Action is
30
package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
31
(Get_Type'Access, Gtk_Toggle_Action_Record);
32
pragma Warnings (Off, Type_Conversion);
39
(Action : access Gtk_Toggle_Action_Record) return Boolean
41
function Internal (Action : System.Address) return Gboolean;
42
pragma Import (C, Internal, "gtk_toggle_action_get_active");
44
return Boolean'Val (Internal (Get_Object (Action)));
47
-----------------------
48
-- Get_Draw_As_Radio --
49
-----------------------
51
function Get_Draw_As_Radio
52
(Action : access Gtk_Toggle_Action_Record) return Boolean
54
function Internal (Action : System.Address) return Gboolean;
55
pragma Import (C, Internal, "gtk_toggle_action_get_draw_as_radio");
57
return Boolean'Val (Internal (Get_Object (Action)));
58
end Get_Draw_As_Radio;
65
(Action : out Gtk_Toggle_Action;
68
Tooltip : String := "";
69
Stock_Id : String := "")
72
Action := new Gtk_Toggle_Action_Record;
73
Initialize (Action, Name, Label, Tooltip, Stock_Id);
81
(Action : access Gtk_Toggle_Action_Record'Class;
84
Tooltip : String := "";
85
Stock_Id : String := "")
92
return System.Address;
93
pragma Import (C, Internal, "gtk_toggle_action_new");
94
L : chars_ptr := String_Or_Null (Label);
95
T : chars_ptr := String_Or_Null (Tooltip);
96
S : chars_ptr := String_Or_Null (Stock_Id);
98
Set_Object (Action, Internal (Name & ASCII.NUL, L, T, S));
109
(Action : access Gtk_Toggle_Action_Record;
112
procedure Internal (Action : System.Address; Is_Active : Gboolean);
113
pragma Import (C, Internal, "gtk_toggle_action_set_active");
115
Internal (Get_Object (Action), Boolean'Pos (Is_Active));
118
-----------------------
119
-- Set_Draw_As_Radio --
120
-----------------------
122
procedure Set_Draw_As_Radio
123
(Action : access Gtk_Toggle_Action_Record;
124
Draw_As_Radio : Boolean)
126
procedure Internal (Action : System.Address; Draw_As_Radio : Gboolean);
127
pragma Import (C, Internal, "gtk_toggle_action_set_draw_as_radio");
129
Internal (Get_Object (Action), Boolean'Pos (Draw_As_Radio));
130
end Set_Draw_As_Radio;
136
procedure Toggled (Action : access Gtk_Toggle_Action_Record) is
137
procedure Internal (Action : System.Address);
138
pragma Import (C, Internal, "gtk_toggle_action_toggled");
140
Internal (Get_Object (Action));
143
end Gtk.Toggle_Action;