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