Wrote the README_GIT file to be a proper tutorial on git, repo.or.cz and gtkD.
[gtkD.git] / gtkD / src / gtk / ToggleAction.d
blobae8a2542bea5f66a209c2284600f4a836e9856cb
1 /*
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
26 * outPack = gtk
27 * outFile = ToggleAction
28 * strct = GtkToggleAction
29 * realStrct=
30 * ctorStrct=
31 * clss = ToggleAction
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_toggle_action_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * structWrap:
47 * module aliases:
48 * local aliases:
51 module gtk.ToggleAction;
53 version(noAssert)
55 version(Tango)
57 import tango.io.Stdout; // use the tango loging?
61 private import gtkc.gtktypes;
63 private import gtkc.gtk;
66 private import glib.Str;
71 /**
72 * Description
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;
96 /**
97 * Sets our main struct and passes it to the parent class
99 public this (GtkToggleAction* gtkToggleAction)
101 version(noAssert)
103 if ( gtkToggleAction is null )
105 int zero = 0;
106 version(Tango)
108 Stdout("struct gtkToggleAction is null on constructor").newline;
110 else
112 printf("struct gtkToggleAction is null on constructor");
114 zero = zero / zero;
117 else
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) )
138 Signals.connectData(
139 getStruct(),
140 "toggled",
141 cast(GCallback)&callBackToggled,
142 cast(void*)this,
143 null,
144 connectFlags);
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 )
155 dlg(toggleAction);
158 return consumed;
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().
167 * name:
168 * A unique name for the action
169 * label:
170 * The label displayed in menu items and on buttons
171 * tooltip:
172 * A tooltip for the action
173 * stock_id:
174 * The stock icon to display in widgets representing the action
175 * Returns:
176 * a new GtkToggleAction
177 * Since 2.4
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.
187 * action:
188 * the action object
189 * Since 2.4
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.
199 * action:
200 * the action object
201 * is_active:
202 * whether the action should be checked or not
203 * Since 2.4
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.
213 * action:
214 * the action object
215 * Returns:
216 * the checked state of the toggle action
217 * Since 2.4
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.
227 * action:
228 * the action object
229 * draw_as_radio:
230 * whether the action should have proxies like a radio
231 * action
232 * Since 2.4
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.
242 * action:
243 * the action object
244 * Returns:
245 * whether the action should have proxies like a radio action.
246 * Since 2.4
247 * Property Details
248 * The "active" property
249 * "active" gboolean : Read / Write
250 * If the toggle action should be active in or not.
251 * Default value: FALSE
252 * Since 2.10
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);