Wrote the README_GIT file to be a proper tutorial on git, repo.or.cz and gtkD.
[gtkD.git] / gtkD / src / gtk / CheckMenuItem.d
blob9e1162e92a8b30d534bc0430bc598330f4db7a93
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 = GtkCheckMenuItem.html
26 * outPack = gtk
27 * outFile = CheckMenuItem
28 * strct = GtkCheckMenuItem
29 * realStrct=
30 * ctorStrct=
31 * clss = CheckMenuItem
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_check_menu_item_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_check_menu_item_new_with_label
45 * - gtk_check_menu_item_new_with_mnemonic
46 * imports:
47 * - glib.Str
48 * structWrap:
49 * module aliases:
50 * local aliases:
53 module gtk.CheckMenuItem;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gtktypes;
65 private import gtkc.gtk;
68 private import glib.Str;
73 /**
74 * Description
75 * A GtkCheckMenuItem is a menu item that maintains the state of a boolean
76 * value in addition to a GtkMenuItem's usual role in activating application
77 * code.
78 * A check box indicating the state of the boolean value is displayed
79 * at the left side of the GtkMenuItem. Activating the GtkMenuItem
80 * toggles the value.
82 private import gtk.MenuItem;
83 public class CheckMenuItem : MenuItem
86 /** the main Gtk struct */
87 protected GtkCheckMenuItem* gtkCheckMenuItem;
90 public GtkCheckMenuItem* getCheckMenuItemStruct()
92 return gtkCheckMenuItem;
96 /** the main Gtk struct as a void* */
97 protected void* getStruct()
99 return cast(void*)gtkCheckMenuItem;
103 * Sets our main struct and passes it to the parent class
105 public this (GtkCheckMenuItem* gtkCheckMenuItem)
107 version(noAssert)
109 if ( gtkCheckMenuItem is null )
111 int zero = 0;
112 version(Tango)
114 Stdout("struct gtkCheckMenuItem is null on constructor").newline;
116 else
118 printf("struct gtkCheckMenuItem is null on constructor");
120 zero = zero / zero;
123 else
125 assert(gtkCheckMenuItem !is null, "struct gtkCheckMenuItem is null on constructor");
127 super(cast(GtkMenuItem*)gtkCheckMenuItem);
128 this.gtkCheckMenuItem = gtkCheckMenuItem;
132 * Creates a new GtkCheckMenuItem with a label.
133 * If mnemonic it true the label
134 * will be created using gtk_label_new_with_mnemonic(), so underscores
135 * in label indicate the mnemonic for the menu item.
136 * label:
137 * the string to use for the label.
138 * Returns:
139 * a new GtkCheckMenuItem.
141 public this (char[] label, bool mnemonic=true)
143 if ( mnemonic )
145 // GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label);
146 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_mnemonic(Str.toStringz(label)) );
148 else
150 // GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
151 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_label(Str.toStringz(label)) );
158 // imports for the signal processing
159 private import gobject.Signals;
160 private import gtkc.gdktypes;
161 int[char[]] connectedSignals;
163 void delegate(CheckMenuItem)[] onToggledListeners;
164 void addOnToggled(void delegate(CheckMenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
166 if ( !("toggled" in connectedSignals) )
168 Signals.connectData(
169 getStruct(),
170 "toggled",
171 cast(GCallback)&callBackToggled,
172 cast(void*)this,
173 null,
174 connectFlags);
175 connectedSignals["toggled"] = 1;
177 onToggledListeners ~= dlg;
179 extern(C) static void callBackToggled(GtkCheckMenuItem* checkmenuitemStruct, CheckMenuItem checkMenuItem)
181 bool consumed = false;
183 foreach ( void delegate(CheckMenuItem) dlg ; checkMenuItem.onToggledListeners )
185 dlg(checkMenuItem);
188 return consumed;
194 * Creates a new GtkCheckMenuItem.
195 * Returns:
196 * a new GtkCheckMenuItem.
198 public this ()
200 // GtkWidget* gtk_check_menu_item_new (void);
201 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new() );
208 * Returns whether the check menu item is active. See
209 * gtk_check_menu_item_set_active().
210 * check_menu_item:
211 * a GtkCheckMenuItem
212 * Returns:
213 * TRUE if the menu item is checked.
215 public int getActive()
217 // gboolean gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item);
218 return gtk_check_menu_item_get_active(gtkCheckMenuItem);
222 * Sets the active state of the menu item's check box.
223 * check_menu_item:
224 * a GtkCheckMenuItem.
225 * is_active:
226 * boolean value indicating whether the check box is active.
228 public void setActive(int isActive)
230 // void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item, gboolean is_active);
231 gtk_check_menu_item_set_active(gtkCheckMenuItem, isActive);
235 * Warning
236 * gtk_check_menu_item_set_show_toggle is deprecated and should not be used in newly-written code.
237 * Controls whether the check box is shown at all times.
238 * Normally the check box is shown only when it is active or while the
239 * menu item is selected.
240 * menu_item:
241 * a GtkCheckMenuItem.
242 * always:
243 * boolean value indicating whether to always show the check box.
245 public void setShowToggle(int always)
247 // void gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item, gboolean always);
248 gtk_check_menu_item_set_show_toggle(gtkCheckMenuItem, always);
252 * Emits the GtkCheckMenuItem::toggled signal.
253 * check_menu_item:
254 * a GtkCheckMenuItem.
256 public void toggled()
258 // void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
259 gtk_check_menu_item_toggled(gtkCheckMenuItem);
263 * Retrieves the value set by gtk_check_menu_item_set_inconsistent().
264 * check_menu_item:
265 * a GtkCheckMenuItem
266 * Returns:
267 * TRUE if inconsistent
269 public int getInconsistent()
271 // gboolean gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item);
272 return gtk_check_menu_item_get_inconsistent(gtkCheckMenuItem);
276 * If the user has selected a range of elements (such as some text or
277 * spreadsheet cells) that are affected by a boolean setting, and the
278 * current values in that range are inconsistent, you may want to
279 * display the check in an "in between" state. This function turns on
280 * "in between" display. Normally you would turn off the inconsistent
281 * state again if the user explicitly selects a setting. This has to be
282 * done manually, gtk_check_menu_item_set_inconsistent() only affects
283 * visual appearance, it doesn't affect the semantics of the widget.
284 * check_menu_item:
285 * a GtkCheckMenuItem
286 * setting:
287 * TRUE to display an "inconsistent" third state check
289 public void setInconsistent(int setting)
291 // void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item, gboolean setting);
292 gtk_check_menu_item_set_inconsistent(gtkCheckMenuItem, setting);
296 * Sets whether check_menu_item is drawn like a GtkRadioMenuItem
297 * check_menu_item:
298 * a GtkCheckMenuItem
299 * draw_as_radio:
300 * whether check_menu_item is drawn like a GtkRadioMenuItem
301 * Since 2.4
303 public void setDrawAsRadio(int drawAsRadio)
305 // void gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item, gboolean draw_as_radio);
306 gtk_check_menu_item_set_draw_as_radio(gtkCheckMenuItem, drawAsRadio);
310 * Returns whether check_menu_item looks like a GtkRadioMenuItem
311 * check_menu_item:
312 * a GtkCheckMenuItem
313 * Returns:
314 * Whether check_menu_item looks like a GtkRadioMenuItem
315 * Since 2.4
316 * Property Details
317 * The "active" property
318 * "active" gboolean : Read / Write
319 * Whether the menu item is checked.
320 * Default value: FALSE
322 public int getDrawAsRadio()
324 // gboolean gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item);
325 return gtk_check_menu_item_get_draw_as_radio(gtkCheckMenuItem);