2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkToggleAction.html
27 * outFile = ToggleAction
28 * strct = GtkToggleAction
39 * - gtk_toggle_action_
51 module gtk
.ToggleAction
;
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gtkc
.gtktypes
;
63 private import gtkc
.gtk
;
66 private import glib
.Str
;
73 * A GtkToggleAction corresponds roughly to a GtkCheckMenuItem. It has an
74 * "active" state specifying whether the action has been checked or not.
76 private import gtk
.Action
;
77 public class ToggleAction
: Action
80 /** the main Gtk struct */
81 protected GtkToggleAction
* gtkToggleAction
;
84 public GtkToggleAction
* getToggleActionStruct()
86 return gtkToggleAction
;
90 /** the main Gtk struct as a void* */
91 protected void* getStruct()
93 return cast(void*)gtkToggleAction
;
97 * Sets our main struct and passes it to the parent class
99 public this (GtkToggleAction
* gtkToggleAction
)
103 if ( gtkToggleAction
is null )
108 Stdout("struct gtkToggleAction is null on constructor").newline
;
112 printf("struct gtkToggleAction is null on constructor");
119 assert(gtkToggleAction
!is null, "struct gtkToggleAction is null on constructor");
121 super(cast(GtkAction
*)gtkToggleAction
);
122 this.gtkToggleAction
= gtkToggleAction
;
128 // imports for the signal processing
129 private import gobject
.Signals
;
130 private import gtkc
.gdktypes
;
131 int[char[]] connectedSignals
;
133 void delegate(ToggleAction
)[] onToggledListeners
;
134 void addOnToggled(void delegate(ToggleAction
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
136 if ( !("toggled" in connectedSignals
) )
141 cast(GCallback
)&callBackToggled
,
145 connectedSignals
["toggled"] = 1;
147 onToggledListeners
~= dlg
;
149 extern(C
) static void callBackToggled(GtkToggleAction
* toggleactionStruct
, ToggleAction toggleAction
)
151 bool consumed
= false;
153 foreach ( void delegate(ToggleAction
) dlg
; toggleAction
.onToggledListeners
)
164 * Creates a new GtkToggleAction object. To add the action to
165 * a GtkActionGroup and set the accelerator for the action,
166 * call gtk_action_group_add_action_with_accel().
168 * A unique name for the action
170 * The label displayed in menu items and on buttons
172 * A tooltip for the action
174 * The stock icon to display in widgets representing the action
176 * a new GtkToggleAction
179 public this (char[] name
, char[] label
, char[] tooltip
, char[] stockId
)
181 // GtkToggleAction* gtk_toggle_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id);
182 this(cast(GtkToggleAction
*)gtk_toggle_action_new(Str
.toStringz(name
), Str
.toStringz(label
), Str
.toStringz(tooltip
), Str
.toStringz(stockId
)) );
186 * Emits the "toggled" signal on the toggle action.
191 public void toggled()
193 // void gtk_toggle_action_toggled (GtkToggleAction *action);
194 gtk_toggle_action_toggled(gtkToggleAction
);
198 * Sets the checked state on the toggle action.
202 * whether the action should be checked or not
205 public void setActive(int isActive
)
207 // void gtk_toggle_action_set_active (GtkToggleAction *action, gboolean is_active);
208 gtk_toggle_action_set_active(gtkToggleAction
, isActive
);
212 * Returns the checked state of the toggle action.
216 * the checked state of the toggle action
219 public int getActive()
221 // gboolean gtk_toggle_action_get_active (GtkToggleAction *action);
222 return gtk_toggle_action_get_active(gtkToggleAction
);
226 * Sets whether the action should have proxies like a radio action.
230 * whether the action should have proxies like a radio
234 public void setDrawAsRadio(int drawAsRadio
)
236 // void gtk_toggle_action_set_draw_as_radio (GtkToggleAction *action, gboolean draw_as_radio);
237 gtk_toggle_action_set_draw_as_radio(gtkToggleAction
, drawAsRadio
);
241 * Returns whether the action should have proxies like a radio action.
245 * whether the action should have proxies like a radio action.
248 * The "active" property
249 * "active" gboolean : Read / Write
250 * If the toggle action should be active in or not.
251 * Default value: FALSE
254 public int getDrawAsRadio()
256 // gboolean gtk_toggle_action_get_draw_as_radio (GtkToggleAction *action);
257 return gtk_toggle_action_get_draw_as_radio(gtkToggleAction
);