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 gtkc.gdktypes;
30 public  import gtkc.gtk;
31 public  import gtkc.gtktypes;
32 
33 
34 /**
35  * The #GtkCellEditable interface must be implemented for widgets to be usable
36  * when editing the contents of a #GtkTreeView cell.
37  */
38 public template CellEditableT(TStruct)
39 {
40 	/** Get the main Gtk struct */
41 	public GtkCellEditable* getCellEditableStruct()
42 	{
43 		return cast(GtkCellEditable*)getStruct();
44 	}
45 
46 	/**
47 	 */
48 
49 	/**
50 	 * Emits the #GtkCellEditable::editing-done signal.
51 	 */
52 	public void editingDone()
53 	{
54 		gtk_cell_editable_editing_done(getCellEditableStruct());
55 	}
56 
57 	/**
58 	 * Emits the #GtkCellEditable::remove-widget signal.
59 	 */
60 	public void removeWidget()
61 	{
62 		gtk_cell_editable_remove_widget(getCellEditableStruct());
63 	}
64 
65 	/**
66 	 * Begins editing on a @cell_editable. @event is the #GdkEvent that began
67 	 * the editing process. It may be %NULL, in the instance that editing was
68 	 * initiated through programatic means.
69 	 *
70 	 * Params:
71 	 *     event = A #GdkEvent, or %NULL
72 	 */
73 	public void startEditing(Event event)
74 	{
75 		gtk_cell_editable_start_editing(getCellEditableStruct(), (event is null) ? null : event.getEventStruct());
76 	}
77 
78 	int[string] connectedSignals;
79 
80 	void delegate(CellEditableIF)[] _onEditingDoneListeners;
81 	@property void delegate(CellEditableIF)[] onEditingDoneListeners()
82 	{
83 		return _onEditingDoneListeners;
84 	}
85 	/**
86 	 * This signal is a sign for the cell renderer to update its
87 	 * value from the @cell_editable.
88 	 *
89 	 * Implementations of #GtkCellEditable are responsible for
90 	 * emitting this signal when they are done editing, e.g.
91 	 * #GtkEntry is emitting it when the user presses Enter.
92 	 *
93 	 * gtk_cell_editable_editing_done() is a convenience method
94 	 * for emitting #GtkCellEditable::editing-done.
95 	 */
96 	void addOnEditingDone(void delegate(CellEditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
97 	{
98 		if ( "editing-done" !in connectedSignals )
99 		{
100 			Signals.connectData(
101 				this,
102 				"editing-done",
103 				cast(GCallback)&callBackEditingDone,
104 				cast(void*)cast(CellEditableIF)this,
105 				null,
106 				connectFlags);
107 			connectedSignals["editing-done"] = 1;
108 		}
109 		_onEditingDoneListeners ~= dlg;
110 	}
111 	extern(C) static void callBackEditingDone(GtkCellEditable* celleditableStruct, CellEditableIF _celleditable)
112 	{
113 		foreach ( void delegate(CellEditableIF) dlg; _celleditable.onEditingDoneListeners )
114 		{
115 			dlg(_celleditable);
116 		}
117 	}
118 
119 	void delegate(CellEditableIF)[] _onRemoveWidgetListeners;
120 	@property void delegate(CellEditableIF)[] onRemoveWidgetListeners()
121 	{
122 		return _onRemoveWidgetListeners;
123 	}
124 	/**
125 	 * This signal is meant to indicate that the cell is finished
126 	 * editing, and the widget may now be destroyed.
127 	 *
128 	 * Implementations of #GtkCellEditable are responsible for
129 	 * emitting this signal when they are done editing. It must
130 	 * be emitted after the #GtkCellEditable::editing-done signal,
131 	 * to give the cell renderer a chance to update the cell's value
132 	 * before the widget is removed.
133 	 *
134 	 * gtk_cell_editable_remove_widget() is a convenience method
135 	 * for emitting #GtkCellEditable::remove-widget.
136 	 */
137 	void addOnRemoveWidget(void delegate(CellEditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
138 	{
139 		if ( "remove-widget" !in connectedSignals )
140 		{
141 			Signals.connectData(
142 				this,
143 				"remove-widget",
144 				cast(GCallback)&callBackRemoveWidget,
145 				cast(void*)cast(CellEditableIF)this,
146 				null,
147 				connectFlags);
148 			connectedSignals["remove-widget"] = 1;
149 		}
150 		_onRemoveWidgetListeners ~= dlg;
151 	}
152 	extern(C) static void callBackRemoveWidget(GtkCellEditable* celleditableStruct, CellEditableIF _celleditable)
153 	{
154 		foreach ( void delegate(CellEditableIF) dlg; _celleditable.onRemoveWidgetListeners )
155 		{
156 			dlg(_celleditable);
157 		}
158 	}
159 }