alternative to assert
[gtkD.git] / src / gtk / ToggleAction.d
bloba6b9b0e5a76ebcbd306bb076237d8f8412bf4f9e
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
50 module gtk.ToggleAction;
52 private import gtk.gtktypes;
54 private import lib.gtk;
56 private import glib.Str;
58 /**
59 * Description
60 * A GtkToggleAction corresponds roughly to a GtkCheckMenuItem. It has an
61 * "active" state specifying whether the action has been checked or not.
63 private import gtk.Action;
64 public class ToggleAction : Action
67 /** the main Gtk struct */
68 protected GtkToggleAction* gtkToggleAction;
71 public GtkToggleAction* getToggleActionStruct()
73 return gtkToggleAction;
77 /** the main Gtk struct as a void* */
78 protected void* getStruct()
80 return cast(void*)gtkToggleAction;
83 /**
84 * Sets our main struct and passes it to the parent class
86 public this (GtkToggleAction* gtkToggleAction)
88 super(cast(GtkAction*)gtkToggleAction);
89 this.gtkToggleAction = gtkToggleAction;
92 /**
95 // imports for the signal processing
96 private import gobject.Signals;
97 private import gdk.gdktypes;
98 int[char[]] connectedSignals;
100 void delegate(ToggleAction)[] onToggledListeners;
101 void addOnToggled(void delegate(ToggleAction) dlg)
103 if ( !("toggled" in connectedSignals) )
105 Signals.connectData(
106 getStruct(),
107 "toggled",
108 cast(GCallback)&callBackToggled,
109 this,
110 null,
111 cast(ConnectFlags)0);
112 connectedSignals["toggled"] = 1;
114 onToggledListeners ~= dlg;
116 extern(C) static void callBackToggled(GtkToggleAction* toggleactionStruct, ToggleAction toggleAction)
118 bit consumed = false;
120 foreach ( void delegate(ToggleAction) dlg ; toggleAction.onToggledListeners )
122 dlg(toggleAction);
125 return consumed;
131 * Creates a new GtkToggleAction object. To add the action to
132 * a GtkActionGroup and set the accelerator for the action,
133 * call gtk_action_group_add_action_with_accel().
134 * name:
135 * A unique name for the action
136 * label:
137 * The label displayed in menu items and on buttons
138 * tooltip:
139 * A tooltip for the action
140 * stock_id:
141 * The stock icon to display in widgets representing the action
142 * Returns:
143 * a new GtkToggleAction
144 * Since 2.4
146 public this (char[] name, char[] label, char[] tooltip, char[] stockId)
148 // GtkToggleAction* gtk_toggle_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id);
149 this(cast(GtkToggleAction*)gtk_toggle_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId)) );
153 * Emits the "toggled" signal on the toggle action.
154 * action:
155 * the action object
156 * Since 2.4
158 public void toggled()
160 // void gtk_toggle_action_toggled (GtkToggleAction *action);
161 gtk_toggle_action_toggled(gtkToggleAction);
165 * Sets the checked state on the toggle action.
166 * action:
167 * the action object
168 * is_active:
169 * whether the action should be checked or not
170 * Since 2.4
172 public void setActive(int isActive)
174 // void gtk_toggle_action_set_active (GtkToggleAction *action, gboolean is_active);
175 gtk_toggle_action_set_active(gtkToggleAction, isActive);
179 * Returns the checked state of the toggle action.
180 * action:
181 * the action object
182 * Returns:
183 * the checked state of the toggle action
184 * Since 2.4
186 public int getActive()
188 // gboolean gtk_toggle_action_get_active (GtkToggleAction *action);
189 return gtk_toggle_action_get_active(gtkToggleAction);
193 * Sets whether the action should have proxies like a radio action.
194 * action:
195 * the action object
196 * draw_as_radio:
197 * whether the action should have proxies like a radio
198 * action
199 * Since 2.4
201 public void setDrawAsRadio(int drawAsRadio)
203 // void gtk_toggle_action_set_draw_as_radio (GtkToggleAction *action, gboolean draw_as_radio);
204 gtk_toggle_action_set_draw_as_radio(gtkToggleAction, drawAsRadio);
208 * Returns whether the action should have proxies like a radio action.
209 * action:
210 * the action object
211 * Returns:
212 * whether the action should have proxies like a radio action.
213 * Since 2.4
214 * Property Details
215 * The "active" property
216 * "active" gboolean : Read / Write
217 * If the toggle action should be active in or not.
218 * Default value: FALSE
219 * Since 2.10
221 public int getDrawAsRadio()
223 // gboolean gtk_toggle_action_get_draw_as_radio (GtkToggleAction *action);
224 return gtk_toggle_action_get_draw_as_radio(gtkToggleAction);