I've no idea here...
[gtkD.git] / src / gtk / RadioMenuItem.d
blob02989b09b1480a6eb6449002ccd74e2cc6edd630
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 = GtkRadioMenuItem.html
26 * outPack = gtk
27 * outFile = RadioMenuItem
28 * strct = GtkRadioMenuItem
29 * realStrct=
30 * ctorStrct=
31 * clss = RadioMenuItem
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_radio_menu_item_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_radio_menu_item_new_with_label
45 * - gtk_radio_menu_item_new_with_mnemonic
46 * - gtk_radio_menu_item_new_with_mnemonic_from_widget
47 * - gtk_radio_menu_item_new_with_label_from_widget
48 * imports:
49 * - glib.Str
50 * - glib.ListSG
51 * structWrap:
52 * - GSList* -> ListSG
53 * local aliases:
56 module gtk.RadioMenuItem;
58 private import gtk.gtktypes;
60 private import lib.gtk;
62 private import glib.Str;
63 private import glib.ListSG;
65 /**
66 * Description
67 * A radio menu item is a check menu item that belongs to a group. At each
68 * instant exactly one of the radio menu items from a group is selected.
69 * The group list does not need to be freed, as each GtkRadioMenuItem will
70 * remove itself and its list item when it is destroyed.
71 * The correct way to create a group of radio menu items is approximatively
72 * this:
73 * Example3.How to create a group of radio menu items.
74 * GSList *group = NULL;
75 * GtkWidget *item;
76 * gint i;
77 * for (i = 0; i < 5; i++)
78 * {
79 * item = gtk_radio_menu_item_new_with_label (group, "This is an example");
80 * group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
81 * if (i == 1)
82 * gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
83 * }
85 private import gtk.CheckMenuItem;
86 public class RadioMenuItem : CheckMenuItem
89 /** the main Gtk struct */
90 protected GtkRadioMenuItem* gtkRadioMenuItem;
93 public GtkRadioMenuItem* getRadioMenuItemStruct()
95 return gtkRadioMenuItem;
99 /** the main Gtk struct as a void* */
100 protected void* getStruct()
102 return cast(void*)gtkRadioMenuItem;
106 * Sets our main struct and passes it to the parent class
108 public this (GtkRadioMenuItem* gtkRadioMenuItem)
110 super(cast(GtkCheckMenuItem*)gtkRadioMenuItem);
111 this.gtkRadioMenuItem = gtkRadioMenuItem;
115 * Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
116 * The new GtkRadioMenuItem is added to the same group as group.
117 * If mnemonic is true the label will be
118 * created using gtk_label_new_with_mnemonic(), so underscores in label
119 * indicate the mnemonic for the menu item.
120 * group:
121 * an existing GtkRadioMenuItem
122 * label:
123 * the text for the label
124 * Returns:
125 * The new GtkRadioMenuItem
126 * Since 2.4
128 public this (RadioMenuItem radioMenuItem, char[] label, bit mnemonic=true)
130 if ( mnemonic )
132 // GtkWidget* gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group, const gchar *label);
133 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_mnemonic_from_widget(
134 radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label)) );
136 else
138 // GtkWidget* gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group, const gchar *label);
139 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_label_from_widget(
140 radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label)) );
145 * Creates a new GtkRadioMenuItem containing a label. T
146 * The new GtkRadioMenuItem is added to the same group as group.
147 * group:
148 * An existing GtkRadioMenuItem
149 * label:
150 * the text of the button, with an underscore in front of the
151 * mnemonic character
152 * Returns:
153 * The new GtkRadioMenuItem
154 * Since 2.4
156 public this (char[] label)
161 * Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
162 * If mnemonic is true the label
163 * will be created using gtk_label_new_with_mnemonic(), so underscores
164 * in label indicate the mnemonic for the menu item.
165 * group:
166 * the group to which the radio menu item is to be attached
167 * label:
168 * the text for the label
169 * Returns:
170 * a new GtkRadioMenuItem
172 public this (ListSG group, char[] label, bit mnemonic=true)
174 if ( mnemonic )
176 // GtkWidget* gtk_radio_menu_item_new_with_mnemonic (GSList *group, const gchar *label);
177 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_mnemonic(
178 group is null ? null : group.getListSGStruct(), Str.toStringz(label)) );
180 else
182 // GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group, const gchar *label);
183 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_label(
184 group is null ? null : group.getListSGStruct(), Str.toStringz(label)) );
191 // imports for the signal processing
192 private import gobject.Signals;
193 private import gdk.gdktypes;
194 int[char[]] connectedSignals;
196 void delegate(RadioMenuItem)[] onGroupChangedListeners;
197 void addOnGroupChanged(void delegate(RadioMenuItem) dlg)
199 if ( !("group-changed" in connectedSignals) )
201 Signals.connectData(
202 getStruct(),
203 "group-changed",
204 cast(GCallback)&callBackGroupChanged,
205 this,
206 null,
207 cast(ConnectFlags)0);
208 connectedSignals["group-changed"] = 1;
210 onGroupChangedListeners ~= dlg;
212 extern(C) static void callBackGroupChanged(GtkRadioMenuItem* radiomenuitemStruct, RadioMenuItem radioMenuItem)
214 bit consumed = false;
216 foreach ( void delegate(RadioMenuItem) dlg ; radioMenuItem.onGroupChangedListeners )
218 dlg(radioMenuItem);
221 return consumed;
227 * Creates a new GtkRadioMenuItem.
228 * group:
229 * the group to which the radio menu item is to be attached
230 * Returns:
231 * a new GtkRadioMenuItem
233 public this (ListSG group)
235 // GtkWidget* gtk_radio_menu_item_new (GSList *group);
236 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new((group is null) ? null : group.getListSGStruct()) );
242 * Creates a new GtkRadioMenuItem adding it to the same group as group.
243 * group:
244 * An existing GtkRadioMenuItem
245 * Returns:
246 * The new GtkRadioMenuItem
247 * Since 2.4
249 public this ()
251 // GtkWidget* gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);
252 this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_from_widget(gtkRadioMenuItem) );
259 * Sets the group of a radio menu item, or changes it.
260 * radio_menu_item:
261 * a GtkRadioMenuItem.
262 * group:
263 * the new group.
265 public void setGroup(ListSG group)
267 // void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item, GSList *group);
268 gtk_radio_menu_item_set_group(gtkRadioMenuItem, (group is null) ? null : group.getListSGStruct());
272 * Returns the group to which the radio menu item belongs, as a GList of
273 * GtkRadioMenuItem. The list belongs to GTK+ and should not be freed.
274 * radio_menu_item:
275 * a GtkRadioMenuItem.
276 * Returns:
277 * the group of radio_menu_item.
278 * Property Details
279 * The "group" property
280 * "group" GtkRadioMenuItem : Write
281 * The radio menu item whose group this widget belongs to.
282 * Since 2.8
283 * Signal Details
284 * The "group-changed" signal
285 * void user_function (GtkRadioMenuItem *radiomenuitem,
286 * gpointer user_data) : Run first
287 * radiomenuitem:
288 * the object which received the signal.
289 * user_data:
290 * user data set when the signal handler was connected.
291 * See Also
292 * GtkMenuItem
293 * because a radio menu item is a menu item.
294 * GtkCheckMenuItem
295 * to know how to handle the check.
297 public ListSG getGroup()
299 // GSList* gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item);
300 return new ListSG( gtk_radio_menu_item_get_group(gtkRadioMenuItem) );