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