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