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