/usr/include/d/gtkd-3/gtk/ToggleToolButton.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 | /*
* 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.ToggleToolButton;
private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.ToolButton;
private import gtk.ToolItem;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* A #GtkToggleToolButton is a #GtkToolItem that contains a toggle
* button.
*
* Use gtk_toggle_tool_button_new() to create a new GtkToggleToolButton.
*
* # CSS nodes
*
* GtkToggleToolButton has a single CSS node with name togglebutton.
*/
public class ToggleToolButton : ToolButton
{
/** the main Gtk struct */
protected GtkToggleToolButton* gtkToggleToolButton;
/** Get the main Gtk struct */
public GtkToggleToolButton* getToggleToolButtonStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkToggleToolButton;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkToggleToolButton;
}
protected override void setStruct(GObject* obj)
{
gtkToggleToolButton = cast(GtkToggleToolButton*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkToggleToolButton* gtkToggleToolButton, bool ownedRef = false)
{
this.gtkToggleToolButton = gtkToggleToolButton;
super(cast(GtkToolButton*)gtkToggleToolButton, ownedRef);
}
/**
* Creates a new GtkToggleToolButton containing the image and text
* from a stock item.
*/
public this(StockID stockId)
{
this(cast(string)stockId);
}
/**
*/
/** */
public static GType getType()
{
return gtk_toggle_tool_button_get_type();
}
/**
* Returns a new #GtkToggleToolButton
*
* Returns: a newly created #GtkToggleToolButton
*
* Since: 2.4
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = gtk_toggle_tool_button_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkToggleToolButton*) p);
}
/**
* Creates a new #GtkToggleToolButton containing the image and text from a
* stock item. Some stock ids have preprocessor macros like #GTK_STOCK_OK
* and #GTK_STOCK_APPLY.
*
* It is an error if @stock_id is not a name of a stock item.
*
* Deprecated: Use gtk_toggle_tool_button_new() instead.
*
* Params:
* stockId = the name of the stock item
*
* Returns: A new #GtkToggleToolButton
*
* Since: 2.4
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(string stockId)
{
auto p = gtk_toggle_tool_button_new_from_stock(Str.toStringz(stockId));
if(p is null)
{
throw new ConstructionException("null returned by new_from_stock");
}
this(cast(GtkToggleToolButton*) p);
}
/**
* Queries a #GtkToggleToolButton and returns its current state.
* Returns %TRUE if the toggle button is pressed in and %FALSE if it is raised.
*
* Returns: %TRUE if the toggle tool button is pressed in, %FALSE if not
*
* Since: 2.4
*/
public bool getActive()
{
return gtk_toggle_tool_button_get_active(gtkToggleToolButton) != 0;
}
/**
* Sets the status of the toggle tool button. Set to %TRUE if you
* want the GtkToggleButton to be “pressed in”, and %FALSE to raise it.
* This action causes the toggled signal to be emitted.
*
* Params:
* isActive = whether @button should be active
*
* Since: 2.4
*/
public void setActive(bool isActive)
{
gtk_toggle_tool_button_set_active(gtkToggleToolButton, isActive);
}
protected class OnToggledDelegateWrapper
{
void delegate(ToggleToolButton) dlg;
gulong handlerId;
this(void delegate(ToggleToolButton) dlg)
{
this.dlg = dlg;
onToggledListeners ~= this;
}
void remove(OnToggledDelegateWrapper source)
{
foreach(index, wrapper; onToggledListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onToggledListeners[index] = null;
onToggledListeners = std.algorithm.remove(onToggledListeners, index);
break;
}
}
}
}
OnToggledDelegateWrapper[] onToggledListeners;
/**
* Emitted whenever the toggle tool button changes state.
*/
gulong addOnToggled(void delegate(ToggleToolButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnToggledDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"toggled",
cast(GCallback)&callBackToggled,
cast(void*)wrapper,
cast(GClosureNotify)&callBackToggledDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackToggled(GtkToggleToolButton* toggletoolbuttonStruct, OnToggledDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackToggledDestroy(OnToggledDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|