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