/usr/include/d/gtkd-3/gtk/RadioAction.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.RadioAction;
private import glib.ConstructionException;
private import glib.ListSG;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.ToggleAction;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* A #GtkRadioAction is similar to #GtkRadioMenuItem. A number of radio
* actions can be linked together so that only one may be active at any
* one time.
*/
public class RadioAction : ToggleAction
{
/** the main Gtk struct */
protected GtkRadioAction* gtkRadioAction;
/** Get the main Gtk struct */
public GtkRadioAction* getRadioActionStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkRadioAction;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkRadioAction;
}
protected override void setStruct(GObject* obj)
{
gtkRadioAction = cast(GtkRadioAction*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkRadioAction* gtkRadioAction, bool ownedRef = false)
{
this.gtkRadioAction = gtkRadioAction;
super(cast(GtkToggleAction*)gtkRadioAction, ownedRef);
}
/**
* Creates a new RadioAction object. To add the action to
* a ActionGroup and set the accelerator for the action,
* call gtk.ActionGroup.ActionGroup.addActionWithAccel().
*
* Since: 2.4
*
* Params:
* name = A unique name for the action
* label = The label displayed in menu items and on buttons, or null
* tooltip = A tooltip for this action, or null
* stockId = The stock icon to display in widgets representing this
* action, or null
* value = The value which getCurrentValue() should
* return if this action is selected.
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this (string name, string label, string tooltip, StockID stockId, int value)
{
this(name, label, tooltip, cast(string)stockId, value);
}
/**
*/
/** */
public static GType getType()
{
return gtk_radio_action_get_type();
}
/**
* Creates a new #GtkRadioAction object. To add the action to
* a #GtkActionGroup and set the accelerator for the action,
* call gtk_action_group_add_action_with_accel().
*
* Params:
* name = A unique name for the action
* label = The label displayed in menu items and on buttons,
* or %NULL
* tooltip = A tooltip for this action, or %NULL
* stockId = The stock icon to display in widgets representing
* this action, or %NULL
* value = The value which gtk_radio_action_get_current_value() should
* return if this action is selected.
*
* Returns: a new #GtkRadioAction
*
* Since: 2.4
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(string name, string label, string tooltip, string stockId, int value)
{
auto p = gtk_radio_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId), value);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkRadioAction*) p, true);
}
/**
* Obtains the value property of the currently active member of
* the group to which @action belongs.
*
* Returns: The value of the currently active group member
*
* Since: 2.4
*/
public int getCurrentValue()
{
return gtk_radio_action_get_current_value(gtkRadioAction);
}
/**
* Returns the list representing the radio group for this object.
* Note that the returned list is only valid until the next change
* to the group.
*
* A common way to set up a group of radio group is the following:
* |[<!-- language="C" -->
* GSList *group = NULL;
* GtkRadioAction *action;
*
* while ( ...more actions to add... /)
* {
* action = gtk_radio_action_new (...);
*
* gtk_radio_action_set_group (action, group);
* group = gtk_radio_action_get_group (action);
* }
* ]|
*
* Returns: the list representing the radio group for this object
*
* Since: 2.4
*/
public ListSG getGroup()
{
auto p = gtk_radio_action_get_group(gtkRadioAction);
if(p is null)
{
return null;
}
return new ListSG(cast(GSList*) p);
}
/**
* Joins a radio action object to the group of another radio action object.
*
* Use this in language bindings instead of the gtk_radio_action_get_group()
* and gtk_radio_action_set_group() methods
*
* A common way to set up a group of radio actions is the following:
* |[<!-- language="C" -->
* GtkRadioAction *action;
* GtkRadioAction *last_action;
*
* while ( ...more actions to add... /)
* {
* action = gtk_radio_action_new (...);
*
* gtk_radio_action_join_group (action, last_action);
* last_action = action;
* }
* ]|
*
* Params:
* groupSource = a radio action object whos group we are
* joining, or %NULL to remove the radio action from its group
*
* Since: 3.0
*/
public void joinGroup(RadioAction groupSource)
{
gtk_radio_action_join_group(gtkRadioAction, (groupSource is null) ? null : groupSource.getRadioActionStruct());
}
/**
* Sets the currently active group member to the member with value
* property @current_value.
*
* Params:
* currentValue = the new value
*
* Since: 2.10
*/
public void setCurrentValue(int currentValue)
{
gtk_radio_action_set_current_value(gtkRadioAction, currentValue);
}
/**
* Sets the radio group for the radio action object.
*
* Params:
* group = a list representing a radio group, or %NULL
*
* Since: 2.4
*/
public void setGroup(ListSG group)
{
gtk_radio_action_set_group(gtkRadioAction, (group is null) ? null : group.getListSGStruct());
}
protected class OnChangedDelegateWrapper
{
void delegate(RadioAction, RadioAction) dlg;
gulong handlerId;
this(void delegate(RadioAction, RadioAction) dlg)
{
this.dlg = dlg;
onChangedListeners ~= this;
}
void remove(OnChangedDelegateWrapper source)
{
foreach(index, wrapper; onChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onChangedListeners[index] = null;
onChangedListeners = std.algorithm.remove(onChangedListeners, index);
break;
}
}
}
}
OnChangedDelegateWrapper[] onChangedListeners;
/**
* The ::changed signal is emitted on every member of a radio group when the
* active member is changed. The signal gets emitted after the ::activate signals
* for the previous and current active members.
*
* Params:
* current = the member of @action's group which has just been activated
*
* Since: 2.4
*/
gulong addOnChanged(void delegate(RadioAction, RadioAction) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"changed",
cast(GCallback)&callBackChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackChanged(GtkRadioAction* radioactionStruct, GtkRadioAction* current, OnChangedDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(RadioAction)(current), wrapper.outer);
}
extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|