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 private import gtk.c.functions;
34 public  import gtk.c.types;
35 public  import gtkc.gtktypes;
36 private import std.algorithm;
37 
38 
39 /**
40  * #GtkCellRendererAccel displays a keyboard accelerator (i.e. a key
41  * combination like `Control + a`). If the cell renderer is editable,
42  * the accelerator can be changed by simply typing the new combination.
43  * 
44  * The #GtkCellRendererAccel cell renderer was added in GTK+ 2.10.
45  */
46 public class CellRendererAccel : CellRendererText
47 {
48 	/** the main Gtk struct */
49 	protected GtkCellRendererAccel* gtkCellRendererAccel;
50 
51 	/** Get the main Gtk struct */
52 	public GtkCellRendererAccel* getCellRendererAccelStruct(bool transferOwnership = false)
53 	{
54 		if (transferOwnership)
55 			ownedRef = false;
56 		return gtkCellRendererAccel;
57 	}
58 
59 	/** the main Gtk struct as a void* */
60 	protected override void* getStruct()
61 	{
62 		return cast(void*)gtkCellRendererAccel;
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GtkCellRendererAccel* gtkCellRendererAccel, bool ownedRef = false)
69 	{
70 		this.gtkCellRendererAccel = gtkCellRendererAccel;
71 		super(cast(GtkCellRendererText*)gtkCellRendererAccel, ownedRef);
72 	}
73 
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return gtk_cell_renderer_accel_get_type();
79 	}
80 
81 	/**
82 	 * Creates a new #GtkCellRendererAccel.
83 	 *
84 	 * Returns: the new cell renderer
85 	 *
86 	 * Since: 2.10
87 	 *
88 	 * Throws: ConstructionException GTK+ fails to create the object.
89 	 */
90 	public this()
91 	{
92 		auto p = gtk_cell_renderer_accel_new();
93 
94 		if(p is null)
95 		{
96 			throw new ConstructionException("null returned by new");
97 		}
98 
99 		this(cast(GtkCellRendererAccel*) p);
100 	}
101 
102 	/**
103 	 * Gets emitted when the user has removed the accelerator.
104 	 *
105 	 * Params:
106 	 *     pathString = the path identifying the row of the edited cell
107 	 *
108 	 * Since: 2.10
109 	 */
110 	gulong addOnAccelCleared(void delegate(string, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
111 	{
112 		return Signals.connect(this, "accel-cleared", dlg, connectFlags ^ ConnectFlags.SWAPPED);
113 	}
114 
115 	/**
116 	 * Gets emitted when the user has selected a new accelerator.
117 	 *
118 	 * Params:
119 	 *     pathString = the path identifying the row of the edited cell
120 	 *     accelKey = the new accelerator keyval
121 	 *     accelMods = the new acclerator modifier mask
122 	 *     hardwareKeycode = the keycode of the new accelerator
123 	 *
124 	 * Since: 2.10
125 	 */
126 	gulong addOnAccelEdited(void delegate(string, uint, GdkModifierType, uint, CellRendererAccel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
127 	{
128 		return Signals.connect(this, "accel-edited", dlg, connectFlags ^ ConnectFlags.SWAPPED);
129 	}
130 }