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 	public static GType getType()
80 	{
81 		return gtk_cell_renderer_accel_get_type();
82 	}
83 
84 	/**
85 	 * Creates a new #GtkCellRendererAccel.
86 	 *
87 	 * Return: the new cell renderer
88 	 *
89 	 * Since: 2.10
90 	 *
91 	 * Throws: ConstructionException GTK+ fails to create the object.
92 	 */
93 	public this()
94 	{
95 		auto p = gtk_cell_renderer_accel_new();
96 		
97 		if(p is null)
98 		{
99 			throw new ConstructionException("null returned by new");
100 		}
101 		
102 		this(cast(GtkCellRendererAccel*) p);
103 	}
104 
105 	int[string] connectedSignals;
106 
107 	void delegate(string, CellRendererAccel)[] onAccelClearedListeners;
108 	/**
109 	 * Gets emitted when the user has removed the accelerator.
110 	 *
111 	 * Params:
112 	 *     pathString = the path identifying the row of the edited cell
113 	 *
114 	 * Since: 2.10
115 	 */
116 	void addOnAccelCleared(void delegate(string, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
117 	{
118 		if ( "accel-cleared" !in connectedSignals )
119 		{
120 			Signals.connectData(
121 				this,
122 				"accel-cleared",
123 				cast(GCallback)&callBackAccelCleared,
124 				cast(void*)this,
125 				null,
126 				connectFlags);
127 			connectedSignals["accel-cleared"] = 1;
128 		}
129 		onAccelClearedListeners ~= dlg;
130 	}
131 	extern(C) static void callBackAccelCleared(GtkCellRendererAccel* cellrendereraccelStruct, char* pathString, CellRendererAccel _cellrendereraccel)
132 	{
133 		foreach ( void delegate(string, CellRendererAccel) dlg; _cellrendereraccel.onAccelClearedListeners )
134 		{
135 			dlg(Str.toString(pathString), _cellrendereraccel);
136 		}
137 	}
138 
139 	void delegate(string, uint, GdkModifierType, uint, CellRendererAccel)[] onAccelEditedListeners;
140 	/**
141 	 * Gets emitted when the user has selected a new accelerator.
142 	 *
143 	 * Params:
144 	 *     pathString = the path identifying the row of the edited cell
145 	 *     accelKey = the new accelerator keyval
146 	 *     accelMods = the new acclerator modifier mask
147 	 *     hardwareKeycode = the keycode of the new accelerator
148 	 *
149 	 * Since: 2.10
150 	 */
151 	void addOnAccelEdited(void delegate(string, uint, GdkModifierType, uint, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
152 	{
153 		if ( "accel-edited" !in connectedSignals )
154 		{
155 			Signals.connectData(
156 				this,
157 				"accel-edited",
158 				cast(GCallback)&callBackAccelEdited,
159 				cast(void*)this,
160 				null,
161 				connectFlags);
162 			connectedSignals["accel-edited"] = 1;
163 		}
164 		onAccelEditedListeners ~= dlg;
165 	}
166 	extern(C) static void callBackAccelEdited(GtkCellRendererAccel* cellrendereraccelStruct, char* pathString, uint accelKey, GdkModifierType accelMods, uint hardwareKeycode, CellRendererAccel _cellrendereraccel)
167 	{
168 		foreach ( void delegate(string, uint, GdkModifierType, uint, CellRendererAccel) dlg; _cellrendereraccel.onAccelEditedListeners )
169 		{
170 			dlg(Str.toString(pathString), accelKey, accelMods, hardwareKeycode, _cellrendereraccel);
171 		}
172 	}
173 }