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 gio.ListModelIF;
28 private import glib.ConstructionException;
29 private import glib.Str;
30 private import glib.c.functions;
31 private import gobject.ObjectG;
32 private import gobject.Signals;
33 private import gtk.NotebookPage;
34 private import gtk.Widget;
35 private import gtk.c.functions;
36 public  import gtk.c.types;
37 private import std.algorithm;
38 
39 
40 /**
41  * `GtkNotebook` is a container whose children are pages switched
42  * between using tabs.
43  * 
44  * ![An example GtkNotebook](notebook.png)
45  * 
46  * There are many configuration options for `GtkNotebook`. Among
47  * other things, you can choose on which edge the tabs appear
48  * (see [method@Gtk.Notebook.set_tab_pos]), whether, if there are
49  * too many tabs to fit the notebook should be made bigger or scrolling
50  * arrows added (see [method@Gtk.Notebook.set_scrollable]), and whether
51  * there will be a popup menu allowing the users to switch pages.
52  * (see [method@Gtk.Notebook.popup_enable]).
53  * 
54  * # GtkNotebook as GtkBuildable
55  * 
56  * The `GtkNotebook` implementation of the `GtkBuildable` interface
57  * supports placing children into tabs by specifying “tab” as the
58  * “type” attribute of a <child> element. Note that the content
59  * of the tab must be created before the tab can be filled.
60  * A tab child can be specified without specifying a <child>
61  * type attribute.
62  * 
63  * To add a child widget in the notebooks action area, specify
64  * "action-start" or “action-end” as the “type” attribute of the
65  * <child> element.
66  * 
67  * An example of a UI definition fragment with `GtkNotebook`:
68  * 
69  * ```xml
70  * <object class="GtkNotebook">
71  * <child>
72  * <object class="GtkLabel" id="notebook-content">
73  * <property name="label">Content</property>
74  * </object>
75  * </child>
76  * <child type="tab">
77  * <object class="GtkLabel" id="notebook-tab">
78  * <property name="label">Tab</property>
79  * </object>
80  * </child>
81  * </object>
82  * ```
83  * 
84  * # CSS nodes
85  * 
86  * ```
87  * notebook
88  * ├── header.top
89  * │   ├── [<action widget>]
90  * │   ├── tabs
91  * │   │   ├── [arrow]
92  * │   │   ├── tab
93  * │   │   │   ╰── <tab label>
94  * ┊   ┊   ┊
95  * │   │   ├── tab[.reorderable-page]
96  * │   │   │   ╰── <tab label>
97  * │   │   ╰── [arrow]
98  * │   ╰── [<action widget>]
99  * │
100  * ╰── stack
101  * ├── <child>
102  * ┊
103  * ╰── <child>
104  * ```
105  * 
106  * `GtkNotebook` has a main CSS node with name `notebook`, a subnode
107  * with name `header` and below that a subnode with name `tabs` which
108  * contains one subnode per tab with name `tab`.
109  * 
110  * If action widgets are present, their CSS nodes are placed next
111  * to the `tabs` node. If the notebook is scrollable, CSS nodes with
112  * name `arrow` are placed as first and last child of the `tabs` node.
113  * 
114  * The main node gets the `.frame` style class when the notebook
115  * has a border (see [method@Gtk.Notebook.set_show_border]).
116  * 
117  * The header node gets one of the style class `.top`, `.bottom`,
118  * `.left` or `.right`, depending on where the tabs are placed. For
119  * reorderable pages, the tab node gets the `.reorderable-page` class.
120  * 
121  * A `tab` node gets the `.dnd` style class while it is moved with drag-and-drop.
122  * 
123  * The nodes are always arranged from left-to-right, regardless of text direction.
124  * 
125  * # Accessibility
126  * 
127  * `GtkNotebook` uses the following roles:
128  * 
129  * - %GTK_ACCESSIBLE_ROLE_GROUP for the notebook widget
130  * - %GTK_ACCESSIBLE_ROLE_TAB_LIST for the list of tabs
131  * - %GTK_ACCESSIBLE_ROLE_TAB role for each tab
132  * - %GTK_ACCESSIBLE_ROLE_TAB_PANEL for each page
133  */
134 public class Notebook : Widget
135 {
136 	/** the main Gtk struct */
137 	protected GtkNotebook* gtkNotebook;
138 
139 	/** Get the main Gtk struct */
140 	public GtkNotebook* getNotebookStruct(bool transferOwnership = false)
141 	{
142 		if (transferOwnership)
143 			ownedRef = false;
144 		return gtkNotebook;
145 	}
146 
147 	/** the main Gtk struct as a void* */
148 	protected override void* getStruct()
149 	{
150 		return cast(void*)gtkNotebook;
151 	}
152 
153 	/**
154 	 * Sets our main struct and passes it to the parent class.
155 	 */
156 	public this (GtkNotebook* gtkNotebook, bool ownedRef = false)
157 	{
158 		this.gtkNotebook = gtkNotebook;
159 		super(cast(GtkWidget*)gtkNotebook, ownedRef);
160 	}
161 
162 
163 	/** */
164 	public static GType getType()
165 	{
166 		return gtk_notebook_get_type();
167 	}
168 
169 	/**
170 	 * Creates a new `GtkNotebook` widget with no pages.
171 	 *
172 	 * Returns: the newly created `GtkNotebook`
173 	 *
174 	 * Throws: ConstructionException GTK+ fails to create the object.
175 	 */
176 	public this()
177 	{
178 		auto __p = gtk_notebook_new();
179 
180 		if(__p is null)
181 		{
182 			throw new ConstructionException("null returned by new");
183 		}
184 
185 		this(cast(GtkNotebook*) __p);
186 	}
187 
188 	/**
189 	 * Appends a page to @notebook.
190 	 *
191 	 * Params:
192 	 *     child = the `GtkWidget` to use as the contents of the page
193 	 *     tabLabel = the `GtkWidget` to be used as the label
194 	 *         for the page, or %NULL to use the default label, “page N”
195 	 *
196 	 * Returns: the index (starting from 0) of the appended
197 	 *     page in the notebook, or -1 if function fails
198 	 */
199 	public int appendPage(Widget child, Widget tabLabel)
200 	{
201 		return gtk_notebook_append_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
202 	}
203 
204 	/**
205 	 * Appends a page to @notebook, specifying the widget to use as the
206 	 * label in the popup menu.
207 	 *
208 	 * Params:
209 	 *     child = the `GtkWidget` to use as the contents of the page
210 	 *     tabLabel = the `GtkWidget` to be used as the label
211 	 *         for the page, or %NULL to use the default label, “page N”
212 	 *     menuLabel = the widget to use as a label for the
213 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
214 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
215 	 *         created label with the same text as @tab_label; if @tab_label
216 	 *         is not a `GtkLabel`, @menu_label must be specified if the
217 	 *         page-switch menu is to be used.
218 	 *
219 	 * Returns: the index (starting from 0) of the appended
220 	 *     page in the notebook, or -1 if function fails
221 	 */
222 	public int appendPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
223 	{
224 		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());
225 	}
226 
227 	/**
228 	 * Removes the child from the notebook.
229 	 *
230 	 * This function is very similar to [method@Gtk.Notebook.remove_page],
231 	 * but additionally informs the notebook that the removal
232 	 * is happening as part of a tab DND operation, which should
233 	 * not be cancelled.
234 	 *
235 	 * Params:
236 	 *     child = a child
237 	 */
238 	public void detachTab(Widget child)
239 	{
240 		gtk_notebook_detach_tab(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
241 	}
242 
243 	/**
244 	 * Gets one of the action widgets.
245 	 *
246 	 * See [method@Gtk.Notebook.set_action_widget].
247 	 *
248 	 * Params:
249 	 *     packType = pack type of the action widget to receive
250 	 *
251 	 * Returns: The action widget
252 	 *     with the given @pack_type or %NULL when this action
253 	 *     widget has not been set
254 	 */
255 	public Widget getActionWidget(GtkPackType packType)
256 	{
257 		auto __p = gtk_notebook_get_action_widget(gtkNotebook, packType);
258 
259 		if(__p is null)
260 		{
261 			return null;
262 		}
263 
264 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
265 	}
266 
267 	/**
268 	 * Returns the page number of the current page.
269 	 *
270 	 * Returns: the index (starting from 0) of the current
271 	 *     page in the notebook. If the notebook has no pages,
272 	 *     then -1 will be returned.
273 	 */
274 	public int getCurrentPage()
275 	{
276 		return gtk_notebook_get_current_page(gtkNotebook);
277 	}
278 
279 	/**
280 	 * Gets the current group name for @notebook.
281 	 *
282 	 * Returns: the group name,
283 	 *     or %NULL if none is set
284 	 */
285 	public string getGroupName()
286 	{
287 		return Str.toString(gtk_notebook_get_group_name(gtkNotebook));
288 	}
289 
290 	/**
291 	 * Retrieves the menu label widget of the page containing @child.
292 	 *
293 	 * Params:
294 	 *     child = a widget contained in a page of @notebook
295 	 *
296 	 * Returns: the menu label, or %NULL
297 	 *     if the notebook page does not have a menu label other than
298 	 *     the default (the tab label).
299 	 */
300 	public Widget getMenuLabel(Widget child)
301 	{
302 		auto __p = gtk_notebook_get_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
303 
304 		if(__p is null)
305 		{
306 			return null;
307 		}
308 
309 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
310 	}
311 
312 	/**
313 	 * Retrieves the text of the menu label for the page containing
314 	 * @child.
315 	 *
316 	 * Params:
317 	 *     child = the child widget of a page of the notebook.
318 	 *
319 	 * Returns: the text of the tab label, or %NULL if
320 	 *     the widget does not have a menu label other than the default
321 	 *     menu label, or the menu label widget is not a `GtkLabel`.
322 	 *     The string is owned by the widget and must not be freed.
323 	 */
324 	public string getMenuLabelText(Widget child)
325 	{
326 		return Str.toString(gtk_notebook_get_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
327 	}
328 
329 	/**
330 	 * Gets the number of pages in a notebook.
331 	 *
332 	 * Returns: the number of pages in the notebook
333 	 */
334 	public int getNPages()
335 	{
336 		return gtk_notebook_get_n_pages(gtkNotebook);
337 	}
338 
339 	/**
340 	 * Returns the child widget contained in page number @page_num.
341 	 *
342 	 * Params:
343 	 *     pageNum = the index of a page in the notebook, or -1
344 	 *         to get the last page
345 	 *
346 	 * Returns: the child widget, or %NULL if @page_num
347 	 *     is out of bounds
348 	 */
349 	public Widget getNthPage(int pageNum)
350 	{
351 		auto __p = gtk_notebook_get_nth_page(gtkNotebook, pageNum);
352 
353 		if(__p is null)
354 		{
355 			return null;
356 		}
357 
358 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
359 	}
360 
361 	/**
362 	 * Returns the `GtkNotebookPage` for @child.
363 	 *
364 	 * Params:
365 	 *     child = a child of @notebook
366 	 *
367 	 * Returns: the `GtkNotebookPage` for @child
368 	 */
369 	public NotebookPage getPage(Widget child)
370 	{
371 		auto __p = gtk_notebook_get_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
372 
373 		if(__p is null)
374 		{
375 			return null;
376 		}
377 
378 		return ObjectG.getDObject!(NotebookPage)(cast(GtkNotebookPage*) __p);
379 	}
380 
381 	/**
382 	 * Returns a `GListModel` that contains the pages of the notebook.
383 	 *
384 	 * This can be used to keep an up-to-date view. The model also
385 	 * implements [iface@Gtk.SelectionModel] and can be used to track
386 	 * and modify the visible page.
387 	 *
388 	 * Returns: a
389 	 *     `GListModel` for the notebook's children
390 	 */
391 	public ListModelIF getPages()
392 	{
393 		auto __p = gtk_notebook_get_pages(gtkNotebook);
394 
395 		if(__p is null)
396 		{
397 			return null;
398 		}
399 
400 		return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p, true);
401 	}
402 
403 	/**
404 	 * Returns whether the tab label area has arrows for scrolling.
405 	 *
406 	 * Returns: %TRUE if arrows for scrolling are present
407 	 */
408 	public bool getScrollable()
409 	{
410 		return gtk_notebook_get_scrollable(gtkNotebook) != 0;
411 	}
412 
413 	/**
414 	 * Returns whether a bevel will be drawn around the notebook pages.
415 	 *
416 	 * Returns: %TRUE if the bevel is drawn
417 	 */
418 	public bool getShowBorder()
419 	{
420 		return gtk_notebook_get_show_border(gtkNotebook) != 0;
421 	}
422 
423 	/**
424 	 * Returns whether the tabs of the notebook are shown.
425 	 *
426 	 * Returns: %TRUE if the tabs are shown
427 	 */
428 	public bool getShowTabs()
429 	{
430 		return gtk_notebook_get_show_tabs(gtkNotebook) != 0;
431 	}
432 
433 	/**
434 	 * Returns whether the tab contents can be detached from @notebook.
435 	 *
436 	 * Params:
437 	 *     child = a child `GtkWidget`
438 	 *
439 	 * Returns: %TRUE if the tab is detachable.
440 	 */
441 	public bool getTabDetachable(Widget child)
442 	{
443 		return gtk_notebook_get_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
444 	}
445 
446 	/**
447 	 * Returns the tab label widget for the page @child.
448 	 *
449 	 * %NULL is returned if @child is not in @notebook or
450 	 * if no tab label has specifically been set for @child.
451 	 *
452 	 * Params:
453 	 *     child = the page
454 	 *
455 	 * Returns: the tab label
456 	 */
457 	public Widget getTabLabel(Widget child)
458 	{
459 		auto __p = gtk_notebook_get_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
460 
461 		if(__p is null)
462 		{
463 			return null;
464 		}
465 
466 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
467 	}
468 
469 	/**
470 	 * Retrieves the text of the tab label for the page containing
471 	 * @child.
472 	 *
473 	 * Params:
474 	 *     child = a widget contained in a page of @notebook
475 	 *
476 	 * Returns: the text of the tab label, or %NULL if
477 	 *     the tab label idget is not a `GtkLabel`. The string is owned
478 	 *     by the widget and must not be freed.
479 	 */
480 	public string getTabLabelText(Widget child)
481 	{
482 		return Str.toString(gtk_notebook_get_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
483 	}
484 
485 	/**
486 	 * Gets the edge at which the tabs are drawn.
487 	 *
488 	 * Returns: the edge at which the tabs are drawn
489 	 */
490 	public GtkPositionType getTabPos()
491 	{
492 		return gtk_notebook_get_tab_pos(gtkNotebook);
493 	}
494 
495 	/**
496 	 * Gets whether the tab can be reordered via drag and drop or not.
497 	 *
498 	 * Params:
499 	 *     child = a child `GtkWidget`
500 	 *
501 	 * Returns: %TRUE if the tab is reorderable.
502 	 */
503 	public bool getTabReorderable(Widget child)
504 	{
505 		return gtk_notebook_get_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
506 	}
507 
508 	/**
509 	 * Insert a page into @notebook at the given position.
510 	 *
511 	 * Params:
512 	 *     child = the `GtkWidget` to use as the contents of the page
513 	 *     tabLabel = the `GtkWidget` to be used as the label
514 	 *         for the page, or %NULL to use the default label, “page N”
515 	 *     position = the index (starting at 0) at which to insert the page,
516 	 *         or -1 to append the page after all other pages
517 	 *
518 	 * Returns: the index (starting from 0) of the inserted
519 	 *     page in the notebook, or -1 if function fails
520 	 */
521 	public int insertPage(Widget child, Widget tabLabel, int position)
522 	{
523 		return gtk_notebook_insert_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), position);
524 	}
525 
526 	/**
527 	 * Insert a page into @notebook at the given position, specifying
528 	 * the widget to use as the label in the popup menu.
529 	 *
530 	 * Params:
531 	 *     child = the `GtkWidget` to use as the contents of the page
532 	 *     tabLabel = the `GtkWidget` to be used as the label
533 	 *         for the page, or %NULL to use the default label, “page N”
534 	 *     menuLabel = the widget to use as a label for the
535 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
536 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
537 	 *         created label with the same text as @tab_label; if @tab_label
538 	 *         is not a #GtkLabel, @menu_label must be specified if the
539 	 *         page-switch menu is to be used.
540 	 *     position = the index (starting at 0) at which to insert the page,
541 	 *         or -1 to append the page after all other pages.
542 	 *
543 	 * Returns: the index (starting from 0) of the inserted
544 	 *     page in the notebook
545 	 */
546 	public int insertPageMenu(Widget child, Widget tabLabel, Widget menuLabel, int position)
547 	{
548 		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);
549 	}
550 
551 	/**
552 	 * Switches to the next page.
553 	 *
554 	 * Nothing happens if the current page is the last page.
555 	 */
556 	public void nextPage()
557 	{
558 		gtk_notebook_next_page(gtkNotebook);
559 	}
560 
561 	/**
562 	 * Finds the index of the page which contains the given child
563 	 * widget.
564 	 *
565 	 * Params:
566 	 *     child = a `GtkWidget`
567 	 *
568 	 * Returns: the index of the page containing @child, or
569 	 *     -1 if @child is not in the notebook
570 	 */
571 	public int pageNum(Widget child)
572 	{
573 		return gtk_notebook_page_num(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
574 	}
575 
576 	/**
577 	 * Disables the popup menu.
578 	 */
579 	public void popupDisable()
580 	{
581 		gtk_notebook_popup_disable(gtkNotebook);
582 	}
583 
584 	/**
585 	 * Enables the popup menu.
586 	 *
587 	 * If the user clicks with the right mouse button on the tab labels,
588 	 * a menu with all the pages will be popped up.
589 	 */
590 	public void popupEnable()
591 	{
592 		gtk_notebook_popup_enable(gtkNotebook);
593 	}
594 
595 	/**
596 	 * Prepends a page to @notebook.
597 	 *
598 	 * Params:
599 	 *     child = the `GtkWidget` to use as the contents of the page
600 	 *     tabLabel = the #GtkWidget to be used as the label
601 	 *         for the page, or %NULL to use the default label, “page N”
602 	 *
603 	 * Returns: the index (starting from 0) of the prepended
604 	 *     page in the notebook, or -1 if function fails
605 	 */
606 	public int prependPage(Widget child, Widget tabLabel)
607 	{
608 		return gtk_notebook_prepend_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
609 	}
610 
611 	/**
612 	 * Prepends a page to @notebook, specifying the widget to use as the
613 	 * label in the popup menu.
614 	 *
615 	 * Params:
616 	 *     child = the `GtkWidget` to use as the contents of the page
617 	 *     tabLabel = the `GtkWidget` to be used as the label
618 	 *         for the page, or %NULL to use the default label, “page N”
619 	 *     menuLabel = the widget to use as a label for the
620 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
621 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
622 	 *         created label with the same text as @tab_label; if @tab_label
623 	 *         is not a #GtkLabel, @menu_label must be specified if the
624 	 *         page-switch menu is to be used.
625 	 *
626 	 * Returns: the index (starting from 0) of the prepended
627 	 *     page in the notebook, or -1 if function fails
628 	 */
629 	public int prependPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
630 	{
631 		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());
632 	}
633 
634 	/**
635 	 * Switches to the previous page.
636 	 *
637 	 * Nothing happens if the current page is the first page.
638 	 */
639 	public void prevPage()
640 	{
641 		gtk_notebook_prev_page(gtkNotebook);
642 	}
643 
644 	/**
645 	 * Removes a page from the notebook given its index
646 	 * in the notebook.
647 	 *
648 	 * Params:
649 	 *     pageNum = the index of a notebook page, starting
650 	 *         from 0. If -1, the last page will be removed.
651 	 */
652 	public void removePage(int pageNum)
653 	{
654 		gtk_notebook_remove_page(gtkNotebook, pageNum);
655 	}
656 
657 	/**
658 	 * Reorders the page containing @child, so that it appears in position
659 	 * @position.
660 	 *
661 	 * If @position is greater than or equal to the number of children in
662 	 * the list or negative, @child will be moved to the end of the list.
663 	 *
664 	 * Params:
665 	 *     child = the child to move
666 	 *     position = the new position, or -1 to move to the end
667 	 */
668 	public void reorderChild(Widget child, int position)
669 	{
670 		gtk_notebook_reorder_child(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), position);
671 	}
672 
673 	/**
674 	 * Sets @widget as one of the action widgets.
675 	 *
676 	 * Depending on the pack type the widget will be placed before
677 	 * or after the tabs. You can use a `GtkBox` if you need to pack
678 	 * more than one widget on the same side.
679 	 *
680 	 * Params:
681 	 *     widget = a #GtkWidget
682 	 *     packType = pack type of the action widget
683 	 */
684 	public void setActionWidget(Widget widget, GtkPackType packType)
685 	{
686 		gtk_notebook_set_action_widget(gtkNotebook, (widget is null) ? null : widget.getWidgetStruct(), packType);
687 	}
688 
689 	/**
690 	 * Switches to the page number @page_num.
691 	 *
692 	 * Note that due to historical reasons, GtkNotebook refuses
693 	 * to switch to a page unless the child widget is visible.
694 	 * Therefore, it is recommended to show child widgets before
695 	 * adding them to a notebook.
696 	 *
697 	 * Params:
698 	 *     pageNum = index of the page to switch to, starting from 0.
699 	 *         If negative, the last page will be used. If greater
700 	 *         than the number of pages in the notebook, nothing
701 	 *         will be done.
702 	 */
703 	public void setCurrentPage(int pageNum)
704 	{
705 		gtk_notebook_set_current_page(gtkNotebook, pageNum);
706 	}
707 
708 	/**
709 	 * Sets a group name for @notebook.
710 	 *
711 	 * Notebooks with the same name will be able to exchange tabs
712 	 * via drag and drop. A notebook with a %NULL group name will
713 	 * not be able to exchange tabs with any other notebook.
714 	 *
715 	 * Params:
716 	 *     groupName = the name of the notebook group,
717 	 *         or %NULL to unset it
718 	 */
719 	public void setGroupName(string groupName)
720 	{
721 		gtk_notebook_set_group_name(gtkNotebook, Str.toStringz(groupName));
722 	}
723 
724 	/**
725 	 * Changes the menu label for the page containing @child.
726 	 *
727 	 * Params:
728 	 *     child = the child widget
729 	 *     menuLabel = the menu label, or %NULL for default
730 	 */
731 	public void setMenuLabel(Widget child, Widget menuLabel)
732 	{
733 		gtk_notebook_set_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
734 	}
735 
736 	/**
737 	 * Creates a new label and sets it as the menu label of @child.
738 	 *
739 	 * Params:
740 	 *     child = the child widget
741 	 *     menuText = the label text
742 	 */
743 	public void setMenuLabelText(Widget child, string menuText)
744 	{
745 		gtk_notebook_set_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(menuText));
746 	}
747 
748 	/**
749 	 * Sets whether the tab label area will have arrows for
750 	 * scrolling if there are too many tabs to fit in the area.
751 	 *
752 	 * Params:
753 	 *     scrollable = %TRUE if scroll arrows should be added
754 	 */
755 	public void setScrollable(bool scrollable)
756 	{
757 		gtk_notebook_set_scrollable(gtkNotebook, scrollable);
758 	}
759 
760 	/**
761 	 * Sets whether a bevel will be drawn around the notebook pages.
762 	 *
763 	 * This only has a visual effect when the tabs are not shown.
764 	 *
765 	 * Params:
766 	 *     showBorder = %TRUE if a bevel should be drawn around the notebook
767 	 */
768 	public void setShowBorder(bool showBorder)
769 	{
770 		gtk_notebook_set_show_border(gtkNotebook, showBorder);
771 	}
772 
773 	/**
774 	 * Sets whether to show the tabs for the notebook or not.
775 	 *
776 	 * Params:
777 	 *     showTabs = %TRUE if the tabs should be shown
778 	 */
779 	public void setShowTabs(bool showTabs)
780 	{
781 		gtk_notebook_set_show_tabs(gtkNotebook, showTabs);
782 	}
783 
784 	/**
785 	 * Sets whether the tab can be detached from @notebook to another
786 	 * notebook or widget.
787 	 *
788 	 * Note that two notebooks must share a common group identificator
789 	 * (see [method@Gtk.Notebook.set_group_name]) to allow automatic tabs
790 	 * interchange between them.
791 	 *
792 	 * If you want a widget to interact with a notebook through DnD
793 	 * (i.e.: accept dragged tabs from it) it must be set as a drop
794 	 * destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook
795 	 * will fill the selection with a GtkWidget** pointing to the child
796 	 * widget that corresponds to the dropped tab.
797 	 *
798 	 * Note that you should use [method@Gtk.Notebook.detach_tab] instead
799 	 * of [method@Gtk.Notebook.remove_page] if you want to remove the tab
800 	 * from the source notebook as part of accepting a drop. Otherwise,
801 	 * the source notebook will think that the dragged tab was removed
802 	 * from underneath the ongoing drag operation, and will initiate a
803 	 * drag cancel animation.
804 	 *
805 	 * ```c
806 	 * static void
807 	 * on_drag_data_received (GtkWidget        *widget,
808 	 * GdkDrop          *drop,
809 	 * GtkSelectionData *data,
810 	 * guint             time,
811 	 * gpointer          user_data)
812 	 * {
813 	 * GtkDrag *drag;
814 	 * GtkWidget *notebook;
815 	 * GtkWidget **child;
816 	 *
817 	 * drag = gtk_drop_get_drag (drop);
818 	 * notebook = g_object_get_data (drag, "gtk-notebook-drag-origin");
819 	 * child = (void*) gtk_selection_data_get_data (data);
820 	 *
821 	 * // process_widget (*child);
822 	 *
823 	 * gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
824 	 * }
825 	 * ```
826 	 *
827 	 * If you want a notebook to accept drags from other widgets,
828 	 * you will have to set your own DnD code to do it.
829 	 *
830 	 * Params:
831 	 *     child = a child `GtkWidget`
832 	 *     detachable = whether the tab is detachable or not
833 	 */
834 	public void setTabDetachable(Widget child, bool detachable)
835 	{
836 		gtk_notebook_set_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), detachable);
837 	}
838 
839 	/**
840 	 * Changes the tab label for @child.
841 	 *
842 	 * If %NULL is specified for @tab_label, then the page will
843 	 * have the label “page N”.
844 	 *
845 	 * Params:
846 	 *     child = the page
847 	 *     tabLabel = the tab label widget to use, or %NULL
848 	 *         for default tab label
849 	 */
850 	public void setTabLabel(Widget child, Widget tabLabel)
851 	{
852 		gtk_notebook_set_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
853 	}
854 
855 	/**
856 	 * Creates a new label and sets it as the tab label for the page
857 	 * containing @child.
858 	 *
859 	 * Params:
860 	 *     child = the page
861 	 *     tabText = the label text
862 	 */
863 	public void setTabLabelText(Widget child, string tabText)
864 	{
865 		gtk_notebook_set_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(tabText));
866 	}
867 
868 	/**
869 	 * Sets the edge at which the tabs are drawn.
870 	 *
871 	 * Params:
872 	 *     pos = the edge to draw the tabs at
873 	 */
874 	public void setTabPos(GtkPositionType pos)
875 	{
876 		gtk_notebook_set_tab_pos(gtkNotebook, pos);
877 	}
878 
879 	/**
880 	 * Sets whether the notebook tab can be reordered
881 	 * via drag and drop or not.
882 	 *
883 	 * Params:
884 	 *     child = a child `GtkWidget`
885 	 *     reorderable = whether the tab is reorderable or not
886 	 */
887 	public void setTabReorderable(Widget child, bool reorderable)
888 	{
889 		gtk_notebook_set_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), reorderable);
890 	}
891 
892 	/** */
893 	gulong addOnChangeCurrentPage(bool delegate(int, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
894 	{
895 		return Signals.connect(this, "change-current-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
896 	}
897 
898 	/**
899 	 * The ::create-window signal is emitted when a detachable
900 	 * tab is dropped on the root window.
901 	 *
902 	 * A handler for this signal can create a window containing
903 	 * a notebook where the tab will be attached. It is also
904 	 * responsible for moving/resizing the window and adding the
905 	 * necessary properties to the notebook (e.g. the
906 	 * `GtkNotebook`:group-name ).
907 	 *
908 	 * Params:
909 	 *     page = the tab of @notebook that is being detached
910 	 *
911 	 * Returns: a `GtkNotebook` that @page should be
912 	 *     added to, or %NULL.
913 	 */
914 	gulong addOnCreateWindow(Notebook delegate(Widget, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
915 	{
916 		return Signals.connect(this, "create-window", dlg, connectFlags ^ ConnectFlags.SWAPPED);
917 	}
918 
919 	/** */
920 	gulong addOnFocusTab(bool delegate(GtkNotebookTab, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
921 	{
922 		return Signals.connect(this, "focus-tab", dlg, connectFlags ^ ConnectFlags.SWAPPED);
923 	}
924 
925 	/** */
926 	gulong addOnMoveFocusOut(void delegate(GtkDirectionType, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
927 	{
928 		return Signals.connect(this, "move-focus-out", dlg, connectFlags ^ ConnectFlags.SWAPPED);
929 	}
930 
931 	/**
932 	 * the ::page-added signal is emitted in the notebook
933 	 * right after a page is added to the notebook.
934 	 *
935 	 * Params:
936 	 *     child = the child #GtkWidget affected
937 	 *     pageNum = the new page number for @child
938 	 */
939 	gulong addOnPageAdded(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
940 	{
941 		return Signals.connect(this, "page-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
942 	}
943 
944 	/**
945 	 * the ::page-removed signal is emitted in the notebook
946 	 * right after a page is removed from the notebook.
947 	 *
948 	 * Params:
949 	 *     child = the child #GtkWidget affected
950 	 *     pageNum = the @child page number
951 	 */
952 	gulong addOnPageRemoved(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
953 	{
954 		return Signals.connect(this, "page-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
955 	}
956 
957 	/**
958 	 * the ::page-reordered signal is emitted in the notebook
959 	 * right after a page has been reordered.
960 	 *
961 	 * Params:
962 	 *     child = the child #GtkWidget affected
963 	 *     pageNum = the new page number for @child
964 	 */
965 	gulong addOnPageReordered(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
966 	{
967 		return Signals.connect(this, "page-reordered", dlg, connectFlags ^ ConnectFlags.SWAPPED);
968 	}
969 
970 	/** */
971 	gulong addOnReorderTab(bool delegate(GtkDirectionType, bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
972 	{
973 		return Signals.connect(this, "reorder-tab", dlg, connectFlags ^ ConnectFlags.SWAPPED);
974 	}
975 
976 	/** */
977 	gulong addOnSelectPage(bool delegate(bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
978 	{
979 		return Signals.connect(this, "select-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
980 	}
981 
982 	/**
983 	 * Emitted when the user or a function changes the current page.
984 	 *
985 	 * Params:
986 	 *     page = the new current page
987 	 *     pageNum = the index of the page
988 	 */
989 	gulong addOnSwitchPage(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
990 	{
991 		return Signals.connect(this, "switch-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
992 	}
993 }