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