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  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gtk.CellRendererAccel;
54 
55 public  import gtkc.gtktypes;
56 
57 private import gtkc.gtk;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 private import gobject.Signals;
62 public  import gtkc.gdktypes;
63 
64 private import glib.Str;
65 
66 
67 
68 private import gtk.CellRendererText;
69 
70 /**
71  * GtkCellRendererAccel displays a keyboard accelerator (i.e. a
72  * key combination like Control+a.
73  * If the cell renderer is editable, the accelerator can be changed by
74  * simply typing the new combination.
75  *
76  * The GtkCellRendererAccel cell renderer was added in GTK+ 2.10.
77  */
78 public class CellRendererAccel : CellRendererText
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GtkCellRendererAccel* gtkCellRendererAccel;
83 	
84 	
85 	public GtkCellRendererAccel* getCellRendererAccelStruct()
86 	{
87 		return gtkCellRendererAccel;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gtkCellRendererAccel;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GtkCellRendererAccel* gtkCellRendererAccel)
101 	{
102 		super(cast(GtkCellRendererText*)gtkCellRendererAccel);
103 		this.gtkCellRendererAccel = gtkCellRendererAccel;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		gtkCellRendererAccel = cast(GtkCellRendererAccel*)obj;
110 	}
111 	
112 	/**
113 	 */
114 	int[string] connectedSignals;
115 	
116 	void delegate(string, CellRendererAccel)[] onAccelClearedListeners;
117 	/**
118 	 * Gets emitted when the user has removed the accelerator.
119 	 * Since 2.10
120 	 */
121 	void addOnAccelCleared(void delegate(string, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
122 	{
123 		if ( !("accel-cleared" in connectedSignals) )
124 		{
125 			Signals.connectData(
126 			getStruct(),
127 			"accel-cleared",
128 			cast(GCallback)&callBackAccelCleared,
129 			cast(void*)this,
130 			null,
131 			connectFlags);
132 			connectedSignals["accel-cleared"] = 1;
133 		}
134 		onAccelClearedListeners ~= dlg;
135 	}
136 	extern(C) static void callBackAccelCleared(GtkCellRendererAccel* accelStruct, gchar* pathString, CellRendererAccel _cellRendererAccel)
137 	{
138 		foreach ( void delegate(string, CellRendererAccel) dlg ; _cellRendererAccel.onAccelClearedListeners )
139 		{
140 			dlg(Str.toString(pathString), _cellRendererAccel);
141 		}
142 	}
143 	
144 	void delegate(string, guint, GdkModifierType, guint, CellRendererAccel)[] onAccelEditedListeners;
145 	/**
146 	 * Gets emitted when the user has selected a new accelerator.
147 	 * Since 2.10
148 	 */
149 	void addOnAccelEdited(void delegate(string, guint, GdkModifierType, guint, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
150 	{
151 		if ( !("accel-edited" in connectedSignals) )
152 		{
153 			Signals.connectData(
154 			getStruct(),
155 			"accel-edited",
156 			cast(GCallback)&callBackAccelEdited,
157 			cast(void*)this,
158 			null,
159 			connectFlags);
160 			connectedSignals["accel-edited"] = 1;
161 		}
162 		onAccelEditedListeners ~= dlg;
163 	}
164 	extern(C) static void callBackAccelEdited(GtkCellRendererAccel* accelStruct, gchar* pathString, guint accelKey, GdkModifierType accelMods, guint hardwareKeycode, CellRendererAccel _cellRendererAccel)
165 	{
166 		foreach ( void delegate(string, guint, GdkModifierType, guint, CellRendererAccel) dlg ; _cellRendererAccel.onAccelEditedListeners )
167 		{
168 			dlg(Str.toString(pathString), accelKey, accelMods, hardwareKeycode, _cellRendererAccel);
169 		}
170 	}
171 	
172 	
173 	/**
174 	 * Creates a new GtkCellRendererAccel.
175 	 * Since 2.10
176 	 * Throws: ConstructionException GTK+ fails to create the object.
177 	 */
178 	public this ()
179 	{
180 		// GtkCellRenderer * gtk_cell_renderer_accel_new (void);
181 		auto p = gtk_cell_renderer_accel_new();
182 		if(p is null)
183 		{
184 			throw new ConstructionException("null returned by gtk_cell_renderer_accel_new()");
185 		}
186 		this(cast(GtkCellRendererAccel*) p);
187 	}
188 }