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 gsv.SourceGutterRenderer;
26 
27 private import cairo.Context;
28 private import gdk.Event;
29 private import gdk.RGBA;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gsvc.gsv;
33 public  import gsvc.gsvtypes;
34 private import gtk.TextIter;
35 private import gtk.TextView;
36 private import gtk.Tooltip;
37 public  import gtkc.gdktypes;
38 private import std.algorithm;
39 
40 
41 /** */
42 public class SourceGutterRenderer : ObjectG
43 {
44 	/** the main Gtk struct */
45 	protected GtkSourceGutterRenderer* gtkSourceGutterRenderer;
46 
47 	/** Get the main Gtk struct */
48 	public GtkSourceGutterRenderer* getSourceGutterRendererStruct()
49 	{
50 		return gtkSourceGutterRenderer;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)gtkSourceGutterRenderer;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		gtkSourceGutterRenderer = cast(GtkSourceGutterRenderer*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GtkSourceGutterRenderer* gtkSourceGutterRenderer, bool ownedRef = false)
69 	{
70 		this.gtkSourceGutterRenderer = gtkSourceGutterRenderer;
71 		super(cast(GObject*)gtkSourceGutterRenderer, ownedRef);
72 	}
73 
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return gtk_source_gutter_renderer_get_type();
79 	}
80 
81 	/**
82 	 * Emits the #GtkSourceGutterRenderer::activate signal of the renderer. This is
83 	 * called from #GtkSourceGutter and should never have to be called manually.
84 	 *
85 	 * Params:
86 	 *     iter = a #GtkTextIter at the start of the line where the renderer is activated
87 	 *     area = a #GdkRectangle of the cell area where the renderer is activated
88 	 *     event = the event that triggered the activation
89 	 */
90 	public void activate(TextIter iter, GdkRectangle* area, Event event)
91 	{
92 		gtk_source_gutter_renderer_activate(gtkSourceGutterRenderer, (iter is null) ? null : iter.getTextIterStruct(), area, (event is null) ? null : event.getEventStruct());
93 	}
94 
95 	/**
96 	 * Called when drawing a region begins. The region to be drawn is indicated
97 	 * by @start and @end. The purpose is to allow the implementation to precompute
98 	 * some state before the draw method is called for each cell.
99 	 *
100 	 * Params:
101 	 *     cr = a #cairo_t
102 	 *     backgroundArea = a #GdkRectangle
103 	 *     cellArea = a #GdkRectangle
104 	 *     start = a #GtkTextIter
105 	 *     end = a #GtkTextIter
106 	 */
107 	public void begin(Context cr, GdkRectangle* backgroundArea, GdkRectangle* cellArea, TextIter start, TextIter end)
108 	{
109 		gtk_source_gutter_renderer_begin(gtkSourceGutterRenderer, (cr is null) ? null : cr.getContextStruct(), backgroundArea, cellArea, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
110 	}
111 
112 	/**
113 	 * Main renderering method. Implementations should implement this method to draw
114 	 * onto the cairo context. The @background_area indicates the total area of the
115 	 * cell to be drawn. The @cell_area indicates the area where content can be
116 	 * drawn (text, images, etc).
117 	 *
118 	 * The @background_area is the @cell_area plus the padding on each side (two
119 	 * times the #GtkSourceGutterRenderer:xpad horizontally and two times the
120 	 * #GtkSourceGutterRenderer:ypad vertically, so that the @cell_area is centered
121 	 * inside @background_area).
122 	 *
123 	 * The @state argument indicates the current state of the renderer and should
124 	 * be taken into account to properly draw the different possible states
125 	 * (cursor, prelit, selected) if appropriate.
126 	 *
127 	 * Params:
128 	 *     cr = the cairo render context
129 	 *     backgroundArea = a #GdkRectangle indicating the total area to be drawn
130 	 *     cellArea = a #GdkRectangle indicating the area to draw content
131 	 *     start = a #GtkTextIter
132 	 *     end = a #GtkTextIter
133 	 *     state = a #GtkSourceGutterRendererState
134 	 */
135 	public void draw(Context cr, GdkRectangle* backgroundArea, GdkRectangle* cellArea, TextIter start, TextIter end, GtkSourceGutterRendererState state)
136 	{
137 		gtk_source_gutter_renderer_draw(gtkSourceGutterRenderer, (cr is null) ? null : cr.getContextStruct(), backgroundArea, cellArea, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), state);
138 	}
139 
140 	/**
141 	 * Called when drawing a region of lines has ended.
142 	 */
143 	public void end()
144 	{
145 		gtk_source_gutter_renderer_end(gtkSourceGutterRenderer);
146 	}
147 
148 	/**
149 	 * Get the x-alignment and y-alignment of the gutter renderer.
150 	 *
151 	 * Params:
152 	 *     xalign = return location for the x-alignment,
153 	 *         or %NULL to ignore.
154 	 *     yalign = return location for the y-alignment,
155 	 *         or %NULL to ignore.
156 	 */
157 	public void getAlignment(out float xalign, out float yalign)
158 	{
159 		gtk_source_gutter_renderer_get_alignment(gtkSourceGutterRenderer, &xalign, &yalign);
160 	}
161 
162 	/**
163 	 * Get the alignment mode. The alignment mode describes the manner in which the
164 	 * renderer is aligned (see :xalign and :yalign).
165 	 *
166 	 * Return: a #GtkSourceGutterRendererAlignmentMode
167 	 */
168 	public GtkSourceGutterRendererAlignmentMode getAlignmentMode()
169 	{
170 		return gtk_source_gutter_renderer_get_alignment_mode(gtkSourceGutterRenderer);
171 	}
172 
173 	/**
174 	 * Get the background color of the renderer.
175 	 *
176 	 * Params:
177 	 *     color = return value for a #GdkRGBA
178 	 *
179 	 * Return: %TRUE if the background color is set, %FALSE otherwise
180 	 */
181 	public bool getBackground(out RGBA color)
182 	{
183 		GdkRGBA* outcolor = gMalloc!GdkRGBA();
184 		
185 		auto p = gtk_source_gutter_renderer_get_background(gtkSourceGutterRenderer, outcolor) != 0;
186 		
187 		color = ObjectG.getDObject!(RGBA)(outcolor, true);
188 		
189 		return p;
190 	}
191 
192 	/**
193 	 * Get the x-padding and y-padding of the gutter renderer.
194 	 *
195 	 * Params:
196 	 *     xpad = return location for the x-padding,
197 	 *         or %NULL to ignore.
198 	 *     ypad = return location for the y-padding,
199 	 *         or %NULL to ignore.
200 	 */
201 	public void getPadding(out int xpad, out int ypad)
202 	{
203 		gtk_source_gutter_renderer_get_padding(gtkSourceGutterRenderer, &xpad, &ypad);
204 	}
205 
206 	/**
207 	 * Get the size of the renderer.
208 	 *
209 	 * Return: the size of the renderer.
210 	 */
211 	public int getSize()
212 	{
213 		return gtk_source_gutter_renderer_get_size(gtkSourceGutterRenderer);
214 	}
215 
216 	/**
217 	 * Get the view associated to the gutter renderer
218 	 *
219 	 * Return: a #GtkTextView
220 	 */
221 	public TextView getView()
222 	{
223 		auto p = gtk_source_gutter_renderer_get_view(gtkSourceGutterRenderer);
224 		
225 		if(p is null)
226 		{
227 			return null;
228 		}
229 		
230 		return ObjectG.getDObject!(TextView)(cast(GtkTextView*) p);
231 	}
232 
233 	/**
234 	 * Get whether the gutter renderer is visible.
235 	 *
236 	 * Return: %TRUE if the renderer is visible, %FALSE otherwise
237 	 */
238 	public bool getVisible()
239 	{
240 		return gtk_source_gutter_renderer_get_visible(gtkSourceGutterRenderer) != 0;
241 	}
242 
243 	/**
244 	 * Get the #GtkTextWindowType associated with the gutter renderer.
245 	 *
246 	 * Return: a #GtkTextWindowType
247 	 */
248 	public GtkTextWindowType getWindowType()
249 	{
250 		return gtk_source_gutter_renderer_get_window_type(gtkSourceGutterRenderer);
251 	}
252 
253 	/**
254 	 * Get whether the renderer is activatable at the location in @event. This is
255 	 * called from #GtkSourceGutter to determine whether a renderer is activatable
256 	 * using the mouse pointer.
257 	 *
258 	 * Params:
259 	 *     iter = a #GtkTextIter at the start of the line to be activated
260 	 *     area = a #GdkRectangle of the cell area to be activated
261 	 *     event = the event that triggered the query
262 	 *
263 	 * Return: %TRUE if the renderer can be activated, %FALSE otherwise
264 	 */
265 	public bool queryActivatable(TextIter iter, GdkRectangle* area, Event event)
266 	{
267 		return gtk_source_gutter_renderer_query_activatable(gtkSourceGutterRenderer, (iter is null) ? null : iter.getTextIterStruct(), area, (event is null) ? null : event.getEventStruct()) != 0;
268 	}
269 
270 	/**
271 	 * Emit the #GtkSourceGutterRenderer::query-data signal. This function is called
272 	 * to query for data just before rendering a cell. This is called from the
273 	 * #GtkSourceGutter.  Implementations can override the default signal handler or
274 	 * can connect a signal handler externally to the
275 	 * #GtkSourceGutterRenderer::query-data signal.
276 	 *
277 	 * Params:
278 	 *     start = a #GtkTextIter.
279 	 *     end = a #GtkTextIter.
280 	 *     state = a #GtkSourceGutterRendererState.
281 	 */
282 	public void queryData(TextIter start, TextIter end, GtkSourceGutterRendererState state)
283 	{
284 		gtk_source_gutter_renderer_query_data(gtkSourceGutterRenderer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), state);
285 	}
286 
287 	/**
288 	 * Emits the #GtkSourceGutterRenderer::query-tooltip signal. This function is
289 	 * called from #GtkSourceGutter. Implementations can override the default signal
290 	 * handler or can connect to the signal externally.
291 	 *
292 	 * Params:
293 	 *     iter = a #GtkTextIter.
294 	 *     area = a #GdkRectangle.
295 	 *     x = The x position of the tooltip.
296 	 *     y = The y position of the tooltip.
297 	 *     tooltip = a #GtkTooltip.
298 	 *
299 	 * Return: %TRUE if the tooltip has been set, %FALSE otherwise
300 	 */
301 	public bool queryTooltip(TextIter iter, GdkRectangle* area, int x, int y, Tooltip tooltip)
302 	{
303 		return gtk_source_gutter_renderer_query_tooltip(gtkSourceGutterRenderer, (iter is null) ? null : iter.getTextIterStruct(), area, x, y, (tooltip is null) ? null : tooltip.getTooltipStruct()) != 0;
304 	}
305 
306 	/**
307 	 * Emits the #GtkSourceGutterRenderer::queue-draw signal of the renderer. Call
308 	 * this from an implementation to inform that the renderer has changed such that
309 	 * it needs to redraw.
310 	 */
311 	public void queueDraw()
312 	{
313 		gtk_source_gutter_renderer_queue_draw(gtkSourceGutterRenderer);
314 	}
315 
316 	/**
317 	 * Set the alignment of the gutter renderer. Both @xalign and @yalign can be
318 	 * -1, which means the values will not be changed (this allows changing only
319 	 * one of the values).
320 	 *
321 	 * @xalign is the horizontal alignment. Set to 0 for a left alignment. 1 for a
322 	 * right alignment. And 0.5 for centering the cells. @yalign is the vertical
323 	 * alignment. Set to 0 for a top alignment. 1 for a bottom alignment.
324 	 *
325 	 * Params:
326 	 *     xalign = the x-alignment
327 	 *     yalign = the y-alignment
328 	 */
329 	public void setAlignment(float xalign, float yalign)
330 	{
331 		gtk_source_gutter_renderer_set_alignment(gtkSourceGutterRenderer, xalign, yalign);
332 	}
333 
334 	/**
335 	 * Set the alignment mode. The alignment mode describes the manner in which the
336 	 * renderer is aligned (see :xalign and :yalign).
337 	 *
338 	 * Params:
339 	 *     mode = a #GtkSourceGutterRendererAlignmentMode
340 	 */
341 	public void setAlignmentMode(GtkSourceGutterRendererAlignmentMode mode)
342 	{
343 		gtk_source_gutter_renderer_set_alignment_mode(gtkSourceGutterRenderer, mode);
344 	}
345 
346 	/**
347 	 * Set the background color of the renderer. If @color is set to %NULL, the
348 	 * renderer will not have a background color.
349 	 *
350 	 * Params:
351 	 *     color = a #GdkRGBA or %NULL
352 	 */
353 	public void setBackground(RGBA color)
354 	{
355 		gtk_source_gutter_renderer_set_background(gtkSourceGutterRenderer, (color is null) ? null : color.getRGBAStruct());
356 	}
357 
358 	/**
359 	 * Set the padding of the gutter renderer. Both @xpad and @ypad can be
360 	 * -1, which means the values will not be changed (this allows changing only
361 	 * one of the values).
362 	 *
363 	 * @xpad is the left and right padding. @ypad is the top and bottom padding.
364 	 *
365 	 * Params:
366 	 *     xpad = the x-padding
367 	 *     ypad = the y-padding
368 	 */
369 	public void setPadding(int xpad, int ypad)
370 	{
371 		gtk_source_gutter_renderer_set_padding(gtkSourceGutterRenderer, xpad, ypad);
372 	}
373 
374 	/**
375 	 * Sets the size of the renderer. A value of -1 specifies that the size
376 	 * is to be determined dynamically.
377 	 *
378 	 * Params:
379 	 *     size = the size
380 	 */
381 	public void setSize(int size)
382 	{
383 		gtk_source_gutter_renderer_set_size(gtkSourceGutterRenderer, size);
384 	}
385 
386 	/**
387 	 * Set whether the gutter renderer is visible.
388 	 *
389 	 * Params:
390 	 *     visible = the visibility
391 	 */
392 	public void setVisible(bool visible)
393 	{
394 		gtk_source_gutter_renderer_set_visible(gtkSourceGutterRenderer, visible);
395 	}
396 
397 	protected class OnActivateDelegateWrapper
398 	{
399 		void delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg;
400 		gulong handlerId;
401 		ConnectFlags flags;
402 		this(void delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg, gulong handlerId, ConnectFlags flags)
403 		{
404 			this.dlg = dlg;
405 			this.handlerId = handlerId;
406 			this.flags = flags;
407 		}
408 	}
409 	protected OnActivateDelegateWrapper[] onActivateListeners;
410 
411 	/**
412 	 * The ::activate signal is emitted when the renderer is
413 	 * activated.
414 	 *
415 	 * Params:
416 	 *     iter = a #GtkTextIter
417 	 *     area = a #GdkRectangle
418 	 *     event = the event that caused the activation
419 	 */
420 	gulong addOnActivate(void delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
421 	{
422 		onActivateListeners ~= new OnActivateDelegateWrapper(dlg, 0, connectFlags);
423 		onActivateListeners[onActivateListeners.length - 1].handlerId = Signals.connectData(
424 			this,
425 			"activate",
426 			cast(GCallback)&callBackActivate,
427 			cast(void*)onActivateListeners[onActivateListeners.length - 1],
428 			cast(GClosureNotify)&callBackActivateDestroy,
429 			connectFlags);
430 		return onActivateListeners[onActivateListeners.length - 1].handlerId;
431 	}
432 	
433 	extern(C) static void callBackActivate(GtkSourceGutterRenderer* sourcegutterrendererStruct, GtkTextIter* iter, GdkRectangle* area, GdkEvent* event,OnActivateDelegateWrapper wrapper)
434 	{
435 		wrapper.dlg(ObjectG.getDObject!(TextIter)(iter), area, ObjectG.getDObject!(Event)(event), wrapper.outer);
436 	}
437 	
438 	extern(C) static void callBackActivateDestroy(OnActivateDelegateWrapper wrapper, GClosure* closure)
439 	{
440 		wrapper.outer.internalRemoveOnActivate(wrapper);
441 	}
442 
443 	protected void internalRemoveOnActivate(OnActivateDelegateWrapper source)
444 	{
445 		foreach(index, wrapper; onActivateListeners)
446 		{
447 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
448 			{
449 				onActivateListeners[index] = null;
450 				onActivateListeners = std.algorithm.remove(onActivateListeners, index);
451 				break;
452 			}
453 		}
454 	}
455 	
456 
457 	protected class OnQueryActivatableDelegateWrapper
458 	{
459 		bool delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg;
460 		gulong handlerId;
461 		ConnectFlags flags;
462 		this(bool delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg, gulong handlerId, ConnectFlags flags)
463 		{
464 			this.dlg = dlg;
465 			this.handlerId = handlerId;
466 			this.flags = flags;
467 		}
468 	}
469 	protected OnQueryActivatableDelegateWrapper[] onQueryActivatableListeners;
470 
471 	/**
472 	 * The ::query-activatable signal is emitted when the renderer
473 	 * can possibly be activated.
474 	 *
475 	 * Params:
476 	 *     iter = a #GtkTextIter
477 	 *     area = a #GdkRectangle
478 	 *     event = the #GdkEvent that is causing the activatable query
479 	 */
480 	gulong addOnQueryActivatable(bool delegate(TextIter, GdkRectangle*, Event, SourceGutterRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
481 	{
482 		onQueryActivatableListeners ~= new OnQueryActivatableDelegateWrapper(dlg, 0, connectFlags);
483 		onQueryActivatableListeners[onQueryActivatableListeners.length - 1].handlerId = Signals.connectData(
484 			this,
485 			"query-activatable",
486 			cast(GCallback)&callBackQueryActivatable,
487 			cast(void*)onQueryActivatableListeners[onQueryActivatableListeners.length - 1],
488 			cast(GClosureNotify)&callBackQueryActivatableDestroy,
489 			connectFlags);
490 		return onQueryActivatableListeners[onQueryActivatableListeners.length - 1].handlerId;
491 	}
492 	
493 	extern(C) static int callBackQueryActivatable(GtkSourceGutterRenderer* sourcegutterrendererStruct, GtkTextIter* iter, GdkRectangle* area, GdkEvent* event,OnQueryActivatableDelegateWrapper wrapper)
494 	{
495 		return wrapper.dlg(ObjectG.getDObject!(TextIter)(iter), area, ObjectG.getDObject!(Event)(event), wrapper.outer);
496 	}
497 	
498 	extern(C) static void callBackQueryActivatableDestroy(OnQueryActivatableDelegateWrapper wrapper, GClosure* closure)
499 	{
500 		wrapper.outer.internalRemoveOnQueryActivatable(wrapper);
501 	}
502 
503 	protected void internalRemoveOnQueryActivatable(OnQueryActivatableDelegateWrapper source)
504 	{
505 		foreach(index, wrapper; onQueryActivatableListeners)
506 		{
507 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
508 			{
509 				onQueryActivatableListeners[index] = null;
510 				onQueryActivatableListeners = std.algorithm.remove(onQueryActivatableListeners, index);
511 				break;
512 			}
513 		}
514 	}
515 	
516 
517 	protected class OnQueryDataDelegateWrapper
518 	{
519 		void delegate(TextIter, TextIter, GtkSourceGutterRendererState, SourceGutterRenderer) dlg;
520 		gulong handlerId;
521 		ConnectFlags flags;
522 		this(void delegate(TextIter, TextIter, GtkSourceGutterRendererState, SourceGutterRenderer) dlg, gulong handlerId, ConnectFlags flags)
523 		{
524 			this.dlg = dlg;
525 			this.handlerId = handlerId;
526 			this.flags = flags;
527 		}
528 	}
529 	protected OnQueryDataDelegateWrapper[] onQueryDataListeners;
530 
531 	/**
532 	 * The ::query-data signal is emitted when the renderer needs
533 	 * to be filled with data just before a cell is drawn. This can
534 	 * be used by general renderer implementations to allow render
535 	 * data to be filled in externally.
536 	 *
537 	 * Params:
538 	 *     start = a #GtkTextIter
539 	 *     end = a #GtkTextIter
540 	 *     state = the renderer state
541 	 */
542 	gulong addOnQueryData(void delegate(TextIter, TextIter, GtkSourceGutterRendererState, SourceGutterRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
543 	{
544 		onQueryDataListeners ~= new OnQueryDataDelegateWrapper(dlg, 0, connectFlags);
545 		onQueryDataListeners[onQueryDataListeners.length - 1].handlerId = Signals.connectData(
546 			this,
547 			"query-data",
548 			cast(GCallback)&callBackQueryData,
549 			cast(void*)onQueryDataListeners[onQueryDataListeners.length - 1],
550 			cast(GClosureNotify)&callBackQueryDataDestroy,
551 			connectFlags);
552 		return onQueryDataListeners[onQueryDataListeners.length - 1].handlerId;
553 	}
554 	
555 	extern(C) static void callBackQueryData(GtkSourceGutterRenderer* sourcegutterrendererStruct, GtkTextIter* start, GtkTextIter* end, GtkSourceGutterRendererState state,OnQueryDataDelegateWrapper wrapper)
556 	{
557 		wrapper.dlg(ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), state, wrapper.outer);
558 	}
559 	
560 	extern(C) static void callBackQueryDataDestroy(OnQueryDataDelegateWrapper wrapper, GClosure* closure)
561 	{
562 		wrapper.outer.internalRemoveOnQueryData(wrapper);
563 	}
564 
565 	protected void internalRemoveOnQueryData(OnQueryDataDelegateWrapper source)
566 	{
567 		foreach(index, wrapper; onQueryDataListeners)
568 		{
569 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
570 			{
571 				onQueryDataListeners[index] = null;
572 				onQueryDataListeners = std.algorithm.remove(onQueryDataListeners, index);
573 				break;
574 			}
575 		}
576 	}
577 	
578 
579 	protected class OnQueryTooltipDelegateWrapper
580 	{
581 		bool delegate(TextIter, GdkRectangle*, int, int, Tooltip, SourceGutterRenderer) dlg;
582 		gulong handlerId;
583 		ConnectFlags flags;
584 		this(bool delegate(TextIter, GdkRectangle*, int, int, Tooltip, SourceGutterRenderer) dlg, gulong handlerId, ConnectFlags flags)
585 		{
586 			this.dlg = dlg;
587 			this.handlerId = handlerId;
588 			this.flags = flags;
589 		}
590 	}
591 	protected OnQueryTooltipDelegateWrapper[] onQueryTooltipListeners;
592 
593 	/**
594 	 * The ::query-tooltip signal is emitted when the renderer can
595 	 * show a tooltip.
596 	 *
597 	 * Params:
598 	 *     iter = a #GtkTextIter
599 	 *     area = a #GdkRectangle
600 	 *     x = the x position (in window coordinates)
601 	 *     y = the y position (in window coordinates)
602 	 *     tooltip = a #GtkTooltip
603 	 */
604 	gulong addOnQueryTooltip(bool delegate(TextIter, GdkRectangle*, int, int, Tooltip, SourceGutterRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
605 	{
606 		onQueryTooltipListeners ~= new OnQueryTooltipDelegateWrapper(dlg, 0, connectFlags);
607 		onQueryTooltipListeners[onQueryTooltipListeners.length - 1].handlerId = Signals.connectData(
608 			this,
609 			"query-tooltip",
610 			cast(GCallback)&callBackQueryTooltip,
611 			cast(void*)onQueryTooltipListeners[onQueryTooltipListeners.length - 1],
612 			cast(GClosureNotify)&callBackQueryTooltipDestroy,
613 			connectFlags);
614 		return onQueryTooltipListeners[onQueryTooltipListeners.length - 1].handlerId;
615 	}
616 	
617 	extern(C) static int callBackQueryTooltip(GtkSourceGutterRenderer* sourcegutterrendererStruct, GtkTextIter* iter, GdkRectangle* area, int x, int y, GtkTooltip* tooltip,OnQueryTooltipDelegateWrapper wrapper)
618 	{
619 		return wrapper.dlg(ObjectG.getDObject!(TextIter)(iter), area, x, y, ObjectG.getDObject!(Tooltip)(tooltip), wrapper.outer);
620 	}
621 	
622 	extern(C) static void callBackQueryTooltipDestroy(OnQueryTooltipDelegateWrapper wrapper, GClosure* closure)
623 	{
624 		wrapper.outer.internalRemoveOnQueryTooltip(wrapper);
625 	}
626 
627 	protected void internalRemoveOnQueryTooltip(OnQueryTooltipDelegateWrapper source)
628 	{
629 		foreach(index, wrapper; onQueryTooltipListeners)
630 		{
631 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
632 			{
633 				onQueryTooltipListeners[index] = null;
634 				onQueryTooltipListeners = std.algorithm.remove(onQueryTooltipListeners, index);
635 				break;
636 			}
637 		}
638 	}
639 	
640 
641 	protected class OnQueueDrawDelegateWrapper
642 	{
643 		void delegate(SourceGutterRenderer) dlg;
644 		gulong handlerId;
645 		ConnectFlags flags;
646 		this(void delegate(SourceGutterRenderer) dlg, gulong handlerId, ConnectFlags flags)
647 		{
648 			this.dlg = dlg;
649 			this.handlerId = handlerId;
650 			this.flags = flags;
651 		}
652 	}
653 	protected OnQueueDrawDelegateWrapper[] onQueueDrawListeners;
654 
655 	/**
656 	 * The ::queue-draw signal is emitted when the renderer needs
657 	 * to be redrawn. Use gtk_source_gutter_renderer_queue_draw()
658 	 * to emit this signal from an implementation of the
659 	 * #GtkSourceGutterRenderer interface.
660 	 */
661 	gulong addOnQueueDraw(void delegate(SourceGutterRenderer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
662 	{
663 		onQueueDrawListeners ~= new OnQueueDrawDelegateWrapper(dlg, 0, connectFlags);
664 		onQueueDrawListeners[onQueueDrawListeners.length - 1].handlerId = Signals.connectData(
665 			this,
666 			"queue-draw",
667 			cast(GCallback)&callBackQueueDraw,
668 			cast(void*)onQueueDrawListeners[onQueueDrawListeners.length - 1],
669 			cast(GClosureNotify)&callBackQueueDrawDestroy,
670 			connectFlags);
671 		return onQueueDrawListeners[onQueueDrawListeners.length - 1].handlerId;
672 	}
673 	
674 	extern(C) static void callBackQueueDraw(GtkSourceGutterRenderer* sourcegutterrendererStruct,OnQueueDrawDelegateWrapper wrapper)
675 	{
676 		wrapper.dlg(wrapper.outer);
677 	}
678 	
679 	extern(C) static void callBackQueueDrawDestroy(OnQueueDrawDelegateWrapper wrapper, GClosure* closure)
680 	{
681 		wrapper.outer.internalRemoveOnQueueDraw(wrapper);
682 	}
683 
684 	protected void internalRemoveOnQueueDraw(OnQueueDrawDelegateWrapper source)
685 	{
686 		foreach(index, wrapper; onQueueDrawListeners)
687 		{
688 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
689 			{
690 				onQueueDrawListeners[index] = null;
691 				onQueueDrawListeners = std.algorithm.remove(onQueueDrawListeners, index);
692 				break;
693 			}
694 		}
695 	}
696 	
697 }