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.Notebook;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.Container;
32 private import gtk.Label;
33 private import gtk.Widget;
34 private import gtk.c.functions;
35 public  import gtk.c.types;
36 public  import gtkc.gtktypes;
37 private import std.algorithm;
38 
39 
40 /**
41  * The #GtkNotebook widget is a #GtkContainer whose children are pages that
42  * can be switched between using tab labels along one edge.
43  * 
44  * There are many configuration options for GtkNotebook. Among other
45  * things, you can choose on which edge the tabs appear
46  * (see gtk_notebook_set_tab_pos()), whether, if there are too many
47  * tabs to fit the notebook should be made bigger or scrolling
48  * arrows added (see gtk_notebook_set_scrollable()), and whether there
49  * will be a popup menu allowing the users to switch pages.
50  * (see gtk_notebook_popup_enable(), gtk_notebook_popup_disable())
51  * 
52  * # GtkNotebook as GtkBuildable
53  * 
54  * The GtkNotebook implementation of the #GtkBuildable interface
55  * supports placing children into tabs by specifying “tab” as the
56  * “type” attribute of a <child> element. Note that the content
57  * of the tab must be created before the tab can be filled.
58  * A tab child can be specified without specifying a <child>
59  * type attribute.
60  * 
61  * To add a child widget in the notebooks action area, specify
62  * "action-start" or “action-end” as the “type” attribute of the
63  * <child> element.
64  * 
65  * An example of a UI definition fragment with GtkNotebook:
66  * |[
67  * <object class="GtkNotebook">
68  * <child>
69  * <object class="GtkLabel" id="notebook-content">
70  * <property name="label">Content</property>
71  * </object>
72  * </child>
73  * <child type="tab">
74  * <object class="GtkLabel" id="notebook-tab">
75  * <property name="label">Tab</property>
76  * </object>
77  * </child>
78  * </object>
79  * ]|
80  * 
81  * # CSS nodes
82  * 
83  * |[<!-- language="plain" -->
84  * notebook
85  * ├── header.top
86  * │   ├── [<action widget>]
87  * │   ├── tabs
88  * │   │   ├── [arrow]
89  * │   │   ├── tab
90  * │   │   │   ╰── <tab label>
91  * ┊   ┊   ┊
92  * │   │   ├── tab[.reorderable-page]
93  * │   │   │   ╰── <tab label>
94  * │   │   ╰── [arrow]
95  * │   ╰── [<action widget>]
96  * │
97  * ╰── stack
98  * ├── <child>
99  * ┊
100  * ╰── <child>
101  * ]|
102  * 
103  * GtkNotebook has a main CSS node with name notebook, a subnode
104  * with name header and below that a subnode with name tabs which
105  * contains one subnode per tab with name tab.
106  * 
107  * If action widgets are present, their CSS nodes are placed next
108  * to the tabs node. If the notebook is scrollable, CSS nodes with
109  * name arrow are placed as first and last child of the tabs node.
110  * 
111  * The main node gets the .frame style class when the notebook
112  * has a border (see gtk_notebook_set_show_border()).
113  * 
114  * The header node gets one of the style class .top, .bottom,
115  * .left or .right, depending on where the tabs are placed. For
116  * reorderable pages, the tab node gets the .reorderable-page class.
117  * 
118  * A tab node gets the .dnd style class while it is moved with drag-and-drop.
119  * 
120  * The nodes are always arranged from left-to-right, regarldess of text direction.
121  */
122 public class Notebook : Container
123 {
124 	/** the main Gtk struct */
125 	protected GtkNotebook* gtkNotebook;
126 
127 	/** Get the main Gtk struct */
128 	public GtkNotebook* getNotebookStruct(bool transferOwnership = false)
129 	{
130 		if (transferOwnership)
131 			ownedRef = false;
132 		return gtkNotebook;
133 	}
134 
135 	/** the main Gtk struct as a void* */
136 	protected override void* getStruct()
137 	{
138 		return cast(void*)gtkNotebook;
139 	}
140 
141 	protected override void setStruct(GObject* obj)
142 	{
143 		gtkNotebook = cast(GtkNotebook*)obj;
144 		super.setStruct(obj);
145 	}
146 
147 	/**
148 	 * Sets our main struct and passes it to the parent class.
149 	 */
150 	public this (GtkNotebook* gtkNotebook, bool ownedRef = false)
151 	{
152 		this.gtkNotebook = gtkNotebook;
153 		super(cast(GtkContainer*)gtkNotebook, ownedRef);
154 	}
155 
156 	/**
157 	 * Append a page with a widget and a text for a label
158 	 */
159 	public int appendPage(Widget child, string tabLabel)
160 	{
161 		return appendPage(child, new Label(tabLabel));
162 	}
163 
164 	/** */
165 	void setCurrentPage(Widget child)
166 	{
167 		gtk_notebook_set_current_page(gtkNotebook,gtk_notebook_page_num(gtkNotebook, child.getWidgetStruct()));
168 	}
169 
170 	/**
171 	 */
172 
173 	/** */
174 	public static GType getType()
175 	{
176 		return gtk_notebook_get_type();
177 	}
178 
179 	/**
180 	 * Creates a new #GtkNotebook widget with no pages.
181 	 *
182 	 * Returns: the newly created #GtkNotebook
183 	 *
184 	 * Throws: ConstructionException GTK+ fails to create the object.
185 	 */
186 	public this()
187 	{
188 		auto p = gtk_notebook_new();
189 
190 		if(p is null)
191 		{
192 			throw new ConstructionException("null returned by new");
193 		}
194 
195 		this(cast(GtkNotebook*) p);
196 	}
197 
198 	/**
199 	 * Appends a page to @notebook.
200 	 *
201 	 * Params:
202 	 *     child = the #GtkWidget to use as the contents of the page
203 	 *     tabLabel = the #GtkWidget to be used as the label
204 	 *         for the page, or %NULL to use the default label, “page N”
205 	 *
206 	 * Returns: the index (starting from 0) of the appended
207 	 *     page in the notebook, or -1 if function fails
208 	 */
209 	public int appendPage(Widget child, Widget tabLabel)
210 	{
211 		return gtk_notebook_append_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
212 	}
213 
214 	/**
215 	 * Appends a page to @notebook, specifying the widget to use as the
216 	 * label in the popup menu.
217 	 *
218 	 * Params:
219 	 *     child = the #GtkWidget to use as the contents of the page
220 	 *     tabLabel = the #GtkWidget to be used as the label
221 	 *         for the page, or %NULL to use the default label, “page N”
222 	 *     menuLabel = the widget to use as a label for the
223 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
224 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
225 	 *         created label with the same text as @tab_label; if @tab_label
226 	 *         is not a #GtkLabel, @menu_label must be specified if the
227 	 *         page-switch menu is to be used.
228 	 *
229 	 * Returns: the index (starting from 0) of the appended
230 	 *     page in the notebook, or -1 if function fails
231 	 */
232 	public int appendPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
233 	{
234 		return gtk_notebook_append_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
235 	}
236 
237 	/**
238 	 * Removes the child from the notebook.
239 	 *
240 	 * This function is very similar to gtk_container_remove(),
241 	 * but additionally informs the notebook that the removal
242 	 * is happening as part of a tab DND operation, which should
243 	 * not be cancelled.
244 	 *
245 	 * Params:
246 	 *     child = a child
247 	 *
248 	 * Since: 3.16
249 	 */
250 	public void detachTab(Widget child)
251 	{
252 		gtk_notebook_detach_tab(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
253 	}
254 
255 	/**
256 	 * Gets one of the action widgets. See gtk_notebook_set_action_widget().
257 	 *
258 	 * Params:
259 	 *     packType = pack type of the action widget to receive
260 	 *
261 	 * Returns: The action widget with the given
262 	 *     @pack_type or %NULL when this action widget has not been set
263 	 *
264 	 * Since: 2.20
265 	 */
266 	public Widget getActionWidget(GtkPackType packType)
267 	{
268 		auto p = gtk_notebook_get_action_widget(gtkNotebook, packType);
269 
270 		if(p is null)
271 		{
272 			return null;
273 		}
274 
275 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
276 	}
277 
278 	/**
279 	 * Returns the page number of the current page.
280 	 *
281 	 * Returns: the index (starting from 0) of the current
282 	 *     page in the notebook. If the notebook has no pages,
283 	 *     then -1 will be returned.
284 	 */
285 	public int getCurrentPage()
286 	{
287 		return gtk_notebook_get_current_page(gtkNotebook);
288 	}
289 
290 	/**
291 	 * Gets the current group name for @notebook.
292 	 *
293 	 * Returns: the group name, or %NULL if none is set
294 	 *
295 	 * Since: 2.24
296 	 */
297 	public string getGroupName()
298 	{
299 		return Str.toString(gtk_notebook_get_group_name(gtkNotebook));
300 	}
301 
302 	/**
303 	 * Retrieves the menu label widget of the page containing @child.
304 	 *
305 	 * Params:
306 	 *     child = a widget contained in a page of @notebook
307 	 *
308 	 * Returns: the menu label, or %NULL if the
309 	 *     notebook page does not have a menu label other than the default (the tab
310 	 *     label).
311 	 */
312 	public Widget getMenuLabel(Widget child)
313 	{
314 		auto p = gtk_notebook_get_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
315 
316 		if(p is null)
317 		{
318 			return null;
319 		}
320 
321 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
322 	}
323 
324 	/**
325 	 * Retrieves the text of the menu label for the page containing
326 	 * @child.
327 	 *
328 	 * Params:
329 	 *     child = the child widget of a page of the notebook.
330 	 *
331 	 * Returns: the text of the tab label, or %NULL if the widget does
332 	 *     not have a menu label other than the default menu label, or the menu label
333 	 *     widget is not a #GtkLabel. The string is owned by the widget and must not be
334 	 *     freed.
335 	 */
336 	public string getMenuLabelText(Widget child)
337 	{
338 		return Str.toString(gtk_notebook_get_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
339 	}
340 
341 	/**
342 	 * Gets the number of pages in a notebook.
343 	 *
344 	 * Returns: the number of pages in the notebook
345 	 *
346 	 * Since: 2.2
347 	 */
348 	public int getNPages()
349 	{
350 		return gtk_notebook_get_n_pages(gtkNotebook);
351 	}
352 
353 	/**
354 	 * Returns the child widget contained in page number @page_num.
355 	 *
356 	 * Params:
357 	 *     pageNum = the index of a page in the notebook, or -1
358 	 *         to get the last page
359 	 *
360 	 * Returns: the child widget, or %NULL if @page_num
361 	 *     is out of bounds
362 	 */
363 	public Widget getNthPage(int pageNum)
364 	{
365 		auto p = gtk_notebook_get_nth_page(gtkNotebook, pageNum);
366 
367 		if(p is null)
368 		{
369 			return null;
370 		}
371 
372 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
373 	}
374 
375 	/**
376 	 * Returns whether the tab label area has arrows for scrolling.
377 	 * See gtk_notebook_set_scrollable().
378 	 *
379 	 * Returns: %TRUE if arrows for scrolling are present
380 	 */
381 	public bool getScrollable()
382 	{
383 		return gtk_notebook_get_scrollable(gtkNotebook) != 0;
384 	}
385 
386 	/**
387 	 * Returns whether a bevel will be drawn around the notebook pages.
388 	 * See gtk_notebook_set_show_border().
389 	 *
390 	 * Returns: %TRUE if the bevel is drawn
391 	 */
392 	public bool getShowBorder()
393 	{
394 		return gtk_notebook_get_show_border(gtkNotebook) != 0;
395 	}
396 
397 	/**
398 	 * Returns whether the tabs of the notebook are shown.
399 	 * See gtk_notebook_set_show_tabs().
400 	 *
401 	 * Returns: %TRUE if the tabs are shown
402 	 */
403 	public bool getShowTabs()
404 	{
405 		return gtk_notebook_get_show_tabs(gtkNotebook) != 0;
406 	}
407 
408 	/**
409 	 * Returns whether the tab contents can be detached from @notebook.
410 	 *
411 	 * Params:
412 	 *     child = a child #GtkWidget
413 	 *
414 	 * Returns: %TRUE if the tab is detachable.
415 	 *
416 	 * Since: 2.10
417 	 */
418 	public bool getTabDetachable(Widget child)
419 	{
420 		return gtk_notebook_get_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
421 	}
422 
423 	/**
424 	 * Returns the horizontal width of a tab border.
425 	 *
426 	 * Deprecated: this function returns zero
427 	 *
428 	 * Returns: horizontal width of a tab border
429 	 *
430 	 * Since: 2.22
431 	 */
432 	public ushort getTabHborder()
433 	{
434 		return gtk_notebook_get_tab_hborder(gtkNotebook);
435 	}
436 
437 	/**
438 	 * Returns the tab label widget for the page @child.
439 	 * %NULL is returned if @child is not in @notebook or
440 	 * if no tab label has specifically been set for @child.
441 	 *
442 	 * Params:
443 	 *     child = the page
444 	 *
445 	 * Returns: the tab label
446 	 */
447 	public Widget getTabLabel(Widget child)
448 	{
449 		auto p = gtk_notebook_get_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
450 
451 		if(p is null)
452 		{
453 			return null;
454 		}
455 
456 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
457 	}
458 
459 	/**
460 	 * Retrieves the text of the tab label for the page containing
461 	 * @child.
462 	 *
463 	 * Params:
464 	 *     child = a widget contained in a page of @notebook
465 	 *
466 	 * Returns: the text of the tab label, or %NULL if the tab label
467 	 *     widget is not a #GtkLabel. The string is owned by the widget and must not be
468 	 *     freed.
469 	 */
470 	public string getTabLabelText(Widget child)
471 	{
472 		return Str.toString(gtk_notebook_get_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
473 	}
474 
475 	/**
476 	 * Gets the edge at which the tabs for switching pages in the
477 	 * notebook are drawn.
478 	 *
479 	 * Returns: the edge at which the tabs are drawn
480 	 */
481 	public GtkPositionType getTabPos()
482 	{
483 		return gtk_notebook_get_tab_pos(gtkNotebook);
484 	}
485 
486 	/**
487 	 * Gets whether the tab can be reordered via drag and drop or not.
488 	 *
489 	 * Params:
490 	 *     child = a child #GtkWidget
491 	 *
492 	 * Returns: %TRUE if the tab is reorderable.
493 	 *
494 	 * Since: 2.10
495 	 */
496 	public bool getTabReorderable(Widget child)
497 	{
498 		return gtk_notebook_get_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
499 	}
500 
501 	/**
502 	 * Returns the vertical width of a tab border.
503 	 *
504 	 * Deprecated: this function returns zero
505 	 *
506 	 * Returns: vertical width of a tab border
507 	 *
508 	 * Since: 2.22
509 	 */
510 	public ushort getTabVborder()
511 	{
512 		return gtk_notebook_get_tab_vborder(gtkNotebook);
513 	}
514 
515 	/**
516 	 * Insert a page into @notebook at the given position.
517 	 *
518 	 * Params:
519 	 *     child = the #GtkWidget to use as the contents of the page
520 	 *     tabLabel = the #GtkWidget to be used as the label
521 	 *         for the page, or %NULL to use the default label, “page N”
522 	 *     position = the index (starting at 0) at which to insert the page,
523 	 *         or -1 to append the page after all other pages
524 	 *
525 	 * Returns: the index (starting from 0) of the inserted
526 	 *     page in the notebook, or -1 if function fails
527 	 */
528 	public int insertPage(Widget child, Widget tabLabel, int position)
529 	{
530 		return gtk_notebook_insert_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), position);
531 	}
532 
533 	/**
534 	 * Insert a page into @notebook at the given position, specifying
535 	 * the widget to use as the label in the popup menu.
536 	 *
537 	 * Params:
538 	 *     child = the #GtkWidget to use as the contents of the page
539 	 *     tabLabel = the #GtkWidget to be used as the label
540 	 *         for the page, or %NULL to use the default label, “page N”
541 	 *     menuLabel = the widget to use as a label for the
542 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
543 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
544 	 *         created label with the same text as @tab_label; if @tab_label
545 	 *         is not a #GtkLabel, @menu_label must be specified if the
546 	 *         page-switch menu is to be used.
547 	 *     position = the index (starting at 0) at which to insert the page,
548 	 *         or -1 to append the page after all other pages.
549 	 *
550 	 * Returns: the index (starting from 0) of the inserted
551 	 *     page in the notebook
552 	 */
553 	public int insertPageMenu(Widget child, Widget tabLabel, Widget menuLabel, int position)
554 	{
555 		return gtk_notebook_insert_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct(), position);
556 	}
557 
558 	/**
559 	 * Switches to the next page. Nothing happens if the current page is
560 	 * the last page.
561 	 */
562 	public void nextPage()
563 	{
564 		gtk_notebook_next_page(gtkNotebook);
565 	}
566 
567 	/**
568 	 * Finds the index of the page which contains the given child
569 	 * widget.
570 	 *
571 	 * Params:
572 	 *     child = a #GtkWidget
573 	 *
574 	 * Returns: the index of the page containing @child, or
575 	 *     -1 if @child is not in the notebook
576 	 */
577 	public int pageNum(Widget child)
578 	{
579 		return gtk_notebook_page_num(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
580 	}
581 
582 	/**
583 	 * Disables the popup menu.
584 	 */
585 	public void popupDisable()
586 	{
587 		gtk_notebook_popup_disable(gtkNotebook);
588 	}
589 
590 	/**
591 	 * Enables the popup menu: if the user clicks with the right
592 	 * mouse button on the tab labels, a menu with all the pages
593 	 * will be popped up.
594 	 */
595 	public void popupEnable()
596 	{
597 		gtk_notebook_popup_enable(gtkNotebook);
598 	}
599 
600 	/**
601 	 * Prepends a page to @notebook.
602 	 *
603 	 * Params:
604 	 *     child = the #GtkWidget to use as the contents of the page
605 	 *     tabLabel = the #GtkWidget to be used as the label
606 	 *         for the page, or %NULL to use the default label, “page N”
607 	 *
608 	 * Returns: the index (starting from 0) of the prepended
609 	 *     page in the notebook, or -1 if function fails
610 	 */
611 	public int prependPage(Widget child, Widget tabLabel)
612 	{
613 		return gtk_notebook_prepend_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
614 	}
615 
616 	/**
617 	 * Prepends a page to @notebook, specifying the widget to use as the
618 	 * label in the popup menu.
619 	 *
620 	 * Params:
621 	 *     child = the #GtkWidget to use as the contents of the page
622 	 *     tabLabel = the #GtkWidget to be used as the label
623 	 *         for the page, or %NULL to use the default label, “page N”
624 	 *     menuLabel = the widget to use as a label for the
625 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
626 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
627 	 *         created label with the same text as @tab_label; if @tab_label
628 	 *         is not a #GtkLabel, @menu_label must be specified if the
629 	 *         page-switch menu is to be used.
630 	 *
631 	 * Returns: the index (starting from 0) of the prepended
632 	 *     page in the notebook, or -1 if function fails
633 	 */
634 	public int prependPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
635 	{
636 		return gtk_notebook_prepend_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
637 	}
638 
639 	/**
640 	 * Switches to the previous page. Nothing happens if the current page
641 	 * is the first page.
642 	 */
643 	public void prevPage()
644 	{
645 		gtk_notebook_prev_page(gtkNotebook);
646 	}
647 
648 	/**
649 	 * Removes a page from the notebook given its index
650 	 * in the notebook.
651 	 *
652 	 * Params:
653 	 *     pageNum = the index of a notebook page, starting
654 	 *         from 0. If -1, the last page will be removed.
655 	 */
656 	public void removePage(int pageNum)
657 	{
658 		gtk_notebook_remove_page(gtkNotebook, pageNum);
659 	}
660 
661 	/**
662 	 * Reorders the page containing @child, so that it appears in position
663 	 * @position. If @position is greater than or equal to the number of
664 	 * children in the list or negative, @child will be moved to the end
665 	 * of the list.
666 	 *
667 	 * Params:
668 	 *     child = the child to move
669 	 *     position = the new position, or -1 to move to the end
670 	 */
671 	public void reorderChild(Widget child, int position)
672 	{
673 		gtk_notebook_reorder_child(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), position);
674 	}
675 
676 	/**
677 	 * Sets @widget as one of the action widgets. Depending on the pack type
678 	 * the widget will be placed before or after the tabs. You can use
679 	 * a #GtkBox if you need to pack more than one widget on the same side.
680 	 *
681 	 * Note that action widgets are “internal” children of the notebook and thus
682 	 * not included in the list returned from gtk_container_foreach().
683 	 *
684 	 * Params:
685 	 *     widget = a #GtkWidget
686 	 *     packType = pack type of the action widget
687 	 *
688 	 * Since: 2.20
689 	 */
690 	public void setActionWidget(Widget widget, GtkPackType packType)
691 	{
692 		gtk_notebook_set_action_widget(gtkNotebook, (widget is null) ? null : widget.getWidgetStruct(), packType);
693 	}
694 
695 	/**
696 	 * Switches to the page number @page_num.
697 	 *
698 	 * Note that due to historical reasons, GtkNotebook refuses
699 	 * to switch to a page unless the child widget is visible.
700 	 * Therefore, it is recommended to show child widgets before
701 	 * adding them to a notebook.
702 	 *
703 	 * Params:
704 	 *     pageNum = index of the page to switch to, starting from 0.
705 	 *         If negative, the last page will be used. If greater
706 	 *         than the number of pages in the notebook, nothing
707 	 *         will be done.
708 	 */
709 	public void setCurrentPage(int pageNum)
710 	{
711 		gtk_notebook_set_current_page(gtkNotebook, pageNum);
712 	}
713 
714 	/**
715 	 * Sets a group name for @notebook.
716 	 *
717 	 * Notebooks with the same name will be able to exchange tabs
718 	 * via drag and drop. A notebook with a %NULL group name will
719 	 * not be able to exchange tabs with any other notebook.
720 	 *
721 	 * Params:
722 	 *     groupName = the name of the notebook group,
723 	 *         or %NULL to unset it
724 	 *
725 	 * Since: 2.24
726 	 */
727 	public void setGroupName(string groupName)
728 	{
729 		gtk_notebook_set_group_name(gtkNotebook, Str.toStringz(groupName));
730 	}
731 
732 	/**
733 	 * Changes the menu label for the page containing @child.
734 	 *
735 	 * Params:
736 	 *     child = the child widget
737 	 *     menuLabel = the menu label, or %NULL for default
738 	 */
739 	public void setMenuLabel(Widget child, Widget menuLabel)
740 	{
741 		gtk_notebook_set_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
742 	}
743 
744 	/**
745 	 * Creates a new label and sets it as the menu label of @child.
746 	 *
747 	 * Params:
748 	 *     child = the child widget
749 	 *     menuText = the label text
750 	 */
751 	public void setMenuLabelText(Widget child, string menuText)
752 	{
753 		gtk_notebook_set_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(menuText));
754 	}
755 
756 	/**
757 	 * Sets whether the tab label area will have arrows for
758 	 * scrolling if there are too many tabs to fit in the area.
759 	 *
760 	 * Params:
761 	 *     scrollable = %TRUE if scroll arrows should be added
762 	 */
763 	public void setScrollable(bool scrollable)
764 	{
765 		gtk_notebook_set_scrollable(gtkNotebook, scrollable);
766 	}
767 
768 	/**
769 	 * Sets whether a bevel will be drawn around the notebook pages.
770 	 * This only has a visual effect when the tabs are not shown.
771 	 * See gtk_notebook_set_show_tabs().
772 	 *
773 	 * Params:
774 	 *     showBorder = %TRUE if a bevel should be drawn around the notebook
775 	 */
776 	public void setShowBorder(bool showBorder)
777 	{
778 		gtk_notebook_set_show_border(gtkNotebook, showBorder);
779 	}
780 
781 	/**
782 	 * Sets whether to show the tabs for the notebook or not.
783 	 *
784 	 * Params:
785 	 *     showTabs = %TRUE if the tabs should be shown
786 	 */
787 	public void setShowTabs(bool showTabs)
788 	{
789 		gtk_notebook_set_show_tabs(gtkNotebook, showTabs);
790 	}
791 
792 	/**
793 	 * Sets whether the tab can be detached from @notebook to another
794 	 * notebook or widget.
795 	 *
796 	 * Note that 2 notebooks must share a common group identificator
797 	 * (see gtk_notebook_set_group_name()) to allow automatic tabs
798 	 * interchange between them.
799 	 *
800 	 * If you want a widget to interact with a notebook through DnD
801 	 * (i.e.: accept dragged tabs from it) it must be set as a drop
802 	 * destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook
803 	 * will fill the selection with a GtkWidget** pointing to the child
804 	 * widget that corresponds to the dropped tab.
805 	 *
806 	 * Note that you should use gtk_notebook_detach_tab() instead
807 	 * of gtk_container_remove() if you want to remove the tab from
808 	 * the source notebook as part of accepting a drop. Otherwise,
809 	 * the source notebook will think that the dragged tab was
810 	 * removed from underneath the ongoing drag operation, and
811 	 * will initiate a drag cancel animation.
812 	 *
813 	 * |[<!-- language="C" -->
814 	 * static void
815 	 * on_drag_data_received (GtkWidget        *widget,
816 	 * GdkDragContext   *context,
817 	 * gint              x,
818 	 * gint              y,
819 	 * GtkSelectionData *data,
820 	 * guint             info,
821 	 * guint             time,
822 	 * gpointer          user_data)
823 	 * {
824 	 * GtkWidget *notebook;
825 	 * GtkWidget **child;
826 	 *
827 	 * notebook = gtk_drag_get_source_widget (context);
828 	 * child = (void*) gtk_selection_data_get_data (data);
829 	 *
830 	 * process_widget (*child);
831 	 * gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
832 	 * }
833 	 * ]|
834 	 *
835 	 * If you want a notebook to accept drags from other widgets,
836 	 * you will have to set your own DnD code to do it.
837 	 *
838 	 * Params:
839 	 *     child = a child #GtkWidget
840 	 *     detachable = whether the tab is detachable or not
841 	 *
842 	 * Since: 2.10
843 	 */
844 	public void setTabDetachable(Widget child, bool detachable)
845 	{
846 		gtk_notebook_set_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), detachable);
847 	}
848 
849 	/**
850 	 * Changes the tab label for @child.
851 	 * If %NULL is specified for @tab_label, then the page will
852 	 * have the label “page N”.
853 	 *
854 	 * Params:
855 	 *     child = the page
856 	 *     tabLabel = the tab label widget to use, or %NULL
857 	 *         for default tab label
858 	 */
859 	public void setTabLabel(Widget child, Widget tabLabel)
860 	{
861 		gtk_notebook_set_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
862 	}
863 
864 	/**
865 	 * Creates a new label and sets it as the tab label for the page
866 	 * containing @child.
867 	 *
868 	 * Params:
869 	 *     child = the page
870 	 *     tabText = the label text
871 	 */
872 	public void setTabLabelText(Widget child, string tabText)
873 	{
874 		gtk_notebook_set_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(tabText));
875 	}
876 
877 	/**
878 	 * Sets the edge at which the tabs for switching pages in the
879 	 * notebook are drawn.
880 	 *
881 	 * Params:
882 	 *     pos = the edge to draw the tabs at
883 	 */
884 	public void setTabPos(GtkPositionType pos)
885 	{
886 		gtk_notebook_set_tab_pos(gtkNotebook, pos);
887 	}
888 
889 	/**
890 	 * Sets whether the notebook tab can be reordered
891 	 * via drag and drop or not.
892 	 *
893 	 * Params:
894 	 *     child = a child #GtkWidget
895 	 *     reorderable = whether the tab is reorderable or not
896 	 *
897 	 * Since: 2.10
898 	 */
899 	public void setTabReorderable(Widget child, bool reorderable)
900 	{
901 		gtk_notebook_set_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), reorderable);
902 	}
903 
904 	protected class OnChangeCurrentPageDelegateWrapper
905 	{
906 		bool delegate(int, Notebook) dlg;
907 		gulong handlerId;
908 
909 		this(bool delegate(int, Notebook) dlg)
910 		{
911 			this.dlg = dlg;
912 			onChangeCurrentPageListeners ~= this;
913 		}
914 
915 		void remove(OnChangeCurrentPageDelegateWrapper source)
916 		{
917 			foreach(index, wrapper; onChangeCurrentPageListeners)
918 			{
919 				if (wrapper.handlerId == source.handlerId)
920 				{
921 					onChangeCurrentPageListeners[index] = null;
922 					onChangeCurrentPageListeners = std.algorithm.remove(onChangeCurrentPageListeners, index);
923 					break;
924 				}
925 			}
926 		}
927 	}
928 	OnChangeCurrentPageDelegateWrapper[] onChangeCurrentPageListeners;
929 
930 	/** */
931 	gulong addOnChangeCurrentPage(bool delegate(int, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
932 	{
933 		auto wrapper = new OnChangeCurrentPageDelegateWrapper(dlg);
934 		wrapper.handlerId = Signals.connectData(
935 			this,
936 			"change-current-page",
937 			cast(GCallback)&callBackChangeCurrentPage,
938 			cast(void*)wrapper,
939 			cast(GClosureNotify)&callBackChangeCurrentPageDestroy,
940 			connectFlags);
941 		return wrapper.handlerId;
942 	}
943 
944 	extern(C) static int callBackChangeCurrentPage(GtkNotebook* notebookStruct, int object, OnChangeCurrentPageDelegateWrapper wrapper)
945 	{
946 		return wrapper.dlg(object, wrapper.outer);
947 	}
948 
949 	extern(C) static void callBackChangeCurrentPageDestroy(OnChangeCurrentPageDelegateWrapper wrapper, GClosure* closure)
950 	{
951 		wrapper.remove(wrapper);
952 	}
953 
954 	protected class OnCreateWindowDelegateWrapper
955 	{
956 		Notebook delegate(Widget, int, int, Notebook) dlg;
957 		gulong handlerId;
958 
959 		this(Notebook delegate(Widget, int, int, Notebook) dlg)
960 		{
961 			this.dlg = dlg;
962 			onCreateWindowListeners ~= this;
963 		}
964 
965 		void remove(OnCreateWindowDelegateWrapper source)
966 		{
967 			foreach(index, wrapper; onCreateWindowListeners)
968 			{
969 				if (wrapper.handlerId == source.handlerId)
970 				{
971 					onCreateWindowListeners[index] = null;
972 					onCreateWindowListeners = std.algorithm.remove(onCreateWindowListeners, index);
973 					break;
974 				}
975 			}
976 		}
977 	}
978 	OnCreateWindowDelegateWrapper[] onCreateWindowListeners;
979 
980 	/**
981 	 * The ::create-window signal is emitted when a detachable
982 	 * tab is dropped on the root window.
983 	 *
984 	 * A handler for this signal can create a window containing
985 	 * a notebook where the tab will be attached. It is also
986 	 * responsible for moving/resizing the window and adding the
987 	 * necessary properties to the notebook (e.g. the
988 	 * #GtkNotebook:group-name ).
989 	 *
990 	 * Params:
991 	 *     page = the tab of @notebook that is being detached
992 	 *     x = the X coordinate where the drop happens
993 	 *     y = the Y coordinate where the drop happens
994 	 *
995 	 * Returns: a #GtkNotebook that @page should be
996 	 *     added to, or %NULL.
997 	 *
998 	 * Since: 2.12
999 	 */
1000 	gulong addOnCreateWindow(Notebook delegate(Widget, int, int, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1001 	{
1002 		auto wrapper = new OnCreateWindowDelegateWrapper(dlg);
1003 		wrapper.handlerId = Signals.connectData(
1004 			this,
1005 			"create-window",
1006 			cast(GCallback)&callBackCreateWindow,
1007 			cast(void*)wrapper,
1008 			cast(GClosureNotify)&callBackCreateWindowDestroy,
1009 			connectFlags);
1010 		return wrapper.handlerId;
1011 	}
1012 
1013 	extern(C) static GtkNotebook* callBackCreateWindow(GtkNotebook* notebookStruct, GtkWidget* page, int x, int y, OnCreateWindowDelegateWrapper wrapper)
1014 	{
1015 		auto r = wrapper.dlg(ObjectG.getDObject!(Widget)(page), x, y, wrapper.outer);
1016 		return r.getNotebookStruct();
1017 	}
1018 
1019 	extern(C) static void callBackCreateWindowDestroy(OnCreateWindowDelegateWrapper wrapper, GClosure* closure)
1020 	{
1021 		wrapper.remove(wrapper);
1022 	}
1023 
1024 	protected class OnFocusTabDelegateWrapper
1025 	{
1026 		bool delegate(GtkNotebookTab, Notebook) dlg;
1027 		gulong handlerId;
1028 
1029 		this(bool delegate(GtkNotebookTab, Notebook) dlg)
1030 		{
1031 			this.dlg = dlg;
1032 			onFocusTabListeners ~= this;
1033 		}
1034 
1035 		void remove(OnFocusTabDelegateWrapper source)
1036 		{
1037 			foreach(index, wrapper; onFocusTabListeners)
1038 			{
1039 				if (wrapper.handlerId == source.handlerId)
1040 				{
1041 					onFocusTabListeners[index] = null;
1042 					onFocusTabListeners = std.algorithm.remove(onFocusTabListeners, index);
1043 					break;
1044 				}
1045 			}
1046 		}
1047 	}
1048 	OnFocusTabDelegateWrapper[] onFocusTabListeners;
1049 
1050 	/** */
1051 	gulong addOnFocusTab(bool delegate(GtkNotebookTab, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1052 	{
1053 		auto wrapper = new OnFocusTabDelegateWrapper(dlg);
1054 		wrapper.handlerId = Signals.connectData(
1055 			this,
1056 			"focus-tab",
1057 			cast(GCallback)&callBackFocusTab,
1058 			cast(void*)wrapper,
1059 			cast(GClosureNotify)&callBackFocusTabDestroy,
1060 			connectFlags);
1061 		return wrapper.handlerId;
1062 	}
1063 
1064 	extern(C) static int callBackFocusTab(GtkNotebook* notebookStruct, GtkNotebookTab object, OnFocusTabDelegateWrapper wrapper)
1065 	{
1066 		return wrapper.dlg(object, wrapper.outer);
1067 	}
1068 
1069 	extern(C) static void callBackFocusTabDestroy(OnFocusTabDelegateWrapper wrapper, GClosure* closure)
1070 	{
1071 		wrapper.remove(wrapper);
1072 	}
1073 
1074 	protected class OnMoveFocusOutDelegateWrapper
1075 	{
1076 		void delegate(GtkDirectionType, Notebook) dlg;
1077 		gulong handlerId;
1078 
1079 		this(void delegate(GtkDirectionType, Notebook) dlg)
1080 		{
1081 			this.dlg = dlg;
1082 			onMoveFocusOutListeners ~= this;
1083 		}
1084 
1085 		void remove(OnMoveFocusOutDelegateWrapper source)
1086 		{
1087 			foreach(index, wrapper; onMoveFocusOutListeners)
1088 			{
1089 				if (wrapper.handlerId == source.handlerId)
1090 				{
1091 					onMoveFocusOutListeners[index] = null;
1092 					onMoveFocusOutListeners = std.algorithm.remove(onMoveFocusOutListeners, index);
1093 					break;
1094 				}
1095 			}
1096 		}
1097 	}
1098 	OnMoveFocusOutDelegateWrapper[] onMoveFocusOutListeners;
1099 
1100 	/** */
1101 	gulong addOnMoveFocusOut(void delegate(GtkDirectionType, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1102 	{
1103 		auto wrapper = new OnMoveFocusOutDelegateWrapper(dlg);
1104 		wrapper.handlerId = Signals.connectData(
1105 			this,
1106 			"move-focus-out",
1107 			cast(GCallback)&callBackMoveFocusOut,
1108 			cast(void*)wrapper,
1109 			cast(GClosureNotify)&callBackMoveFocusOutDestroy,
1110 			connectFlags);
1111 		return wrapper.handlerId;
1112 	}
1113 
1114 	extern(C) static void callBackMoveFocusOut(GtkNotebook* notebookStruct, GtkDirectionType object, OnMoveFocusOutDelegateWrapper wrapper)
1115 	{
1116 		wrapper.dlg(object, wrapper.outer);
1117 	}
1118 
1119 	extern(C) static void callBackMoveFocusOutDestroy(OnMoveFocusOutDelegateWrapper wrapper, GClosure* closure)
1120 	{
1121 		wrapper.remove(wrapper);
1122 	}
1123 
1124 	protected class OnPageAddedDelegateWrapper
1125 	{
1126 		void delegate(Widget, uint, Notebook) dlg;
1127 		gulong handlerId;
1128 
1129 		this(void delegate(Widget, uint, Notebook) dlg)
1130 		{
1131 			this.dlg = dlg;
1132 			onPageAddedListeners ~= this;
1133 		}
1134 
1135 		void remove(OnPageAddedDelegateWrapper source)
1136 		{
1137 			foreach(index, wrapper; onPageAddedListeners)
1138 			{
1139 				if (wrapper.handlerId == source.handlerId)
1140 				{
1141 					onPageAddedListeners[index] = null;
1142 					onPageAddedListeners = std.algorithm.remove(onPageAddedListeners, index);
1143 					break;
1144 				}
1145 			}
1146 		}
1147 	}
1148 	OnPageAddedDelegateWrapper[] onPageAddedListeners;
1149 
1150 	/**
1151 	 * the ::page-added signal is emitted in the notebook
1152 	 * right after a page is added to the notebook.
1153 	 *
1154 	 * Params:
1155 	 *     child = the child #GtkWidget affected
1156 	 *     pageNum = the new page number for @child
1157 	 *
1158 	 * Since: 2.10
1159 	 */
1160 	gulong addOnPageAdded(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1161 	{
1162 		auto wrapper = new OnPageAddedDelegateWrapper(dlg);
1163 		wrapper.handlerId = Signals.connectData(
1164 			this,
1165 			"page-added",
1166 			cast(GCallback)&callBackPageAdded,
1167 			cast(void*)wrapper,
1168 			cast(GClosureNotify)&callBackPageAddedDestroy,
1169 			connectFlags);
1170 		return wrapper.handlerId;
1171 	}
1172 
1173 	extern(C) static void callBackPageAdded(GtkNotebook* notebookStruct, GtkWidget* child, uint pageNum, OnPageAddedDelegateWrapper wrapper)
1174 	{
1175 		wrapper.dlg(ObjectG.getDObject!(Widget)(child), pageNum, wrapper.outer);
1176 	}
1177 
1178 	extern(C) static void callBackPageAddedDestroy(OnPageAddedDelegateWrapper wrapper, GClosure* closure)
1179 	{
1180 		wrapper.remove(wrapper);
1181 	}
1182 
1183 	protected class OnPageRemovedDelegateWrapper
1184 	{
1185 		void delegate(Widget, uint, Notebook) dlg;
1186 		gulong handlerId;
1187 
1188 		this(void delegate(Widget, uint, Notebook) dlg)
1189 		{
1190 			this.dlg = dlg;
1191 			onPageRemovedListeners ~= this;
1192 		}
1193 
1194 		void remove(OnPageRemovedDelegateWrapper source)
1195 		{
1196 			foreach(index, wrapper; onPageRemovedListeners)
1197 			{
1198 				if (wrapper.handlerId == source.handlerId)
1199 				{
1200 					onPageRemovedListeners[index] = null;
1201 					onPageRemovedListeners = std.algorithm.remove(onPageRemovedListeners, index);
1202 					break;
1203 				}
1204 			}
1205 		}
1206 	}
1207 	OnPageRemovedDelegateWrapper[] onPageRemovedListeners;
1208 
1209 	/**
1210 	 * the ::page-removed signal is emitted in the notebook
1211 	 * right after a page is removed from the notebook.
1212 	 *
1213 	 * Params:
1214 	 *     child = the child #GtkWidget affected
1215 	 *     pageNum = the @child page number
1216 	 *
1217 	 * Since: 2.10
1218 	 */
1219 	gulong addOnPageRemoved(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1220 	{
1221 		auto wrapper = new OnPageRemovedDelegateWrapper(dlg);
1222 		wrapper.handlerId = Signals.connectData(
1223 			this,
1224 			"page-removed",
1225 			cast(GCallback)&callBackPageRemoved,
1226 			cast(void*)wrapper,
1227 			cast(GClosureNotify)&callBackPageRemovedDestroy,
1228 			connectFlags);
1229 		return wrapper.handlerId;
1230 	}
1231 
1232 	extern(C) static void callBackPageRemoved(GtkNotebook* notebookStruct, GtkWidget* child, uint pageNum, OnPageRemovedDelegateWrapper wrapper)
1233 	{
1234 		wrapper.dlg(ObjectG.getDObject!(Widget)(child), pageNum, wrapper.outer);
1235 	}
1236 
1237 	extern(C) static void callBackPageRemovedDestroy(OnPageRemovedDelegateWrapper wrapper, GClosure* closure)
1238 	{
1239 		wrapper.remove(wrapper);
1240 	}
1241 
1242 	protected class OnPageReorderedDelegateWrapper
1243 	{
1244 		void delegate(Widget, uint, Notebook) dlg;
1245 		gulong handlerId;
1246 
1247 		this(void delegate(Widget, uint, Notebook) dlg)
1248 		{
1249 			this.dlg = dlg;
1250 			onPageReorderedListeners ~= this;
1251 		}
1252 
1253 		void remove(OnPageReorderedDelegateWrapper source)
1254 		{
1255 			foreach(index, wrapper; onPageReorderedListeners)
1256 			{
1257 				if (wrapper.handlerId == source.handlerId)
1258 				{
1259 					onPageReorderedListeners[index] = null;
1260 					onPageReorderedListeners = std.algorithm.remove(onPageReorderedListeners, index);
1261 					break;
1262 				}
1263 			}
1264 		}
1265 	}
1266 	OnPageReorderedDelegateWrapper[] onPageReorderedListeners;
1267 
1268 	/**
1269 	 * the ::page-reordered signal is emitted in the notebook
1270 	 * right after a page has been reordered.
1271 	 *
1272 	 * Params:
1273 	 *     child = the child #GtkWidget affected
1274 	 *     pageNum = the new page number for @child
1275 	 *
1276 	 * Since: 2.10
1277 	 */
1278 	gulong addOnPageReordered(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1279 	{
1280 		auto wrapper = new OnPageReorderedDelegateWrapper(dlg);
1281 		wrapper.handlerId = Signals.connectData(
1282 			this,
1283 			"page-reordered",
1284 			cast(GCallback)&callBackPageReordered,
1285 			cast(void*)wrapper,
1286 			cast(GClosureNotify)&callBackPageReorderedDestroy,
1287 			connectFlags);
1288 		return wrapper.handlerId;
1289 	}
1290 
1291 	extern(C) static void callBackPageReordered(GtkNotebook* notebookStruct, GtkWidget* child, uint pageNum, OnPageReorderedDelegateWrapper wrapper)
1292 	{
1293 		wrapper.dlg(ObjectG.getDObject!(Widget)(child), pageNum, wrapper.outer);
1294 	}
1295 
1296 	extern(C) static void callBackPageReorderedDestroy(OnPageReorderedDelegateWrapper wrapper, GClosure* closure)
1297 	{
1298 		wrapper.remove(wrapper);
1299 	}
1300 
1301 	protected class OnReorderTabDelegateWrapper
1302 	{
1303 		bool delegate(GtkDirectionType, bool, Notebook) dlg;
1304 		gulong handlerId;
1305 
1306 		this(bool delegate(GtkDirectionType, bool, Notebook) dlg)
1307 		{
1308 			this.dlg = dlg;
1309 			onReorderTabListeners ~= this;
1310 		}
1311 
1312 		void remove(OnReorderTabDelegateWrapper source)
1313 		{
1314 			foreach(index, wrapper; onReorderTabListeners)
1315 			{
1316 				if (wrapper.handlerId == source.handlerId)
1317 				{
1318 					onReorderTabListeners[index] = null;
1319 					onReorderTabListeners = std.algorithm.remove(onReorderTabListeners, index);
1320 					break;
1321 				}
1322 			}
1323 		}
1324 	}
1325 	OnReorderTabDelegateWrapper[] onReorderTabListeners;
1326 
1327 	/** */
1328 	gulong addOnReorderTab(bool delegate(GtkDirectionType, bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1329 	{
1330 		auto wrapper = new OnReorderTabDelegateWrapper(dlg);
1331 		wrapper.handlerId = Signals.connectData(
1332 			this,
1333 			"reorder-tab",
1334 			cast(GCallback)&callBackReorderTab,
1335 			cast(void*)wrapper,
1336 			cast(GClosureNotify)&callBackReorderTabDestroy,
1337 			connectFlags);
1338 		return wrapper.handlerId;
1339 	}
1340 
1341 	extern(C) static int callBackReorderTab(GtkNotebook* notebookStruct, GtkDirectionType object, bool p0, OnReorderTabDelegateWrapper wrapper)
1342 	{
1343 		return wrapper.dlg(object, p0, wrapper.outer);
1344 	}
1345 
1346 	extern(C) static void callBackReorderTabDestroy(OnReorderTabDelegateWrapper wrapper, GClosure* closure)
1347 	{
1348 		wrapper.remove(wrapper);
1349 	}
1350 
1351 	protected class OnSelectPageDelegateWrapper
1352 	{
1353 		bool delegate(bool, Notebook) dlg;
1354 		gulong handlerId;
1355 
1356 		this(bool delegate(bool, Notebook) dlg)
1357 		{
1358 			this.dlg = dlg;
1359 			onSelectPageListeners ~= this;
1360 		}
1361 
1362 		void remove(OnSelectPageDelegateWrapper source)
1363 		{
1364 			foreach(index, wrapper; onSelectPageListeners)
1365 			{
1366 				if (wrapper.handlerId == source.handlerId)
1367 				{
1368 					onSelectPageListeners[index] = null;
1369 					onSelectPageListeners = std.algorithm.remove(onSelectPageListeners, index);
1370 					break;
1371 				}
1372 			}
1373 		}
1374 	}
1375 	OnSelectPageDelegateWrapper[] onSelectPageListeners;
1376 
1377 	/** */
1378 	gulong addOnSelectPage(bool delegate(bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1379 	{
1380 		auto wrapper = new OnSelectPageDelegateWrapper(dlg);
1381 		wrapper.handlerId = Signals.connectData(
1382 			this,
1383 			"select-page",
1384 			cast(GCallback)&callBackSelectPage,
1385 			cast(void*)wrapper,
1386 			cast(GClosureNotify)&callBackSelectPageDestroy,
1387 			connectFlags);
1388 		return wrapper.handlerId;
1389 	}
1390 
1391 	extern(C) static int callBackSelectPage(GtkNotebook* notebookStruct, bool object, OnSelectPageDelegateWrapper wrapper)
1392 	{
1393 		return wrapper.dlg(object, wrapper.outer);
1394 	}
1395 
1396 	extern(C) static void callBackSelectPageDestroy(OnSelectPageDelegateWrapper wrapper, GClosure* closure)
1397 	{
1398 		wrapper.remove(wrapper);
1399 	}
1400 
1401 	protected class OnSwitchPageDelegateWrapper
1402 	{
1403 		void delegate(Widget, uint, Notebook) dlg;
1404 		gulong handlerId;
1405 
1406 		this(void delegate(Widget, uint, Notebook) dlg)
1407 		{
1408 			this.dlg = dlg;
1409 			onSwitchPageListeners ~= this;
1410 		}
1411 
1412 		void remove(OnSwitchPageDelegateWrapper source)
1413 		{
1414 			foreach(index, wrapper; onSwitchPageListeners)
1415 			{
1416 				if (wrapper.handlerId == source.handlerId)
1417 				{
1418 					onSwitchPageListeners[index] = null;
1419 					onSwitchPageListeners = std.algorithm.remove(onSwitchPageListeners, index);
1420 					break;
1421 				}
1422 			}
1423 		}
1424 	}
1425 	OnSwitchPageDelegateWrapper[] onSwitchPageListeners;
1426 
1427 	/**
1428 	 * Emitted when the user or a function changes the current page.
1429 	 *
1430 	 * Params:
1431 	 *     page = the new current page
1432 	 *     pageNum = the index of the page
1433 	 */
1434 	gulong addOnSwitchPage(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1435 	{
1436 		auto wrapper = new OnSwitchPageDelegateWrapper(dlg);
1437 		wrapper.handlerId = Signals.connectData(
1438 			this,
1439 			"switch-page",
1440 			cast(GCallback)&callBackSwitchPage,
1441 			cast(void*)wrapper,
1442 			cast(GClosureNotify)&callBackSwitchPageDestroy,
1443 			connectFlags);
1444 		return wrapper.handlerId;
1445 	}
1446 
1447 	extern(C) static void callBackSwitchPage(GtkNotebook* notebookStruct, GtkWidget* page, uint pageNum, OnSwitchPageDelegateWrapper wrapper)
1448 	{
1449 		wrapper.dlg(ObjectG.getDObject!(Widget)(page), pageNum, wrapper.outer);
1450 	}
1451 
1452 	extern(C) static void callBackSwitchPageDestroy(OnSwitchPageDelegateWrapper wrapper, GClosure* closure)
1453 	{
1454 		wrapper.remove(wrapper);
1455 	}
1456 }