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 = GtkRadioAction.html
27 * outFile = RadioAction
28 * strct = GtkRadioAction
53 module gtk
.RadioAction
;
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.gtktypes
;
65 private import gtkc
.gtk
;
68 private import glib
.Str
;
69 private import glib
.ListSG
;
76 * A GtkRadioAction is similar to GtkRadioMenuItem. A number of radio
77 * actions can be linked together so that only one may be active at any
80 private import gtk
.ToggleAction
;
81 public class RadioAction
: ToggleAction
84 /** the main Gtk struct */
85 protected GtkRadioAction
* gtkRadioAction
;
88 public GtkRadioAction
* getRadioActionStruct()
90 return gtkRadioAction
;
94 /** the main Gtk struct as a void* */
95 protected void* getStruct()
97 return cast(void*)gtkRadioAction
;
101 * Sets our main struct and passes it to the parent class
103 public this (GtkRadioAction
* gtkRadioAction
)
107 if ( gtkRadioAction
is null )
112 Stdout("struct gtkRadioAction is null on constructor").newline
;
116 printf("struct gtkRadioAction is null on constructor");
123 assert(gtkRadioAction
!is null, "struct gtkRadioAction is null on constructor");
125 super(cast(GtkToggleAction
*)gtkRadioAction
);
126 this.gtkRadioAction
= gtkRadioAction
;
132 // imports for the signal processing
133 private import gobject
.Signals
;
134 private import gtkc
.gdktypes
;
135 int[char[]] connectedSignals
;
137 void delegate(GtkRadioAction
*, RadioAction
)[] onChangedListeners
;
138 void addOnChanged(void delegate(GtkRadioAction
*, RadioAction
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
140 if ( !("changed" in connectedSignals
) )
145 cast(GCallback
)&callBackChanged
,
149 connectedSignals
["changed"] = 1;
151 onChangedListeners
~= dlg
;
153 extern(C
) static void callBackChanged(GtkRadioAction
* actionStruct
, GtkRadioAction
* current
, RadioAction radioAction
)
155 bool consumed
= false;
157 foreach ( void delegate(GtkRadioAction
*, RadioAction
) dlg
; radioAction
.onChangedListeners
)
159 dlg(current
, radioAction
);
168 * Creates a new GtkRadioAction object. To add the action to
169 * a GtkActionGroup and set the accelerator for the action,
170 * call gtk_action_group_add_action_with_accel().
172 * A unique name for the action
174 * The label displayed in menu items and on buttons
176 * A tooltip for this action
178 * The stock icon to display in widgets representing this action
180 * The value which gtk_radio_action_get_current_value() should return
181 * if this action is selected.
183 * a new GtkRadioAction
186 public this (char[] name
, char[] label
, char[] tooltip
, char[] stockId
, int value
)
188 // GtkRadioAction* gtk_radio_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id, gint value);
189 this(cast(GtkRadioAction
*)gtk_radio_action_new(Str
.toStringz(name
), Str
.toStringz(label
), Str
.toStringz(tooltip
), Str
.toStringz(stockId
), value
) );
193 * Returns the list representing the radio group for this object.
194 * Note that the returned list is only valid until the next change
196 * A common way to set up a group of radio group is the following:
197 * GSList *group = NULL;
198 * GtkRadioAction *action;
199 * while (/+* more actions to add +/)
201 * action = gtk_radio_action_new (...);
202 * gtk_radio_action_set_group (action, group);
203 * group = gtk_radio_action_get_group (action);
208 * the list representing the radio group for this object
211 public ListSG
getGroup()
213 // GSList* gtk_radio_action_get_group (GtkRadioAction *action);
214 return new ListSG( gtk_radio_action_get_group(gtkRadioAction
) );
218 * Sets the radio group for the radio action object.
222 * a list representing a radio group
225 public void setGroup(ListSG group
)
227 // void gtk_radio_action_set_group (GtkRadioAction *action, GSList *group);
228 gtk_radio_action_set_group(gtkRadioAction
, (group
is null) ?
null : group
.getListSGStruct());
232 * Obtains the value property of the currently active member of
233 * the group to which action belongs.
237 * The value of the currently active group member
240 public int getCurrentValue()
242 // gint gtk_radio_action_get_current_value (GtkRadioAction *action);
243 return gtk_radio_action_get_current_value(gtkRadioAction
);
247 * Sets the currently active group member to the member with value
248 * property current_value.
255 * The "current-value" property
256 * "current-value" gint : Read / Write
257 * The value property of the currently active member of the group to which
258 * this action belongs.
262 public void setCurrentValue(int currentValue
)
264 // void gtk_radio_action_set_current_value (GtkRadioAction *action, gint current_value);
265 gtk_radio_action_set_current_value(gtkRadioAction
, currentValue
);