I've no idea here...
[gtkD.git] / src / gtk / RadioAction.d
blob3957736ef75e7fa41bbd2ec1c30add319830b45c
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 = GtkRadioAction.html
26 * outPack = gtk
27 * outFile = RadioAction
28 * strct = GtkRadioAction
29 * realStrct=
30 * ctorStrct=
31 * clss = RadioAction
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_radio_action_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - glib.ListSG
47 * structWrap:
48 * - GSList* -> ListSG
49 * local aliases:
52 module gtk.RadioAction;
54 private import gtk.gtktypes;
56 private import lib.gtk;
58 private import glib.Str;
59 private import glib.ListSG;
61 /**
62 * Description
63 * A GtkRadioAction is similar to GtkRadioMenuItem. A number of radio
64 * actions can be linked together so that only one may be active at any
65 * one time.
67 private import gtk.ToggleAction;
68 public class RadioAction : ToggleAction
71 /** the main Gtk struct */
72 protected GtkRadioAction* gtkRadioAction;
75 public GtkRadioAction* getRadioActionStruct()
77 return gtkRadioAction;
81 /** the main Gtk struct as a void* */
82 protected void* getStruct()
84 return cast(void*)gtkRadioAction;
87 /**
88 * Sets our main struct and passes it to the parent class
90 public this (GtkRadioAction* gtkRadioAction)
92 super(cast(GtkToggleAction*)gtkRadioAction);
93 this.gtkRadioAction = gtkRadioAction;
96 /**
99 // imports for the signal processing
100 private import gobject.Signals;
101 private import gdk.gdktypes;
102 int[char[]] connectedSignals;
104 void delegate(GtkRadioAction*, RadioAction)[] onChangedListeners;
105 void addOnChanged(void delegate(GtkRadioAction*, RadioAction) dlg)
107 if ( !("changed" in connectedSignals) )
109 Signals.connectData(
110 getStruct(),
111 "changed",
112 cast(GCallback)&callBackChanged,
113 this,
114 null,
115 cast(ConnectFlags)0);
116 connectedSignals["changed"] = 1;
118 onChangedListeners ~= dlg;
120 extern(C) static void callBackChanged(GtkRadioAction* actionStruct, GtkRadioAction* current, RadioAction radioAction)
122 bit consumed = false;
124 foreach ( void delegate(GtkRadioAction*, RadioAction) dlg ; radioAction.onChangedListeners )
126 dlg(current, radioAction);
129 return consumed;
135 * Creates a new GtkRadioAction object. To add the action to
136 * a GtkActionGroup and set the accelerator for the action,
137 * call gtk_action_group_add_action_with_accel().
138 * name:
139 * A unique name for the action
140 * label:
141 * The label displayed in menu items and on buttons
142 * tooltip:
143 * A tooltip for this action
144 * stock_id:
145 * The stock icon to display in widgets representing this action
146 * value:
147 * The value which gtk_radio_action_get_current_value() should return
148 * if this action is selected.
149 * Returns:
150 * a new GtkRadioAction
151 * Since 2.4
153 public this (char[] name, char[] label, char[] tooltip, char[] stockId, int value)
155 // GtkRadioAction* gtk_radio_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id, gint value);
156 this(cast(GtkRadioAction*)gtk_radio_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId), value) );
160 * Returns the list representing the radio group for this object.
161 * Note that the returned list is only valid until the next change
162 * to the group.
163 * A common way to set up a group of radio group is the following:
164 * GSList *group = NULL;
165 * GtkRadioAction *action;
166 * while (/+* more actions to add +/)
168 * action = gtk_radio_action_new (...);
169 * gtk_radio_action_set_group (action, group);
170 * group = gtk_radio_action_get_group (action);
172 * action:
173 * the action object
174 * Returns:
175 * the list representing the radio group for this object
176 * Since 2.4
178 public ListSG getGroup()
180 // GSList* gtk_radio_action_get_group (GtkRadioAction *action);
181 return new ListSG( gtk_radio_action_get_group(gtkRadioAction) );
185 * Sets the radio group for the radio action object.
186 * action:
187 * the action object
188 * group:
189 * a list representing a radio group
190 * Since 2.4
192 public void setGroup(ListSG group)
194 // void gtk_radio_action_set_group (GtkRadioAction *action, GSList *group);
195 gtk_radio_action_set_group(gtkRadioAction, (group is null) ? null : group.getListSGStruct());
199 * Obtains the value property of the currently active member of
200 * the group to which action belongs.
201 * action:
202 * a GtkRadioAction
203 * Returns:
204 * The value of the currently active group member
205 * Since 2.4
207 public int getCurrentValue()
209 // gint gtk_radio_action_get_current_value (GtkRadioAction *action);
210 return gtk_radio_action_get_current_value(gtkRadioAction);
214 * Sets the currently active group member to the member with value
215 * property current_value.
216 * action:
217 * a GtkRadioAction
218 * current_value:
219 * the new value
220 * Since 2.10
221 * Property Details
222 * The "current-value" property
223 * "current-value" gint : Read / Write
224 * The value property of the currently active member of the group to which
225 * this action belongs.
226 * Default value: 0
227 * Since 2.10
229 public void setCurrentValue(int currentValue)
231 // void gtk_radio_action_set_current_value (GtkRadioAction *action, gint current_value);
232 gtk_radio_action_set_current_value(gtkRadioAction, currentValue);