1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkCellRendererAccel.html
27  * outPack = gtk
28  * outFile = CellRendererAccel
29  * strct   = GtkCellRendererAccel
30  * realStrct=
31  * ctorStrct=GtkCellRenderer
32  * clss    = CellRendererAccel
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_cell_renderer_accel_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtk.CellRenderer
49  * structWrap:
50  * 	- GtkCellRenderer* -> CellRenderer
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gtk.CellRendererAccel;
57 
58 public  import gtkc.gtktypes;
59 
60 private import gtkc.gtk;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import gobject.Signals;
65 public  import gtkc.gdktypes;
66 
67 private import glib.Str;
68 private import gtk.CellRenderer;
69 
70 
71 
72 private import gtk.CellRendererText;
73 
74 /**
75  * Description
76  * GtkCellRendererAccel displays a keyboard accelerator (i.e. a
77  * key combination like <Control>-a). If the cell renderer is editable, the
78  * accelerator can be changed by simply typing the new combination.
79  * The GtkCellRendererAccel cell renderer was added in GTK+ 2.10.
80  */
81 public class CellRendererAccel : CellRendererText
82 {
83 	
84 	/** the main Gtk struct */
85 	protected GtkCellRendererAccel* gtkCellRendererAccel;
86 	
87 	
88 	public GtkCellRendererAccel* getCellRendererAccelStruct()
89 	{
90 		return gtkCellRendererAccel;
91 	}
92 	
93 	
94 	/** the main Gtk struct as a void* */
95 	protected override void* getStruct()
96 	{
97 		return cast(void*)gtkCellRendererAccel;
98 	}
99 	
100 	/**
101 	 * Sets our main struct and passes it to the parent class
102 	 */
103 	public this (GtkCellRendererAccel* gtkCellRendererAccel)
104 	{
105 		super(cast(GtkCellRendererText*)gtkCellRendererAccel);
106 		this.gtkCellRendererAccel = gtkCellRendererAccel;
107 	}
108 	
109 	protected override void setStruct(GObject* obj)
110 	{
111 		super.setStruct(obj);
112 		gtkCellRendererAccel = cast(GtkCellRendererAccel*)obj;
113 	}
114 	
115 	/**
116 	 */
117 	int[string] connectedSignals;
118 	
119 	void delegate(string, CellRendererAccel)[] onAccelClearedListeners;
120 	/**
121 	 * Gets emitted when the user has removed the accelerator.
122 	 * Since 2.10
123 	 */
124 	void addOnAccelCleared(void delegate(string, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
125 	{
126 		if ( !("accel-cleared" in connectedSignals) )
127 		{
128 			Signals.connectData(
129 			getStruct(),
130 			"accel-cleared",
131 			cast(GCallback)&callBackAccelCleared,
132 			cast(void*)this,
133 			null,
134 			connectFlags);
135 			connectedSignals["accel-cleared"] = 1;
136 		}
137 		onAccelClearedListeners ~= dlg;
138 	}
139 	extern(C) static void callBackAccelCleared(GtkCellRendererAccel* accelStruct, gchar* pathString, CellRendererAccel _cellRendererAccel)
140 	{
141 		foreach ( void delegate(string, CellRendererAccel) dlg ; _cellRendererAccel.onAccelClearedListeners )
142 		{
143 			dlg(Str.toString(pathString), _cellRendererAccel);
144 		}
145 	}
146 	
147 	void delegate(string, guint, GdkModifierType, guint, CellRendererAccel)[] onAccelEditedListeners;
148 	/**
149 	 * Gets emitted when the user has selected a new accelerator.
150 	 * Since 2.10
151 	 */
152 	void addOnAccelEdited(void delegate(string, guint, GdkModifierType, guint, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
153 	{
154 		if ( !("accel-edited" in connectedSignals) )
155 		{
156 			Signals.connectData(
157 			getStruct(),
158 			"accel-edited",
159 			cast(GCallback)&callBackAccelEdited,
160 			cast(void*)this,
161 			null,
162 			connectFlags);
163 			connectedSignals["accel-edited"] = 1;
164 		}
165 		onAccelEditedListeners ~= dlg;
166 	}
167 	extern(C) static void callBackAccelEdited(GtkCellRendererAccel* accelStruct, gchar* pathString, guint accelKey, GdkModifierType accelMods, guint hardwareKeycode, CellRendererAccel _cellRendererAccel)
168 	{
169 		foreach ( void delegate(string, guint, GdkModifierType, guint, CellRendererAccel) dlg ; _cellRendererAccel.onAccelEditedListeners )
170 		{
171 			dlg(Str.toString(pathString), accelKey, accelMods, hardwareKeycode, _cellRendererAccel);
172 		}
173 	}
174 	
175 	
176 	/**
177 	 * Creates a new GtkCellRendererAccel.
178 	 * Since 2.10
179 	 * Throws: ConstructionException GTK+ fails to create the object.
180 	 */
181 	public this ()
182 	{
183 		// GtkCellRenderer * gtk_cell_renderer_accel_new (void);
184 		auto p = gtk_cell_renderer_accel_new();
185 		if(p is null)
186 		{
187 			throw new ConstructionException("null returned by gtk_cell_renderer_accel_new()");
188 		}
189 		this(cast(GtkCellRendererAccel*) p);
190 	}
191 }