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.CellRenderer;
26 
27 private import cairo.Context;
28 private import gdk.Event;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gtk.CellEditable;
33 private import gtk.CellEditableIF;
34 private import gtk.Requisition;
35 private import gtk.Widget;
36 public  import gtkc.gdktypes;
37 private import gtkc.gtk;
38 public  import gtkc.gtktypes;
39 private import std.algorithm;
40 
41 
42 /**
43  * The #GtkCellRenderer is a base class of a set of objects used for
44  * rendering a cell to a #cairo_t.  These objects are used primarily by
45  * the #GtkTreeView widget, though they aren’t tied to them in any
46  * specific way.  It is worth noting that #GtkCellRenderer is not a
47  * #GtkWidget and cannot be treated as such.
48  * 
49  * The primary use of a #GtkCellRenderer is for drawing a certain graphical
50  * elements on a #cairo_t. Typically, one cell renderer is used to
51  * draw many cells on the screen.  To this extent, it isn’t expected that a
52  * CellRenderer keep any permanent state around.  Instead, any state is set
53  * just prior to use using #GObjects property system.  Then, the
54  * cell is measured using gtk_cell_renderer_get_size(). Finally, the cell
55  * is rendered in the correct location using gtk_cell_renderer_render().
56  * 
57  * There are a number of rules that must be followed when writing a new
58  * #GtkCellRenderer.  First and foremost, it’s important that a certain set
59  * of properties will always yield a cell renderer of the same size,
60  * barring a #GtkStyle change.  The #GtkCellRenderer also has a number of
61  * generic properties that are expected to be honored by all children.
62  * 
63  * Beyond merely rendering a cell, cell renderers can optionally
64  * provide active user interface elements. A cell renderer can be
65  * “activatable” like #GtkCellRendererToggle,
66  * which toggles when it gets activated by a mouse click, or it can be
67  * “editable” like #GtkCellRendererText, which
68  * allows the user to edit the text using a #GtkEntry.
69  * To make a cell renderer activatable or editable, you have to
70  * implement the #GtkCellRendererClass.activate or
71  * #GtkCellRendererClass.start_editing virtual functions, respectively.
72  * 
73  * Many properties of #GtkCellRenderer and its subclasses have a
74  * corresponding “set” property, e.g. “cell-background-set” corresponds
75  * to “cell-background”. These “set” properties reflect whether a property
76  * has been set or not. You should not set them independently.
77  */
78 public class CellRenderer : ObjectG
79 {
80 	/** the main Gtk struct */
81 	protected GtkCellRenderer* gtkCellRenderer;
82 
83 	/** Get the main Gtk struct */
84 	public GtkCellRenderer* getCellRendererStruct()
85 	{
86 		return gtkCellRenderer;
87 	}
88 
89 	/** the main Gtk struct as a void* */
90 	protected override void* getStruct()
91 	{
92 		return cast(void*)gtkCellRenderer;
93 	}
94 
95 	protected override void setStruct(GObject* obj)
96 	{
97 		gtkCellRenderer = cast(GtkCellRenderer*)obj;
98 		super.setStruct(obj);
99 	}
100 
101 	/**
102 	 * Sets our main struct and passes it to the parent class.
103 	 */
104 	public this (GtkCellRenderer* gtkCellRenderer, bool ownedRef = false)
105 	{
106 		this.gtkCellRenderer = gtkCellRenderer;
107 		super(cast(GObject*)gtkCellRenderer, ownedRef);
108 	}
109 
110 
111 	/** */
112 	public static GType getType()
113 	{
114 		return gtk_cell_renderer_get_type();
115 	}
116 
117 	/**
118 	 * Passes an activate event to the cell renderer for possible processing.
119 	 * Some cell renderers may use events; for example, #GtkCellRendererToggle
120 	 * toggles when it gets a mouse click.
121 	 *
122 	 * Params:
123 	 *     event = a #GdkEvent
124 	 *     widget = widget that received the event
125 	 *     path = widget-dependent string representation of the event location;
126 	 *         e.g. for #GtkTreeView, a string representation of #GtkTreePath
127 	 *     backgroundArea = background area as passed to gtk_cell_renderer_render()
128 	 *     cellArea = cell area as passed to gtk_cell_renderer_render()
129 	 *     flags = render flags
130 	 *
131 	 * Return: %TRUE if the event was consumed/handled
132 	 */
133 	public bool activate(Event event, Widget widget, string path, GdkRectangle* backgroundArea, GdkRectangle* cellArea, GtkCellRendererState flags)
134 	{
135 		return gtk_cell_renderer_activate(gtkCellRenderer, (event is null) ? null : event.getEventStruct(), (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(path), backgroundArea, cellArea, flags) != 0;
136 	}
137 
138 	/**
139 	 * Gets the aligned area used by @cell inside @cell_area. Used for finding
140 	 * the appropriate edit and focus rectangle.
141 	 *
142 	 * Params:
143 	 *     widget = the #GtkWidget this cell will be rendering to
144 	 *     flags = render flags
145 	 *     cellArea = cell area which would be passed to gtk_cell_renderer_render()
146 	 *     alignedArea = the return location for the space inside @cell_area
147 	 *         that would acually be used to render.
148 	 *
149 	 * Since: 3.0
150 	 */
151 	public void getAlignedArea(Widget widget, GtkCellRendererState flags, GdkRectangle* cellArea, out GdkRectangle alignedArea)
152 	{
153 		gtk_cell_renderer_get_aligned_area(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), flags, cellArea, &alignedArea);
154 	}
155 
156 	/**
157 	 * Fills in @xalign and @yalign with the appropriate values of @cell.
158 	 *
159 	 * Params:
160 	 *     xalign = location to fill in with the x alignment of the cell, or %NULL
161 	 *     yalign = location to fill in with the y alignment of the cell, or %NULL
162 	 *
163 	 * Since: 2.18
164 	 */
165 	public void getAlignment(out float xalign, out float yalign)
166 	{
167 		gtk_cell_renderer_get_alignment(gtkCellRenderer, &xalign, &yalign);
168 	}
169 
170 	/**
171 	 * Fills in @width and @height with the appropriate size of @cell.
172 	 *
173 	 * Params:
174 	 *     width = location to fill in with the fixed width of the cell, or %NULL
175 	 *     height = location to fill in with the fixed height of the cell, or %NULL
176 	 */
177 	public void getFixedSize(out int width, out int height)
178 	{
179 		gtk_cell_renderer_get_fixed_size(gtkCellRenderer, &width, &height);
180 	}
181 
182 	/**
183 	 * Fills in @xpad and @ypad with the appropriate values of @cell.
184 	 *
185 	 * Params:
186 	 *     xpad = location to fill in with the x padding of the cell, or %NULL
187 	 *     ypad = location to fill in with the y padding of the cell, or %NULL
188 	 *
189 	 * Since: 2.18
190 	 */
191 	public void getPadding(out int xpad, out int ypad)
192 	{
193 		gtk_cell_renderer_get_padding(gtkCellRenderer, &xpad, &ypad);
194 	}
195 
196 	/**
197 	 * Retreives a renderer’s natural size when rendered to @widget.
198 	 *
199 	 * Params:
200 	 *     widget = the #GtkWidget this cell will be rendering to
201 	 *     minimumSize = location to store the minimum size, or %NULL
202 	 *     naturalSize = location to store the natural size, or %NULL
203 	 *
204 	 * Since: 3.0
205 	 */
206 	public void getPreferredHeight(Widget widget, out int minimumSize, out int naturalSize)
207 	{
208 		gtk_cell_renderer_get_preferred_height(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), &minimumSize, &naturalSize);
209 	}
210 
211 	/**
212 	 * Retreives a cell renderers’s minimum and natural height if it were rendered to
213 	 * @widget with the specified @width.
214 	 *
215 	 * Params:
216 	 *     widget = the #GtkWidget this cell will be rendering to
217 	 *     width = the size which is available for allocation
218 	 *     minimumHeight = location for storing the minimum size, or %NULL
219 	 *     naturalHeight = location for storing the preferred size, or %NULL
220 	 *
221 	 * Since: 3.0
222 	 */
223 	public void getPreferredHeightForWidth(Widget widget, int width, out int minimumHeight, out int naturalHeight)
224 	{
225 		gtk_cell_renderer_get_preferred_height_for_width(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), width, &minimumHeight, &naturalHeight);
226 	}
227 
228 	/**
229 	 * Retrieves the minimum and natural size of a cell taking
230 	 * into account the widget’s preference for height-for-width management.
231 	 *
232 	 * Params:
233 	 *     widget = the #GtkWidget this cell will be rendering to
234 	 *     minimumSize = location for storing the minimum size, or %NULL
235 	 *     naturalSize = location for storing the natural size, or %NULL
236 	 *
237 	 * Since: 3.0
238 	 */
239 	public void getPreferredSize(Widget widget, out Requisition minimumSize, out Requisition naturalSize)
240 	{
241 		GtkRequisition* outminimumSize = gMalloc!GtkRequisition();
242 		GtkRequisition* outnaturalSize = gMalloc!GtkRequisition();
243 		
244 		gtk_cell_renderer_get_preferred_size(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), outminimumSize, outnaturalSize);
245 		
246 		minimumSize = ObjectG.getDObject!(Requisition)(outminimumSize, true);
247 		naturalSize = ObjectG.getDObject!(Requisition)(outnaturalSize, true);
248 	}
249 
250 	/**
251 	 * Retreives a renderer’s natural size when rendered to @widget.
252 	 *
253 	 * Params:
254 	 *     widget = the #GtkWidget this cell will be rendering to
255 	 *     minimumSize = location to store the minimum size, or %NULL
256 	 *     naturalSize = location to store the natural size, or %NULL
257 	 *
258 	 * Since: 3.0
259 	 */
260 	public void getPreferredWidth(Widget widget, out int minimumSize, out int naturalSize)
261 	{
262 		gtk_cell_renderer_get_preferred_width(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), &minimumSize, &naturalSize);
263 	}
264 
265 	/**
266 	 * Retreives a cell renderers’s minimum and natural width if it were rendered to
267 	 * @widget with the specified @height.
268 	 *
269 	 * Params:
270 	 *     widget = the #GtkWidget this cell will be rendering to
271 	 *     height = the size which is available for allocation
272 	 *     minimumWidth = location for storing the minimum size, or %NULL
273 	 *     naturalWidth = location for storing the preferred size, or %NULL
274 	 *
275 	 * Since: 3.0
276 	 */
277 	public void getPreferredWidthForHeight(Widget widget, int height, out int minimumWidth, out int naturalWidth)
278 	{
279 		gtk_cell_renderer_get_preferred_width_for_height(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), height, &minimumWidth, &naturalWidth);
280 	}
281 
282 	/**
283 	 * Gets whether the cell renderer prefers a height-for-width layout
284 	 * or a width-for-height layout.
285 	 *
286 	 * Return: The #GtkSizeRequestMode preferred by this renderer.
287 	 *
288 	 * Since: 3.0
289 	 */
290 	public GtkSizeRequestMode getRequestMode()
291 	{
292 		return gtk_cell_renderer_get_request_mode(gtkCellRenderer);
293 	}
294 
295 	/**
296 	 * Returns the cell renderer’s sensitivity.
297 	 *
298 	 * Return: %TRUE if the cell renderer is sensitive
299 	 *
300 	 * Since: 2.18
301 	 */
302 	public bool getSensitive()
303 	{
304 		return gtk_cell_renderer_get_sensitive(gtkCellRenderer) != 0;
305 	}
306 
307 	/**
308 	 * Obtains the width and height needed to render the cell. Used by view
309 	 * widgets to determine the appropriate size for the cell_area passed to
310 	 * gtk_cell_renderer_render().  If @cell_area is not %NULL, fills in the
311 	 * x and y offsets (if set) of the cell relative to this location.
312 	 *
313 	 * Please note that the values set in @width and @height, as well as those
314 	 * in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
315 	 *
316 	 * Deprecated: Use gtk_cell_renderer_get_preferred_size() instead.
317 	 *
318 	 * Params:
319 	 *     widget = the widget the renderer is rendering to
320 	 *     cellArea = The area a cell will be allocated, or %NULL
321 	 *     xOffset = location to return x offset of cell relative to @cell_area, or %NULL
322 	 *     yOffset = location to return y offset of cell relative to @cell_area, or %NULL
323 	 *     width = location to return width needed to render a cell, or %NULL
324 	 *     height = location to return height needed to render a cell, or %NULL
325 	 */
326 	public void getSize(Widget widget, GdkRectangle* cellArea, out int xOffset, out int yOffset, out int width, out int height)
327 	{
328 		gtk_cell_renderer_get_size(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), cellArea, &xOffset, &yOffset, &width, &height);
329 	}
330 
331 	/**
332 	 * Translates the cell renderer state to #GtkStateFlags,
333 	 * based on the cell renderer and widget sensitivity, and
334 	 * the given #GtkCellRendererState.
335 	 *
336 	 * Params:
337 	 *     widget = a #GtkWidget, or %NULL
338 	 *     cellState = cell renderer state
339 	 *
340 	 * Return: the widget state flags applying to @cell
341 	 *
342 	 * Since: 3.0
343 	 */
344 	public GtkStateFlags getState(Widget widget, GtkCellRendererState cellState)
345 	{
346 		return gtk_cell_renderer_get_state(gtkCellRenderer, (widget is null) ? null : widget.getWidgetStruct(), cellState);
347 	}
348 
349 	/**
350 	 * Returns the cell renderer’s visibility.
351 	 *
352 	 * Return: %TRUE if the cell renderer is visible
353 	 *
354 	 * Since: 2.18
355 	 */
356 	public bool getVisible()
357 	{
358 		return gtk_cell_renderer_get_visible(gtkCellRenderer) != 0;
359 	}
360 
361 	/**
362 	 * Checks whether the cell renderer can do something when activated.
363 	 *
364 	 * Return: %TRUE if the cell renderer can do anything when activated
365 	 *
366 	 * Since: 3.0
367 	 */
368 	public bool isActivatable()
369 	{
370 		return gtk_cell_renderer_is_activatable(gtkCellRenderer) != 0;
371 	}
372 
373 	/**
374 	 * Invokes the virtual render function of the #GtkCellRenderer. The three
375 	 * passed-in rectangles are areas in @cr. Most renderers will draw within
376 	 * @cell_area; the xalign, yalign, xpad, and ypad fields of the #GtkCellRenderer
377 	 * should be honored with respect to @cell_area. @background_area includes the
378 	 * blank space around the cell, and also the area containing the tree expander;
379 	 * so the @background_area rectangles for all cells tile to cover the entire
380 	 * @window.
381 	 *
382 	 * Params:
383 	 *     cr = a cairo context to draw to
384 	 *     widget = the widget owning @window
385 	 *     backgroundArea = entire cell area (including tree expanders and maybe
386 	 *         padding on the sides)
387 	 *     cellArea = area normally rendered by a cell renderer
388 	 *     flags = flags that affect rendering
389 	 */
390 	public void render(Context cr, Widget widget, GdkRectangle* backgroundArea, GdkRectangle* cellArea, GtkCellRendererState flags)
391 	{
392 		gtk_cell_renderer_render(gtkCellRenderer, (cr is null) ? null : cr.getContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), backgroundArea, cellArea, flags);
393 	}
394 
395 	/**
396 	 * Sets the renderer’s alignment within its available space.
397 	 *
398 	 * Params:
399 	 *     xalign = the x alignment of the cell renderer
400 	 *     yalign = the y alignment of the cell renderer
401 	 *
402 	 * Since: 2.18
403 	 */
404 	public void setAlignment(float xalign, float yalign)
405 	{
406 		gtk_cell_renderer_set_alignment(gtkCellRenderer, xalign, yalign);
407 	}
408 
409 	/**
410 	 * Sets the renderer size to be explicit, independent of the properties set.
411 	 *
412 	 * Params:
413 	 *     width = the width of the cell renderer, or -1
414 	 *     height = the height of the cell renderer, or -1
415 	 */
416 	public void setFixedSize(int width, int height)
417 	{
418 		gtk_cell_renderer_set_fixed_size(gtkCellRenderer, width, height);
419 	}
420 
421 	/**
422 	 * Sets the renderer’s padding.
423 	 *
424 	 * Params:
425 	 *     xpad = the x padding of the cell renderer
426 	 *     ypad = the y padding of the cell renderer
427 	 *
428 	 * Since: 2.18
429 	 */
430 	public void setPadding(int xpad, int ypad)
431 	{
432 		gtk_cell_renderer_set_padding(gtkCellRenderer, xpad, ypad);
433 	}
434 
435 	/**
436 	 * Sets the cell renderer’s sensitivity.
437 	 *
438 	 * Params:
439 	 *     sensitive = the sensitivity of the cell
440 	 *
441 	 * Since: 2.18
442 	 */
443 	public void setSensitive(bool sensitive)
444 	{
445 		gtk_cell_renderer_set_sensitive(gtkCellRenderer, sensitive);
446 	}
447 
448 	/**
449 	 * Sets the cell renderer’s visibility.
450 	 *
451 	 * Params:
452 	 *     visible = the visibility of the cell
453 	 *
454 	 * Since: 2.18
455 	 */
456 	public void setVisible(bool visible)
457 	{
458 		gtk_cell_renderer_set_visible(gtkCellRenderer, visible);
459 	}
460 
461 	/**
462 	 * Passes an activate event to the cell renderer for possible processing.
463 	 *
464 	 * Params:
465 	 *     event = a #GdkEvent
466 	 *     widget = widget that received the event
467 	 *     path = widget-dependent string representation of the event location;
468 	 *         e.g. for #GtkTreeView, a string representation of #GtkTreePath
469 	 *     backgroundArea = background area as passed to gtk_cell_renderer_render()
470 	 *     cellArea = cell area as passed to gtk_cell_renderer_render()
471 	 *     flags = render flags
472 	 *
473 	 * Return: A new #GtkCellEditable, or %NULL
474 	 */
475 	public CellEditableIF startEditing(Event event, Widget widget, string path, GdkRectangle* backgroundArea, GdkRectangle* cellArea, GtkCellRendererState flags)
476 	{
477 		auto p = gtk_cell_renderer_start_editing(gtkCellRenderer, (event is null) ? null : event.getEventStruct(), (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(path), backgroundArea, cellArea, flags);
478 		
479 		if(p is null)
480 		{
481 			return null;
482 		}
483 		
484 		return ObjectG.getDObject!(CellEditable, CellEditableIF)(cast(GtkCellEditable*) p);
485 	}
486 
487 	/**
488 	 * Informs the cell renderer that the editing is stopped.
489 	 * If @canceled is %TRUE, the cell renderer will emit the
490 	 * #GtkCellRenderer::editing-canceled signal.
491 	 *
492 	 * This function should be called by cell renderer implementations
493 	 * in response to the #GtkCellEditable::editing-done signal of
494 	 * #GtkCellEditable.
495 	 *
496 	 * Params:
497 	 *     canceled = %TRUE if the editing has been canceled
498 	 *
499 	 * Since: 2.6
500 	 */
501 	public void stopEditing(bool canceled)
502 	{
503 		gtk_cell_renderer_stop_editing(gtkCellRenderer, canceled);
504 	}
505 
506 	protected class OnEditingCanceledDelegateWrapper
507 	{
508 		void delegate(CellRenderer) dlg;
509 		gulong handlerId;
510 		ConnectFlags flags;
511 		this(void delegate(CellRenderer) dlg, gulong handlerId, ConnectFlags flags)
512 		{
513 			this.dlg = dlg;
514 			this.handlerId = handlerId;
515 			this.flags = flags;
516 		}
517 	}
518 	protected OnEditingCanceledDelegateWrapper[] onEditingCanceledListeners;
519 
520 	/**
521 	 * This signal gets emitted when the user cancels the process of editing a
522 	 * cell.  For example, an editable cell renderer could be written to cancel
523 	 * editing when the user presses Escape.
524 	 *
525 	 * See also: gtk_cell_renderer_stop_editing().
526 	 *
527 	 * Since: 2.4
528 	 */
529 	gulong addOnEditingCanceled(void delegate(CellRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
530 	{
531 		onEditingCanceledListeners ~= new OnEditingCanceledDelegateWrapper(dlg, 0, connectFlags);
532 		onEditingCanceledListeners[onEditingCanceledListeners.length - 1].handlerId = Signals.connectData(
533 			this,
534 			"editing-canceled",
535 			cast(GCallback)&callBackEditingCanceled,
536 			cast(void*)onEditingCanceledListeners[onEditingCanceledListeners.length - 1],
537 			cast(GClosureNotify)&callBackEditingCanceledDestroy,
538 			connectFlags);
539 		return onEditingCanceledListeners[onEditingCanceledListeners.length - 1].handlerId;
540 	}
541 	
542 	extern(C) static void callBackEditingCanceled(GtkCellRenderer* cellrendererStruct,OnEditingCanceledDelegateWrapper wrapper)
543 	{
544 		wrapper.dlg(wrapper.outer);
545 	}
546 	
547 	extern(C) static void callBackEditingCanceledDestroy(OnEditingCanceledDelegateWrapper wrapper, GClosure* closure)
548 	{
549 		wrapper.outer.internalRemoveOnEditingCanceled(wrapper);
550 	}
551 
552 	protected void internalRemoveOnEditingCanceled(OnEditingCanceledDelegateWrapper source)
553 	{
554 		foreach(index, wrapper; onEditingCanceledListeners)
555 		{
556 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
557 			{
558 				onEditingCanceledListeners[index] = null;
559 				onEditingCanceledListeners = std.algorithm.remove(onEditingCanceledListeners, index);
560 				break;
561 			}
562 		}
563 	}
564 	
565 
566 	protected class OnEditingStartedDelegateWrapper
567 	{
568 		void delegate(CellEditableIF, string, CellRenderer) dlg;
569 		gulong handlerId;
570 		ConnectFlags flags;
571 		this(void delegate(CellEditableIF, string, CellRenderer) dlg, gulong handlerId, ConnectFlags flags)
572 		{
573 			this.dlg = dlg;
574 			this.handlerId = handlerId;
575 			this.flags = flags;
576 		}
577 	}
578 	protected OnEditingStartedDelegateWrapper[] onEditingStartedListeners;
579 
580 	/**
581 	 * This signal gets emitted when a cell starts to be edited.
582 	 * The intended use of this signal is to do special setup
583 	 * on @editable, e.g. adding a #GtkEntryCompletion or setting
584 	 * up additional columns in a #GtkComboBox.
585 	 *
586 	 * Note that GTK+ doesn't guarantee that cell renderers will
587 	 * continue to use the same kind of widget for editing in future
588 	 * releases, therefore you should check the type of @editable
589 	 * before doing any specific setup, as in the following example:
590 	 * |[<!-- language="C" -->
591 	 * static void
592 	 * text_editing_started (GtkCellRenderer *cell,
593 	 * GtkCellEditable *editable,
594 	 * const gchar     *path,
595 	 * gpointer         data)
596 	 * {
597 	 * if (GTK_IS_ENTRY (editable))
598 	 * {
599 	 * GtkEntry *entry = GTK_ENTRY (editable);
600 	 *
601 	 * // ... create a GtkEntryCompletion
602 	 *
603 	 * gtk_entry_set_completion (entry, completion);
604 	 * }
605 	 * }
606 	 * ]|
607 	 *
608 	 * Params:
609 	 *     editable = the #GtkCellEditable
610 	 *     path = the path identifying the edited cell
611 	 *
612 	 * Since: 2.6
613 	 */
614 	gulong addOnEditingStarted(void delegate(CellEditableIF, string, CellRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
615 	{
616 		onEditingStartedListeners ~= new OnEditingStartedDelegateWrapper(dlg, 0, connectFlags);
617 		onEditingStartedListeners[onEditingStartedListeners.length - 1].handlerId = Signals.connectData(
618 			this,
619 			"editing-started",
620 			cast(GCallback)&callBackEditingStarted,
621 			cast(void*)onEditingStartedListeners[onEditingStartedListeners.length - 1],
622 			cast(GClosureNotify)&callBackEditingStartedDestroy,
623 			connectFlags);
624 		return onEditingStartedListeners[onEditingStartedListeners.length - 1].handlerId;
625 	}
626 	
627 	extern(C) static void callBackEditingStarted(GtkCellRenderer* cellrendererStruct, GtkCellEditable* editable, char* path,OnEditingStartedDelegateWrapper wrapper)
628 	{
629 		wrapper.dlg(ObjectG.getDObject!(CellEditable, CellEditableIF)(editable), Str.toString(path), wrapper.outer);
630 	}
631 	
632 	extern(C) static void callBackEditingStartedDestroy(OnEditingStartedDelegateWrapper wrapper, GClosure* closure)
633 	{
634 		wrapper.outer.internalRemoveOnEditingStarted(wrapper);
635 	}
636 
637 	protected void internalRemoveOnEditingStarted(OnEditingStartedDelegateWrapper source)
638 	{
639 		foreach(index, wrapper; onEditingStartedListeners)
640 		{
641 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
642 			{
643 				onEditingStartedListeners[index] = null;
644 				onEditingStartedListeners = std.algorithm.remove(onEditingStartedListeners, index);
645 				break;
646 			}
647 		}
648 	}
649 	
650 }