I've no idea here...
[gtkD.git] / src / gtk / CheckMenuItem.d
blob75654dc6af1aa7319153b16d323d5f05ef25db22
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 = 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 * local aliases:
52 module gtk.CheckMenuItem;
54 private import gtk.gtktypes;
56 private import lib.gtk;
58 private import glib.Str;
60 /**
61 * Description
62 * A GtkCheckMenuItem is a menu item that maintains the state of a boolean
63 * value in addition to a GtkMenuItem's usual role in activating application
64 * code.
65 * A check box indicating the state of the boolean value is displayed
66 * at the left side of the GtkMenuItem. Activating the GtkMenuItem
67 * toggles the value.
69 private import gtk.MenuItem;
70 public class CheckMenuItem : MenuItem
73 /** the main Gtk struct */
74 protected GtkCheckMenuItem* gtkCheckMenuItem;
77 public GtkCheckMenuItem* getCheckMenuItemStruct()
79 return gtkCheckMenuItem;
83 /** the main Gtk struct as a void* */
84 protected void* getStruct()
86 return cast(void*)gtkCheckMenuItem;
89 /**
90 * Sets our main struct and passes it to the parent class
92 public this (GtkCheckMenuItem* gtkCheckMenuItem)
94 super(cast(GtkMenuItem*)gtkCheckMenuItem);
95 this.gtkCheckMenuItem = gtkCheckMenuItem;
98 /**
99 * Creates a new GtkCheckMenuItem with a label.
100 * If mnemonic it true the label
101 * will be created using gtk_label_new_with_mnemonic(), so underscores
102 * in label indicate the mnemonic for the menu item.
103 * label:
104 * the string to use for the label.
105 * Returns:
106 * a new GtkCheckMenuItem.
108 public this (char[] label, bit mnemonic=true)
110 if ( mnemonic )
112 // GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label);
113 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_mnemonic(Str.toStringz(label)) );
115 else
117 // GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
118 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_label(Str.toStringz(label)) );
125 // imports for the signal processing
126 private import gobject.Signals;
127 private import gdk.gdktypes;
128 int[char[]] connectedSignals;
130 void delegate(CheckMenuItem)[] onToggledListeners;
131 void addOnToggled(void delegate(CheckMenuItem) dlg)
133 if ( !("toggled" in connectedSignals) )
135 Signals.connectData(
136 getStruct(),
137 "toggled",
138 cast(GCallback)&callBackToggled,
139 this,
140 null,
141 cast(ConnectFlags)0);
142 connectedSignals["toggled"] = 1;
144 onToggledListeners ~= dlg;
146 extern(C) static void callBackToggled(GtkCheckMenuItem* checkmenuitemStruct, CheckMenuItem checkMenuItem)
148 bit consumed = false;
150 foreach ( void delegate(CheckMenuItem) dlg ; checkMenuItem.onToggledListeners )
152 dlg(checkMenuItem);
155 return consumed;
161 * Creates a new GtkCheckMenuItem.
162 * Returns:
163 * a new GtkCheckMenuItem.
165 public this ()
167 // GtkWidget* gtk_check_menu_item_new (void);
168 this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new() );
175 * Returns whether the check menu item is active. See
176 * gtk_check_menu_item_set_active().
177 * check_menu_item:
178 * a GtkCheckMenuItem
179 * Returns:
180 * TRUE if the menu item is checked.
182 public int getActive()
184 // gboolean gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item);
185 return gtk_check_menu_item_get_active(gtkCheckMenuItem);
189 * Sets the active state of the menu item's check box.
190 * check_menu_item:
191 * a GtkCheckMenuItem.
192 * is_active:
193 * boolean value indicating whether the check box is active.
195 public void setActive(int isActive)
197 // void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item, gboolean is_active);
198 gtk_check_menu_item_set_active(gtkCheckMenuItem, isActive);
202 * Warning
203 * gtk_check_menu_item_set_show_toggle is deprecated and should not be used in newly-written code.
204 * Controls whether the check box is shown at all times.
205 * Normally the check box is shown only when it is active or while the
206 * menu item is selected.
207 * menu_item:
208 * a GtkCheckMenuItem.
209 * always:
210 * boolean value indicating whether to always show the check box.
212 public void setShowToggle(int always)
214 // void gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item, gboolean always);
215 gtk_check_menu_item_set_show_toggle(gtkCheckMenuItem, always);
219 * Emits the GtkCheckMenuItem::toggled signal.
220 * check_menu_item:
221 * a GtkCheckMenuItem.
223 public void toggled()
225 // void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
226 gtk_check_menu_item_toggled(gtkCheckMenuItem);
230 * Retrieves the value set by gtk_check_menu_item_set_inconsistent().
231 * check_menu_item:
232 * a GtkCheckMenuItem
233 * Returns:
234 * TRUE if inconsistent
236 public int getInconsistent()
238 // gboolean gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item);
239 return gtk_check_menu_item_get_inconsistent(gtkCheckMenuItem);
243 * If the user has selected a range of elements (such as some text or
244 * spreadsheet cells) that are affected by a boolean setting, and the
245 * current values in that range are inconsistent, you may want to
246 * display the check in an "in between" state. This function turns on
247 * "in between" display. Normally you would turn off the inconsistent
248 * state again if the user explicitly selects a setting. This has to be
249 * done manually, gtk_check_menu_item_set_inconsistent() only affects
250 * visual appearance, it doesn't affect the semantics of the widget.
251 * check_menu_item:
252 * a GtkCheckMenuItem
253 * setting:
254 * TRUE to display an "inconsistent" third state check
256 public void setInconsistent(int setting)
258 // void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item, gboolean setting);
259 gtk_check_menu_item_set_inconsistent(gtkCheckMenuItem, setting);
263 * Sets whether check_menu_item is drawn like a GtkRadioMenuItem
264 * check_menu_item:
265 * a GtkCheckMenuItem
266 * draw_as_radio:
267 * whether check_menu_item is drawn like a GtkRadioMenuItem
268 * Since 2.4
270 public void setDrawAsRadio(int drawAsRadio)
272 // void gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item, gboolean draw_as_radio);
273 gtk_check_menu_item_set_draw_as_radio(gtkCheckMenuItem, drawAsRadio);
277 * Returns whether check_menu_item looks like a GtkRadioMenuItem
278 * check_menu_item:
279 * a GtkCheckMenuItem
280 * Returns:
281 * Whether check_menu_item looks like a GtkRadioMenuItem
282 * Since 2.4
283 * Property Details
284 * The "active" property
285 * "active" gboolean : Read / Write
286 * Whether the menu item is checked.
287 * Default value: FALSE
289 public int getDrawAsRadio()
291 // gboolean gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item);
292 return gtk_check_menu_item_get_draw_as_radio(gtkCheckMenuItem);