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 gtk.Calendar;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gobject.Signals;
30 private import gtk.Widget;
31 public  import gtkc.gdktypes;
32 private import gtkc.gtk;
33 public  import gtkc.gtktypes;
34 private import std.algorithm;
35 
36 
37 /**
38  * #GtkCalendar is a widget that displays a Gregorian calendar, one month
39  * at a time. It can be created with gtk_calendar_new().
40  * 
41  * The month and year currently displayed can be altered with
42  * gtk_calendar_select_month(). The exact day can be selected from the
43  * displayed month using gtk_calendar_select_day().
44  * 
45  * To place a visual marker on a particular day, use gtk_calendar_mark_day()
46  * and to remove the marker, gtk_calendar_unmark_day(). Alternative, all
47  * marks can be cleared with gtk_calendar_clear_marks().
48  * 
49  * The way in which the calendar itself is displayed can be altered using
50  * gtk_calendar_set_display_options().
51  * 
52  * The selected date can be retrieved from a #GtkCalendar using
53  * gtk_calendar_get_date().
54  * 
55  * Users should be aware that, although the Gregorian calendar is the
56  * legal calendar in most countries, it was adopted progressively
57  * between 1582 and 1929. Display before these dates is likely to be
58  * historically incorrect.
59  */
60 public class Calendar : Widget
61 {
62 	/** the main Gtk struct */
63 	protected GtkCalendar* gtkCalendar;
64 
65 	/** Get the main Gtk struct */
66 	public GtkCalendar* getCalendarStruct()
67 	{
68 		return gtkCalendar;
69 	}
70 
71 	/** the main Gtk struct as a void* */
72 	protected override void* getStruct()
73 	{
74 		return cast(void*)gtkCalendar;
75 	}
76 
77 	protected override void setStruct(GObject* obj)
78 	{
79 		gtkCalendar = cast(GtkCalendar*)obj;
80 		super.setStruct(obj);
81 	}
82 
83 	/**
84 	 * Sets our main struct and passes it to the parent class.
85 	 */
86 	public this (GtkCalendar* gtkCalendar, bool ownedRef = false)
87 	{
88 		this.gtkCalendar = gtkCalendar;
89 		super(cast(GtkWidget*)gtkCalendar, ownedRef);
90 	}
91 
92 
93 	/** */
94 	public static GType getType()
95 	{
96 		return gtk_calendar_get_type();
97 	}
98 
99 	/**
100 	 * Creates a new calendar, with the current date being selected.
101 	 *
102 	 * Return: a newly #GtkCalendar widget
103 	 *
104 	 * Throws: ConstructionException GTK+ fails to create the object.
105 	 */
106 	public this()
107 	{
108 		auto p = gtk_calendar_new();
109 		
110 		if(p is null)
111 		{
112 			throw new ConstructionException("null returned by new");
113 		}
114 		
115 		this(cast(GtkCalendar*) p);
116 	}
117 
118 	/**
119 	 * Remove all visual markers.
120 	 */
121 	public void clearMarks()
122 	{
123 		gtk_calendar_clear_marks(gtkCalendar);
124 	}
125 
126 	/**
127 	 * Obtains the selected date from a #GtkCalendar.
128 	 *
129 	 * Params:
130 	 *     year = location to store the year as a decimal
131 	 *         number (e.g. 2011), or %NULL
132 	 *     month = location to store the month number
133 	 *         (between 0 and 11), or %NULL
134 	 *     day = location to store the day number (between
135 	 *         1 and 31), or %NULL
136 	 */
137 	public void getDate(out uint year, out uint month, out uint day)
138 	{
139 		gtk_calendar_get_date(gtkCalendar, &year, &month, &day);
140 	}
141 
142 	/**
143 	 * Returns if the @day of the @calendar is already marked.
144 	 *
145 	 * Params:
146 	 *     day = the day number between 1 and 31.
147 	 *
148 	 * Return: whether the day is marked.
149 	 *
150 	 * Since: 3.0
151 	 */
152 	public bool getDayIsMarked(uint day)
153 	{
154 		return gtk_calendar_get_day_is_marked(gtkCalendar, day) != 0;
155 	}
156 
157 	/**
158 	 * Queries the height of detail cells, in rows.
159 	 * See #GtkCalendar:detail-width-chars.
160 	 *
161 	 * Return: The height of detail cells, in rows.
162 	 *
163 	 * Since: 2.14
164 	 */
165 	public int getDetailHeightRows()
166 	{
167 		return gtk_calendar_get_detail_height_rows(gtkCalendar);
168 	}
169 
170 	/**
171 	 * Queries the width of detail cells, in characters.
172 	 * See #GtkCalendar:detail-width-chars.
173 	 *
174 	 * Return: The width of detail cells, in characters.
175 	 *
176 	 * Since: 2.14
177 	 */
178 	public int getDetailWidthChars()
179 	{
180 		return gtk_calendar_get_detail_width_chars(gtkCalendar);
181 	}
182 
183 	/**
184 	 * Returns the current display options of @calendar.
185 	 *
186 	 * Return: the display options.
187 	 *
188 	 * Since: 2.4
189 	 */
190 	public GtkCalendarDisplayOptions getDisplayOptions()
191 	{
192 		return gtk_calendar_get_display_options(gtkCalendar);
193 	}
194 
195 	/**
196 	 * Places a visual marker on a particular day.
197 	 *
198 	 * Params:
199 	 *     day = the day number to mark between 1 and 31.
200 	 */
201 	public void markDay(uint day)
202 	{
203 		gtk_calendar_mark_day(gtkCalendar, day);
204 	}
205 
206 	/**
207 	 * Selects a day from the current month.
208 	 *
209 	 * Params:
210 	 *     day = the day number between 1 and 31, or 0 to unselect
211 	 *         the currently selected day.
212 	 */
213 	public void selectDay(uint day)
214 	{
215 		gtk_calendar_select_day(gtkCalendar, day);
216 	}
217 
218 	/**
219 	 * Shifts the calendar to a different month.
220 	 *
221 	 * Params:
222 	 *     month = a month number between 0 and 11.
223 	 *     year = the year the month is in.
224 	 */
225 	public void selectMonth(uint month, uint year)
226 	{
227 		gtk_calendar_select_month(gtkCalendar, month, year);
228 	}
229 
230 	/**
231 	 * Installs a function which provides Pango markup with detail information
232 	 * for each day. Examples for such details are holidays or appointments. That
233 	 * information is shown below each day when #GtkCalendar:show-details is set.
234 	 * A tooltip containing with full detail information is provided, if the entire
235 	 * text should not fit into the details area, or if #GtkCalendar:show-details
236 	 * is not set.
237 	 *
238 	 * The size of the details area can be restricted by setting the
239 	 * #GtkCalendar:detail-width-chars and #GtkCalendar:detail-height-rows
240 	 * properties.
241 	 *
242 	 * Params:
243 	 *     func = a function providing details for each day.
244 	 *     data = data to pass to @func invokations.
245 	 *     destroy = a function for releasing @data.
246 	 *
247 	 * Since: 2.14
248 	 */
249 	public void setDetailFunc(GtkCalendarDetailFunc func, void* data, GDestroyNotify destroy)
250 	{
251 		gtk_calendar_set_detail_func(gtkCalendar, func, data, destroy);
252 	}
253 
254 	/**
255 	 * Updates the height of detail cells.
256 	 * See #GtkCalendar:detail-height-rows.
257 	 *
258 	 * Params:
259 	 *     rows = detail height in rows.
260 	 *
261 	 * Since: 2.14
262 	 */
263 	public void setDetailHeightRows(int rows)
264 	{
265 		gtk_calendar_set_detail_height_rows(gtkCalendar, rows);
266 	}
267 
268 	/**
269 	 * Updates the width of detail cells.
270 	 * See #GtkCalendar:detail-width-chars.
271 	 *
272 	 * Params:
273 	 *     chars = detail width in characters.
274 	 *
275 	 * Since: 2.14
276 	 */
277 	public void setDetailWidthChars(int chars)
278 	{
279 		gtk_calendar_set_detail_width_chars(gtkCalendar, chars);
280 	}
281 
282 	/**
283 	 * Sets display options (whether to display the heading and the month
284 	 * headings).
285 	 *
286 	 * Params:
287 	 *     flags = the display options to set
288 	 *
289 	 * Since: 2.4
290 	 */
291 	public void setDisplayOptions(GtkCalendarDisplayOptions flags)
292 	{
293 		gtk_calendar_set_display_options(gtkCalendar, flags);
294 	}
295 
296 	/**
297 	 * Removes the visual marker from a particular day.
298 	 *
299 	 * Params:
300 	 *     day = the day number to unmark between 1 and 31.
301 	 */
302 	public void unmarkDay(uint day)
303 	{
304 		gtk_calendar_unmark_day(gtkCalendar, day);
305 	}
306 
307 	protected class OnDaySelectedDelegateWrapper
308 	{
309 		void delegate(Calendar) dlg;
310 		gulong handlerId;
311 		ConnectFlags flags;
312 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
313 		{
314 			this.dlg = dlg;
315 			this.handlerId = handlerId;
316 			this.flags = flags;
317 		}
318 	}
319 	protected OnDaySelectedDelegateWrapper[] onDaySelectedListeners;
320 
321 	/**
322 	 * Emitted when the user selects a day.
323 	 */
324 	gulong addOnDaySelected(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
325 	{
326 		onDaySelectedListeners ~= new OnDaySelectedDelegateWrapper(dlg, 0, connectFlags);
327 		onDaySelectedListeners[onDaySelectedListeners.length - 1].handlerId = Signals.connectData(
328 			this,
329 			"day-selected",
330 			cast(GCallback)&callBackDaySelected,
331 			cast(void*)onDaySelectedListeners[onDaySelectedListeners.length - 1],
332 			cast(GClosureNotify)&callBackDaySelectedDestroy,
333 			connectFlags);
334 		return onDaySelectedListeners[onDaySelectedListeners.length - 1].handlerId;
335 	}
336 	
337 	extern(C) static void callBackDaySelected(GtkCalendar* calendarStruct,OnDaySelectedDelegateWrapper wrapper)
338 	{
339 		wrapper.dlg(wrapper.outer);
340 	}
341 	
342 	extern(C) static void callBackDaySelectedDestroy(OnDaySelectedDelegateWrapper wrapper, GClosure* closure)
343 	{
344 		wrapper.outer.internalRemoveOnDaySelected(wrapper);
345 	}
346 
347 	protected void internalRemoveOnDaySelected(OnDaySelectedDelegateWrapper source)
348 	{
349 		foreach(index, wrapper; onDaySelectedListeners)
350 		{
351 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
352 			{
353 				onDaySelectedListeners[index] = null;
354 				onDaySelectedListeners = std.algorithm.remove(onDaySelectedListeners, index);
355 				break;
356 			}
357 		}
358 	}
359 	
360 
361 	protected class OnDaySelectedDoubleClickDelegateWrapper
362 	{
363 		void delegate(Calendar) dlg;
364 		gulong handlerId;
365 		ConnectFlags flags;
366 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
367 		{
368 			this.dlg = dlg;
369 			this.handlerId = handlerId;
370 			this.flags = flags;
371 		}
372 	}
373 	protected OnDaySelectedDoubleClickDelegateWrapper[] onDaySelectedDoubleClickListeners;
374 
375 	/**
376 	 * Emitted when the user double-clicks a day.
377 	 */
378 	gulong addOnDaySelectedDoubleClick(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
379 	{
380 		onDaySelectedDoubleClickListeners ~= new OnDaySelectedDoubleClickDelegateWrapper(dlg, 0, connectFlags);
381 		onDaySelectedDoubleClickListeners[onDaySelectedDoubleClickListeners.length - 1].handlerId = Signals.connectData(
382 			this,
383 			"day-selected-double-click",
384 			cast(GCallback)&callBackDaySelectedDoubleClick,
385 			cast(void*)onDaySelectedDoubleClickListeners[onDaySelectedDoubleClickListeners.length - 1],
386 			cast(GClosureNotify)&callBackDaySelectedDoubleClickDestroy,
387 			connectFlags);
388 		return onDaySelectedDoubleClickListeners[onDaySelectedDoubleClickListeners.length - 1].handlerId;
389 	}
390 	
391 	extern(C) static void callBackDaySelectedDoubleClick(GtkCalendar* calendarStruct,OnDaySelectedDoubleClickDelegateWrapper wrapper)
392 	{
393 		wrapper.dlg(wrapper.outer);
394 	}
395 	
396 	extern(C) static void callBackDaySelectedDoubleClickDestroy(OnDaySelectedDoubleClickDelegateWrapper wrapper, GClosure* closure)
397 	{
398 		wrapper.outer.internalRemoveOnDaySelectedDoubleClick(wrapper);
399 	}
400 
401 	protected void internalRemoveOnDaySelectedDoubleClick(OnDaySelectedDoubleClickDelegateWrapper source)
402 	{
403 		foreach(index, wrapper; onDaySelectedDoubleClickListeners)
404 		{
405 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
406 			{
407 				onDaySelectedDoubleClickListeners[index] = null;
408 				onDaySelectedDoubleClickListeners = std.algorithm.remove(onDaySelectedDoubleClickListeners, index);
409 				break;
410 			}
411 		}
412 	}
413 	
414 
415 	protected class OnMonthChangedDelegateWrapper
416 	{
417 		void delegate(Calendar) dlg;
418 		gulong handlerId;
419 		ConnectFlags flags;
420 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
421 		{
422 			this.dlg = dlg;
423 			this.handlerId = handlerId;
424 			this.flags = flags;
425 		}
426 	}
427 	protected OnMonthChangedDelegateWrapper[] onMonthChangedListeners;
428 
429 	/**
430 	 * Emitted when the user clicks a button to change the selected month on a
431 	 * calendar.
432 	 */
433 	gulong addOnMonthChanged(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
434 	{
435 		onMonthChangedListeners ~= new OnMonthChangedDelegateWrapper(dlg, 0, connectFlags);
436 		onMonthChangedListeners[onMonthChangedListeners.length - 1].handlerId = Signals.connectData(
437 			this,
438 			"month-changed",
439 			cast(GCallback)&callBackMonthChanged,
440 			cast(void*)onMonthChangedListeners[onMonthChangedListeners.length - 1],
441 			cast(GClosureNotify)&callBackMonthChangedDestroy,
442 			connectFlags);
443 		return onMonthChangedListeners[onMonthChangedListeners.length - 1].handlerId;
444 	}
445 	
446 	extern(C) static void callBackMonthChanged(GtkCalendar* calendarStruct,OnMonthChangedDelegateWrapper wrapper)
447 	{
448 		wrapper.dlg(wrapper.outer);
449 	}
450 	
451 	extern(C) static void callBackMonthChangedDestroy(OnMonthChangedDelegateWrapper wrapper, GClosure* closure)
452 	{
453 		wrapper.outer.internalRemoveOnMonthChanged(wrapper);
454 	}
455 
456 	protected void internalRemoveOnMonthChanged(OnMonthChangedDelegateWrapper source)
457 	{
458 		foreach(index, wrapper; onMonthChangedListeners)
459 		{
460 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
461 			{
462 				onMonthChangedListeners[index] = null;
463 				onMonthChangedListeners = std.algorithm.remove(onMonthChangedListeners, index);
464 				break;
465 			}
466 		}
467 	}
468 	
469 
470 	protected class OnNextMonthDelegateWrapper
471 	{
472 		void delegate(Calendar) dlg;
473 		gulong handlerId;
474 		ConnectFlags flags;
475 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
476 		{
477 			this.dlg = dlg;
478 			this.handlerId = handlerId;
479 			this.flags = flags;
480 		}
481 	}
482 	protected OnNextMonthDelegateWrapper[] onNextMonthListeners;
483 
484 	/**
485 	 * Emitted when the user switched to the next month.
486 	 */
487 	gulong addOnNextMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
488 	{
489 		onNextMonthListeners ~= new OnNextMonthDelegateWrapper(dlg, 0, connectFlags);
490 		onNextMonthListeners[onNextMonthListeners.length - 1].handlerId = Signals.connectData(
491 			this,
492 			"next-month",
493 			cast(GCallback)&callBackNextMonth,
494 			cast(void*)onNextMonthListeners[onNextMonthListeners.length - 1],
495 			cast(GClosureNotify)&callBackNextMonthDestroy,
496 			connectFlags);
497 		return onNextMonthListeners[onNextMonthListeners.length - 1].handlerId;
498 	}
499 	
500 	extern(C) static void callBackNextMonth(GtkCalendar* calendarStruct,OnNextMonthDelegateWrapper wrapper)
501 	{
502 		wrapper.dlg(wrapper.outer);
503 	}
504 	
505 	extern(C) static void callBackNextMonthDestroy(OnNextMonthDelegateWrapper wrapper, GClosure* closure)
506 	{
507 		wrapper.outer.internalRemoveOnNextMonth(wrapper);
508 	}
509 
510 	protected void internalRemoveOnNextMonth(OnNextMonthDelegateWrapper source)
511 	{
512 		foreach(index, wrapper; onNextMonthListeners)
513 		{
514 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
515 			{
516 				onNextMonthListeners[index] = null;
517 				onNextMonthListeners = std.algorithm.remove(onNextMonthListeners, index);
518 				break;
519 			}
520 		}
521 	}
522 	
523 
524 	protected class OnNextYearDelegateWrapper
525 	{
526 		void delegate(Calendar) dlg;
527 		gulong handlerId;
528 		ConnectFlags flags;
529 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
530 		{
531 			this.dlg = dlg;
532 			this.handlerId = handlerId;
533 			this.flags = flags;
534 		}
535 	}
536 	protected OnNextYearDelegateWrapper[] onNextYearListeners;
537 
538 	/**
539 	 * Emitted when user switched to the next year.
540 	 */
541 	gulong addOnNextYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
542 	{
543 		onNextYearListeners ~= new OnNextYearDelegateWrapper(dlg, 0, connectFlags);
544 		onNextYearListeners[onNextYearListeners.length - 1].handlerId = Signals.connectData(
545 			this,
546 			"next-year",
547 			cast(GCallback)&callBackNextYear,
548 			cast(void*)onNextYearListeners[onNextYearListeners.length - 1],
549 			cast(GClosureNotify)&callBackNextYearDestroy,
550 			connectFlags);
551 		return onNextYearListeners[onNextYearListeners.length - 1].handlerId;
552 	}
553 	
554 	extern(C) static void callBackNextYear(GtkCalendar* calendarStruct,OnNextYearDelegateWrapper wrapper)
555 	{
556 		wrapper.dlg(wrapper.outer);
557 	}
558 	
559 	extern(C) static void callBackNextYearDestroy(OnNextYearDelegateWrapper wrapper, GClosure* closure)
560 	{
561 		wrapper.outer.internalRemoveOnNextYear(wrapper);
562 	}
563 
564 	protected void internalRemoveOnNextYear(OnNextYearDelegateWrapper source)
565 	{
566 		foreach(index, wrapper; onNextYearListeners)
567 		{
568 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
569 			{
570 				onNextYearListeners[index] = null;
571 				onNextYearListeners = std.algorithm.remove(onNextYearListeners, index);
572 				break;
573 			}
574 		}
575 	}
576 	
577 
578 	protected class OnPrevMonthDelegateWrapper
579 	{
580 		void delegate(Calendar) dlg;
581 		gulong handlerId;
582 		ConnectFlags flags;
583 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
584 		{
585 			this.dlg = dlg;
586 			this.handlerId = handlerId;
587 			this.flags = flags;
588 		}
589 	}
590 	protected OnPrevMonthDelegateWrapper[] onPrevMonthListeners;
591 
592 	/**
593 	 * Emitted when the user switched to the previous month.
594 	 */
595 	gulong addOnPrevMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
596 	{
597 		onPrevMonthListeners ~= new OnPrevMonthDelegateWrapper(dlg, 0, connectFlags);
598 		onPrevMonthListeners[onPrevMonthListeners.length - 1].handlerId = Signals.connectData(
599 			this,
600 			"prev-month",
601 			cast(GCallback)&callBackPrevMonth,
602 			cast(void*)onPrevMonthListeners[onPrevMonthListeners.length - 1],
603 			cast(GClosureNotify)&callBackPrevMonthDestroy,
604 			connectFlags);
605 		return onPrevMonthListeners[onPrevMonthListeners.length - 1].handlerId;
606 	}
607 	
608 	extern(C) static void callBackPrevMonth(GtkCalendar* calendarStruct,OnPrevMonthDelegateWrapper wrapper)
609 	{
610 		wrapper.dlg(wrapper.outer);
611 	}
612 	
613 	extern(C) static void callBackPrevMonthDestroy(OnPrevMonthDelegateWrapper wrapper, GClosure* closure)
614 	{
615 		wrapper.outer.internalRemoveOnPrevMonth(wrapper);
616 	}
617 
618 	protected void internalRemoveOnPrevMonth(OnPrevMonthDelegateWrapper source)
619 	{
620 		foreach(index, wrapper; onPrevMonthListeners)
621 		{
622 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
623 			{
624 				onPrevMonthListeners[index] = null;
625 				onPrevMonthListeners = std.algorithm.remove(onPrevMonthListeners, index);
626 				break;
627 			}
628 		}
629 	}
630 	
631 
632 	protected class OnPrevYearDelegateWrapper
633 	{
634 		void delegate(Calendar) dlg;
635 		gulong handlerId;
636 		ConnectFlags flags;
637 		this(void delegate(Calendar) dlg, gulong handlerId, ConnectFlags flags)
638 		{
639 			this.dlg = dlg;
640 			this.handlerId = handlerId;
641 			this.flags = flags;
642 		}
643 	}
644 	protected OnPrevYearDelegateWrapper[] onPrevYearListeners;
645 
646 	/**
647 	 * Emitted when user switched to the previous year.
648 	 */
649 	gulong addOnPrevYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
650 	{
651 		onPrevYearListeners ~= new OnPrevYearDelegateWrapper(dlg, 0, connectFlags);
652 		onPrevYearListeners[onPrevYearListeners.length - 1].handlerId = Signals.connectData(
653 			this,
654 			"prev-year",
655 			cast(GCallback)&callBackPrevYear,
656 			cast(void*)onPrevYearListeners[onPrevYearListeners.length - 1],
657 			cast(GClosureNotify)&callBackPrevYearDestroy,
658 			connectFlags);
659 		return onPrevYearListeners[onPrevYearListeners.length - 1].handlerId;
660 	}
661 	
662 	extern(C) static void callBackPrevYear(GtkCalendar* calendarStruct,OnPrevYearDelegateWrapper wrapper)
663 	{
664 		wrapper.dlg(wrapper.outer);
665 	}
666 	
667 	extern(C) static void callBackPrevYearDestroy(OnPrevYearDelegateWrapper wrapper, GClosure* closure)
668 	{
669 		wrapper.outer.internalRemoveOnPrevYear(wrapper);
670 	}
671 
672 	protected void internalRemoveOnPrevYear(OnPrevYearDelegateWrapper source)
673 	{
674 		foreach(index, wrapper; onPrevYearListeners)
675 		{
676 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
677 			{
678 				onPrevYearListeners[index] = null;
679 				onPrevYearListeners = std.algorithm.remove(onPrevYearListeners, index);
680 				break;
681 			}
682 		}
683 	}
684 	
685 }