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