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 = GtkRadioMenuItem.html
27 * outFile = RadioMenuItem
28 * strct = GtkRadioMenuItem
31 * clss = RadioMenuItem
39 * - gtk_radio_menu_item_
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
57 module gtk
.RadioMenuItem
;
63 import tango
.io
.Stdout
; // use the tango loging?
67 private import gtkc
.gtktypes
;
69 private import gtkc
.gtk
;
72 private import glib
.Str
;
73 private import glib
.ListSG
;
80 * A radio menu item is a check menu item that belongs to a group. At each
81 * instant exactly one of the radio menu items from a group is selected.
82 * The group list does not need to be freed, as each GtkRadioMenuItem will
83 * remove itself and its list item when it is destroyed.
84 * The correct way to create a group of radio menu items is approximatively
86 * Example3.How to create a group of radio menu items.
87 * GSList *group = NULL;
90 * for (i = 0; i < 5; i++)
92 * item = gtk_radio_menu_item_new_with_label (group, "This is an example");
93 * group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
95 * gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
98 private import gtk
.CheckMenuItem
;
99 public class RadioMenuItem
: CheckMenuItem
102 /** the main Gtk struct */
103 protected GtkRadioMenuItem
* gtkRadioMenuItem
;
106 public GtkRadioMenuItem
* getRadioMenuItemStruct()
108 return gtkRadioMenuItem
;
112 /** the main Gtk struct as a void* */
113 protected void* getStruct()
115 return cast(void*)gtkRadioMenuItem
;
119 * Sets our main struct and passes it to the parent class
121 public this (GtkRadioMenuItem
* gtkRadioMenuItem
)
125 if ( gtkRadioMenuItem
is null )
130 Stdout("struct gtkRadioMenuItem is null on constructor").newline
;
134 printf("struct gtkRadioMenuItem is null on constructor");
141 assert(gtkRadioMenuItem
!is null, "struct gtkRadioMenuItem is null on constructor");
143 super(cast(GtkCheckMenuItem
*)gtkRadioMenuItem
);
144 this.gtkRadioMenuItem
= gtkRadioMenuItem
;
148 * Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
149 * The new GtkRadioMenuItem is added to the same group as group.
150 * If mnemonic is true the label will be
151 * created using gtk_label_new_with_mnemonic(), so underscores in label
152 * indicate the mnemonic for the menu item.
154 * an existing GtkRadioMenuItem
156 * the text for the label
158 * The new GtkRadioMenuItem
161 public this (RadioMenuItem radioMenuItem
, char[] label
, bool mnemonic
=true)
165 // GtkWidget* gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group, const gchar *label);
166 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new_with_mnemonic_from_widget(
167 radioMenuItem
.getRadioMenuItemStruct(), Str
.toStringz(label
)) );
171 // GtkWidget* gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group, const gchar *label);
172 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new_with_label_from_widget(
173 radioMenuItem
.getRadioMenuItemStruct(), Str
.toStringz(label
)) );
178 * Creates a new GtkRadioMenuItem containing a label. T
179 * The new GtkRadioMenuItem is added to the same group as group.
181 * An existing GtkRadioMenuItem
183 * the text of the button, with an underscore in front of the
186 * The new GtkRadioMenuItem
189 public this (char[] label
)
194 * Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
195 * If mnemonic is true the label
196 * will be created using gtk_label_new_with_mnemonic(), so underscores
197 * in label indicate the mnemonic for the menu item.
199 * the group to which the radio menu item is to be attached
201 * the text for the label
203 * a new GtkRadioMenuItem
205 public this (ListSG group
, char[] label
, bool mnemonic
=true)
209 // GtkWidget* gtk_radio_menu_item_new_with_mnemonic (GSList *group, const gchar *label);
210 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new_with_mnemonic(
211 group
is null ?
null : group
.getListSGStruct(), Str
.toStringz(label
)) );
215 // GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group, const gchar *label);
216 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new_with_label(
217 group
is null ?
null : group
.getListSGStruct(), Str
.toStringz(label
)) );
224 // imports for the signal processing
225 private import gobject
.Signals
;
226 private import gtkc
.gdktypes
;
227 int[char[]] connectedSignals
;
229 void delegate(RadioMenuItem
)[] onGroupChangedListeners
;
230 void addOnGroupChanged(void delegate(RadioMenuItem
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
232 if ( !("group-changed" in connectedSignals
) )
237 cast(GCallback
)&callBackGroupChanged
,
241 connectedSignals
["group-changed"] = 1;
243 onGroupChangedListeners
~= dlg
;
245 extern(C
) static void callBackGroupChanged(GtkRadioMenuItem
* radiomenuitemStruct
, RadioMenuItem radioMenuItem
)
247 bool consumed
= false;
249 foreach ( void delegate(RadioMenuItem
) dlg
; radioMenuItem
.onGroupChangedListeners
)
260 * Creates a new GtkRadioMenuItem.
262 * the group to which the radio menu item is to be attached
264 * a new GtkRadioMenuItem
266 public this (ListSG group
)
268 // GtkWidget* gtk_radio_menu_item_new (GSList *group);
269 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new((group
is null) ?
null : group
.getListSGStruct()) );
275 * Creates a new GtkRadioMenuItem adding it to the same group as group.
277 * An existing GtkRadioMenuItem
279 * The new GtkRadioMenuItem
284 // GtkWidget* gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);
285 this(cast(GtkRadioMenuItem
*)gtk_radio_menu_item_new_from_widget(gtkRadioMenuItem
) );
292 * Sets the group of a radio menu item, or changes it.
294 * a GtkRadioMenuItem.
298 public void setGroup(ListSG group
)
300 // void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item, GSList *group);
301 gtk_radio_menu_item_set_group(gtkRadioMenuItem
, (group
is null) ?
null : group
.getListSGStruct());
305 * Returns the group to which the radio menu item belongs, as a GList of
306 * GtkRadioMenuItem. The list belongs to GTK+ and should not be freed.
308 * a GtkRadioMenuItem.
310 * the group of radio_menu_item.
312 * The "group" property
313 * "group" GtkRadioMenuItem : Write
314 * The radio menu item whose group this widget belongs to.
317 * The "group-changed" signal
318 * void user_function (GtkRadioMenuItem *radiomenuitem,
319 * gpointer user_data) : Run First
321 * the object which received the signal.
323 * user data set when the signal handler was connected.
326 * because a radio menu item is a menu item.
328 * to know how to handle the check.
330 public ListSG
getGroup()
332 // GSList* gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item);
333 return new ListSG( gtk_radio_menu_item_get_group(gtkRadioMenuItem
) );