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