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 module gtk.CellRendererAccel;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.CellRenderer;
32 private import gtk.CellRendererText;
33 public  import gtkc.gdktypes;
34 private import gtkc.gtk;
35 public  import gtkc.gtktypes;
36 
37 
38 /**
39  * #GtkCellRendererAccel displays a keyboard accelerator (i.e. a key
40  * combination like `Control + a`). If the cell renderer is editable,
41  * the accelerator can be changed by simply typing the new combination.
42  * 
43  * The #GtkCellRendererAccel cell renderer was added in GTK+ 2.10.
44  */
45 public class CellRendererAccel : CellRendererText
46 {
47 	/** the main Gtk struct */
48 	protected GtkCellRendererAccel* gtkCellRendererAccel;
49 
50 	/** Get the main Gtk struct */
51 	public GtkCellRendererAccel* getCellRendererAccelStruct()
52 	{
53 		return gtkCellRendererAccel;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected override void* getStruct()
58 	{
59 		return cast(void*)gtkCellRendererAccel;
60 	}
61 
62 	protected override void setStruct(GObject* obj)
63 	{
64 		gtkCellRendererAccel = cast(GtkCellRendererAccel*)obj;
65 		super.setStruct(obj);
66 	}
67 
68 	/**
69 	 * Sets our main struct and passes it to the parent class.
70 	 */
71 	public this (GtkCellRendererAccel* gtkCellRendererAccel, bool ownedRef = false)
72 	{
73 		this.gtkCellRendererAccel = gtkCellRendererAccel;
74 		super(cast(GtkCellRendererText*)gtkCellRendererAccel, ownedRef);
75 	}
76 
77 	/**
78 	 */
79 
80 	public static GType getType()
81 	{
82 		return gtk_cell_renderer_accel_get_type();
83 	}
84 
85 	/**
86 	 * Creates a new #GtkCellRendererAccel.
87 	 *
88 	 * Return: the new cell renderer
89 	 *
90 	 * Since: 2.10
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto p = gtk_cell_renderer_accel_new();
97 		
98 		if(p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 		
103 		this(cast(GtkCellRendererAccel*) p);
104 	}
105 
106 	int[string] connectedSignals;
107 
108 	void delegate(string, CellRendererAccel)[] onAccelClearedListeners;
109 	/**
110 	 * Gets emitted when the user has removed the accelerator.
111 	 *
112 	 * Params:
113 	 *     pathString = the path identifying the row of the edited cell
114 	 *
115 	 * Since: 2.10
116 	 */
117 	void addOnAccelCleared(void delegate(string, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
118 	{
119 		if ( "accel-cleared" !in connectedSignals )
120 		{
121 			Signals.connectData(
122 				this,
123 				"accel-cleared",
124 				cast(GCallback)&callBackAccelCleared,
125 				cast(void*)this,
126 				null,
127 				connectFlags);
128 			connectedSignals["accel-cleared"] = 1;
129 		}
130 		onAccelClearedListeners ~= dlg;
131 	}
132 	extern(C) static void callBackAccelCleared(GtkCellRendererAccel* cellrendereraccelStruct, char* pathString, CellRendererAccel _cellrendereraccel)
133 	{
134 		foreach ( void delegate(string, CellRendererAccel) dlg; _cellrendereraccel.onAccelClearedListeners )
135 		{
136 			dlg(Str.toString(pathString), _cellrendereraccel);
137 		}
138 	}
139 
140 	void delegate(string, uint, GdkModifierType, uint, CellRendererAccel)[] onAccelEditedListeners;
141 	/**
142 	 * Gets emitted when the user has selected a new accelerator.
143 	 *
144 	 * Params:
145 	 *     pathString = the path identifying the row of the edited cell
146 	 *     accelKey = the new accelerator keyval
147 	 *     accelMods = the new acclerator modifier mask
148 	 *     hardwareKeycode = the keycode of the new accelerator
149 	 *
150 	 * Since: 2.10
151 	 */
152 	void addOnAccelEdited(void delegate(string, uint, GdkModifierType, uint, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
153 	{
154 		if ( "accel-edited" !in connectedSignals )
155 		{
156 			Signals.connectData(
157 				this,
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* cellrendereraccelStruct, char* pathString, uint accelKey, GdkModifierType accelMods, uint hardwareKeycode, CellRendererAccel _cellrendereraccel)
168 	{
169 		foreach ( void delegate(string, uint, GdkModifierType, uint, CellRendererAccel) dlg; _cellrendereraccel.onAccelEditedListeners )
170 		{
171 			dlg(Str.toString(pathString), accelKey, accelMods, hardwareKeycode, _cellrendereraccel);
172 		}
173 	}
174 }