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.CellEditableT;
26 
27 public  import gdk.Event;
28 public  import gobject.Signals;
29 public  import gtk.c.functions;
30 public  import gtk.c.types;
31 public  import gtkc.gtktypes;
32 public  import std.algorithm;
33 
34 
35 /**
36  * The #GtkCellEditable interface must be implemented for widgets to be usable
37  * to edit the contents of a #GtkTreeView cell. It provides a way to specify how
38  * temporary widgets should be configured for editing, get the new value, etc.
39  */
40 public template CellEditableT(TStruct)
41 {
42 	/** Get the main Gtk struct */
43 	public GtkCellEditable* getCellEditableStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return cast(GtkCellEditable*)getStruct();
48 	}
49 
50 
51 	/**
52 	 * Emits the #GtkCellEditable::editing-done signal.
53 	 */
54 	public void editingDone()
55 	{
56 		gtk_cell_editable_editing_done(getCellEditableStruct());
57 	}
58 
59 	/**
60 	 * Emits the #GtkCellEditable::remove-widget signal.
61 	 */
62 	public void removeWidget()
63 	{
64 		gtk_cell_editable_remove_widget(getCellEditableStruct());
65 	}
66 
67 	/**
68 	 * Begins editing on a @cell_editable.
69 	 *
70 	 * The #GtkCellRenderer for the cell creates and returns a #GtkCellEditable from
71 	 * gtk_cell_renderer_start_editing(), configured for the #GtkCellRenderer type.
72 	 *
73 	 * gtk_cell_editable_start_editing() can then set up @cell_editable suitably for
74 	 * editing a cell, e.g. making the Esc key emit #GtkCellEditable::editing-done.
75 	 *
76 	 * Note that the @cell_editable is created on-demand for the current edit; its
77 	 * lifetime is temporary and does not persist across other edits and/or cells.
78 	 *
79 	 * Params:
80 	 *     event = The #GdkEvent that began the editing process, or
81 	 *         %NULL if editing was initiated programmatically
82 	 */
83 	public void startEditing(Event event)
84 	{
85 		gtk_cell_editable_start_editing(getCellEditableStruct(), (event is null) ? null : event.getEventStruct());
86 	}
87 
88 	/**
89 	 * This signal is a sign for the cell renderer to update its
90 	 * value from the @cell_editable.
91 	 *
92 	 * Implementations of #GtkCellEditable are responsible for
93 	 * emitting this signal when they are done editing, e.g.
94 	 * #GtkEntry emits this signal when the user presses Enter. Typical things to
95 	 * do in a handler for ::editing-done are to capture the edited value,
96 	 * disconnect the @cell_editable from signals on the #GtkCellRenderer, etc.
97 	 *
98 	 * gtk_cell_editable_editing_done() is a convenience method
99 	 * for emitting #GtkCellEditable::editing-done.
100 	 */
101 	gulong addOnEditingDone(void delegate(CellEditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
102 	{
103 		return Signals.connect(this, "editing-done", dlg, connectFlags ^ ConnectFlags.SWAPPED);
104 	}
105 
106 	/**
107 	 * This signal is meant to indicate that the cell is finished
108 	 * editing, and the @cell_editable widget is being removed and may
109 	 * subsequently be destroyed.
110 	 *
111 	 * Implementations of #GtkCellEditable are responsible for
112 	 * emitting this signal when they are done editing. It must
113 	 * be emitted after the #GtkCellEditable::editing-done signal,
114 	 * to give the cell renderer a chance to update the cell's value
115 	 * before the widget is removed.
116 	 *
117 	 * gtk_cell_editable_remove_widget() is a convenience method
118 	 * for emitting #GtkCellEditable::remove-widget.
119 	 */
120 	gulong addOnRemoveWidget(void delegate(CellEditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
121 	{
122 		return Signals.connect(this, "remove-widget", dlg, connectFlags ^ ConnectFlags.SWAPPED);
123 	}
124 }