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 	/**
142 	 * Sets our main struct and passes it to the parent class.
143 	 */
144 	public this (GtkNotebook* gtkNotebook, bool ownedRef = false)
145 	{
146 		this.gtkNotebook = gtkNotebook;
147 		super(cast(GtkContainer*)gtkNotebook, ownedRef);
148 	}
149 
150 	/**
151 	 * Append a page with a widget and a text for a label
152 	 */
153 	public int appendPage(Widget child, string tabLabel)
154 	{
155 		return appendPage(child, new Label(tabLabel));
156 	}
157 
158 	/** */
159 	void setCurrentPage(Widget child)
160 	{
161 		gtk_notebook_set_current_page(gtkNotebook,gtk_notebook_page_num(gtkNotebook, child.getWidgetStruct()));
162 	}
163 
164 	/**
165 	 */
166 
167 	/** */
168 	public static GType getType()
169 	{
170 		return gtk_notebook_get_type();
171 	}
172 
173 	/**
174 	 * Creates a new #GtkNotebook widget with no pages.
175 	 *
176 	 * Returns: the newly created #GtkNotebook
177 	 *
178 	 * Throws: ConstructionException GTK+ fails to create the object.
179 	 */
180 	public this()
181 	{
182 		auto p = gtk_notebook_new();
183 
184 		if(p is null)
185 		{
186 			throw new ConstructionException("null returned by new");
187 		}
188 
189 		this(cast(GtkNotebook*) p);
190 	}
191 
192 	/**
193 	 * Appends a page to @notebook.
194 	 *
195 	 * Params:
196 	 *     child = the #GtkWidget to use as the contents of the page
197 	 *     tabLabel = the #GtkWidget to be used as the label
198 	 *         for the page, or %NULL to use the default label, “page N”
199 	 *
200 	 * Returns: the index (starting from 0) of the appended
201 	 *     page in the notebook, or -1 if function fails
202 	 */
203 	public int appendPage(Widget child, Widget tabLabel)
204 	{
205 		return gtk_notebook_append_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
206 	}
207 
208 	/**
209 	 * Appends a page to @notebook, specifying the widget to use as the
210 	 * label in the popup menu.
211 	 *
212 	 * Params:
213 	 *     child = the #GtkWidget to use as the contents of the page
214 	 *     tabLabel = the #GtkWidget to be used as the label
215 	 *         for the page, or %NULL to use the default label, “page N”
216 	 *     menuLabel = the widget to use as a label for the
217 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
218 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
219 	 *         created label with the same text as @tab_label; if @tab_label
220 	 *         is not a #GtkLabel, @menu_label must be specified if the
221 	 *         page-switch menu is to be used.
222 	 *
223 	 * Returns: the index (starting from 0) of the appended
224 	 *     page in the notebook, or -1 if function fails
225 	 */
226 	public int appendPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
227 	{
228 		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());
229 	}
230 
231 	/**
232 	 * Removes the child from the notebook.
233 	 *
234 	 * This function is very similar to gtk_container_remove(),
235 	 * but additionally informs the notebook that the removal
236 	 * is happening as part of a tab DND operation, which should
237 	 * not be cancelled.
238 	 *
239 	 * Params:
240 	 *     child = a child
241 	 *
242 	 * Since: 3.16
243 	 */
244 	public void detachTab(Widget child)
245 	{
246 		gtk_notebook_detach_tab(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
247 	}
248 
249 	/**
250 	 * Gets one of the action widgets. See gtk_notebook_set_action_widget().
251 	 *
252 	 * Params:
253 	 *     packType = pack type of the action widget to receive
254 	 *
255 	 * Returns: The action widget with the given
256 	 *     @pack_type or %NULL when this action widget has not been set
257 	 *
258 	 * Since: 2.20
259 	 */
260 	public Widget getActionWidget(GtkPackType packType)
261 	{
262 		auto p = gtk_notebook_get_action_widget(gtkNotebook, packType);
263 
264 		if(p is null)
265 		{
266 			return null;
267 		}
268 
269 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
270 	}
271 
272 	/**
273 	 * Returns the page number of the current page.
274 	 *
275 	 * Returns: the index (starting from 0) of the current
276 	 *     page in the notebook. If the notebook has no pages,
277 	 *     then -1 will be returned.
278 	 */
279 	public int getCurrentPage()
280 	{
281 		return gtk_notebook_get_current_page(gtkNotebook);
282 	}
283 
284 	/**
285 	 * Gets the current group name for @notebook.
286 	 *
287 	 * Returns: the group name, or %NULL if none is set
288 	 *
289 	 * Since: 2.24
290 	 */
291 	public string getGroupName()
292 	{
293 		return Str.toString(gtk_notebook_get_group_name(gtkNotebook));
294 	}
295 
296 	/**
297 	 * Retrieves the menu label widget of the page containing @child.
298 	 *
299 	 * Params:
300 	 *     child = a widget contained in a page of @notebook
301 	 *
302 	 * Returns: the menu label, or %NULL if the
303 	 *     notebook page does not have a menu label other than the default (the tab
304 	 *     label).
305 	 */
306 	public Widget getMenuLabel(Widget child)
307 	{
308 		auto p = gtk_notebook_get_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
309 
310 		if(p is null)
311 		{
312 			return null;
313 		}
314 
315 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
316 	}
317 
318 	/**
319 	 * Retrieves the text of the menu label for the page containing
320 	 * @child.
321 	 *
322 	 * Params:
323 	 *     child = the child widget of a page of the notebook.
324 	 *
325 	 * Returns: the text of the tab label, or %NULL if the widget does
326 	 *     not have a menu label other than the default menu label, or the menu label
327 	 *     widget is not a #GtkLabel. The string is owned by the widget and must not be
328 	 *     freed.
329 	 */
330 	public string getMenuLabelText(Widget child)
331 	{
332 		return Str.toString(gtk_notebook_get_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
333 	}
334 
335 	/**
336 	 * Gets the number of pages in a notebook.
337 	 *
338 	 * Returns: the number of pages in the notebook
339 	 *
340 	 * Since: 2.2
341 	 */
342 	public int getNPages()
343 	{
344 		return gtk_notebook_get_n_pages(gtkNotebook);
345 	}
346 
347 	/**
348 	 * Returns the child widget contained in page number @page_num.
349 	 *
350 	 * Params:
351 	 *     pageNum = the index of a page in the notebook, or -1
352 	 *         to get the last page
353 	 *
354 	 * Returns: the child widget, or %NULL if @page_num
355 	 *     is out of bounds
356 	 */
357 	public Widget getNthPage(int pageNum)
358 	{
359 		auto p = gtk_notebook_get_nth_page(gtkNotebook, pageNum);
360 
361 		if(p is null)
362 		{
363 			return null;
364 		}
365 
366 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
367 	}
368 
369 	/**
370 	 * Returns whether the tab label area has arrows for scrolling.
371 	 * See gtk_notebook_set_scrollable().
372 	 *
373 	 * Returns: %TRUE if arrows for scrolling are present
374 	 */
375 	public bool getScrollable()
376 	{
377 		return gtk_notebook_get_scrollable(gtkNotebook) != 0;
378 	}
379 
380 	/**
381 	 * Returns whether a bevel will be drawn around the notebook pages.
382 	 * See gtk_notebook_set_show_border().
383 	 *
384 	 * Returns: %TRUE if the bevel is drawn
385 	 */
386 	public bool getShowBorder()
387 	{
388 		return gtk_notebook_get_show_border(gtkNotebook) != 0;
389 	}
390 
391 	/**
392 	 * Returns whether the tabs of the notebook are shown.
393 	 * See gtk_notebook_set_show_tabs().
394 	 *
395 	 * Returns: %TRUE if the tabs are shown
396 	 */
397 	public bool getShowTabs()
398 	{
399 		return gtk_notebook_get_show_tabs(gtkNotebook) != 0;
400 	}
401 
402 	/**
403 	 * Returns whether the tab contents can be detached from @notebook.
404 	 *
405 	 * Params:
406 	 *     child = a child #GtkWidget
407 	 *
408 	 * Returns: %TRUE if the tab is detachable.
409 	 *
410 	 * Since: 2.10
411 	 */
412 	public bool getTabDetachable(Widget child)
413 	{
414 		return gtk_notebook_get_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
415 	}
416 
417 	/**
418 	 * Returns the horizontal width of a tab border.
419 	 *
420 	 * Deprecated: this function returns zero
421 	 *
422 	 * Returns: horizontal width of a tab border
423 	 *
424 	 * Since: 2.22
425 	 */
426 	public ushort getTabHborder()
427 	{
428 		return gtk_notebook_get_tab_hborder(gtkNotebook);
429 	}
430 
431 	/**
432 	 * Returns the tab label widget for the page @child.
433 	 * %NULL is returned if @child is not in @notebook or
434 	 * if no tab label has specifically been set for @child.
435 	 *
436 	 * Params:
437 	 *     child = the page
438 	 *
439 	 * Returns: the tab label
440 	 */
441 	public Widget getTabLabel(Widget child)
442 	{
443 		auto p = gtk_notebook_get_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
444 
445 		if(p is null)
446 		{
447 			return null;
448 		}
449 
450 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
451 	}
452 
453 	/**
454 	 * Retrieves the text of the tab label for the page containing
455 	 * @child.
456 	 *
457 	 * Params:
458 	 *     child = a widget contained in a page of @notebook
459 	 *
460 	 * Returns: the text of the tab label, or %NULL if the tab label
461 	 *     widget is not a #GtkLabel. The string is owned by the widget and must not be
462 	 *     freed.
463 	 */
464 	public string getTabLabelText(Widget child)
465 	{
466 		return Str.toString(gtk_notebook_get_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()));
467 	}
468 
469 	/**
470 	 * Gets the edge at which the tabs for switching pages in the
471 	 * notebook are drawn.
472 	 *
473 	 * Returns: the edge at which the tabs are drawn
474 	 */
475 	public GtkPositionType getTabPos()
476 	{
477 		return gtk_notebook_get_tab_pos(gtkNotebook);
478 	}
479 
480 	/**
481 	 * Gets whether the tab can be reordered via drag and drop or not.
482 	 *
483 	 * Params:
484 	 *     child = a child #GtkWidget
485 	 *
486 	 * Returns: %TRUE if the tab is reorderable.
487 	 *
488 	 * Since: 2.10
489 	 */
490 	public bool getTabReorderable(Widget child)
491 	{
492 		return gtk_notebook_get_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) != 0;
493 	}
494 
495 	/**
496 	 * Returns the vertical width of a tab border.
497 	 *
498 	 * Deprecated: this function returns zero
499 	 *
500 	 * Returns: vertical width of a tab border
501 	 *
502 	 * Since: 2.22
503 	 */
504 	public ushort getTabVborder()
505 	{
506 		return gtk_notebook_get_tab_vborder(gtkNotebook);
507 	}
508 
509 	/**
510 	 * Insert a page into @notebook at the given position.
511 	 *
512 	 * Params:
513 	 *     child = the #GtkWidget to use as the contents of the page
514 	 *     tabLabel = the #GtkWidget to be used as the label
515 	 *         for the page, or %NULL to use the default label, “page N”
516 	 *     position = the index (starting at 0) at which to insert the page,
517 	 *         or -1 to append the page after all other pages
518 	 *
519 	 * Returns: the index (starting from 0) of the inserted
520 	 *     page in the notebook, or -1 if function fails
521 	 */
522 	public int insertPage(Widget child, Widget tabLabel, int position)
523 	{
524 		return gtk_notebook_insert_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), position);
525 	}
526 
527 	/**
528 	 * Insert a page into @notebook at the given position, specifying
529 	 * the widget to use as the label in the popup menu.
530 	 *
531 	 * Params:
532 	 *     child = the #GtkWidget to use as the contents of the page
533 	 *     tabLabel = the #GtkWidget to be used as the label
534 	 *         for the page, or %NULL to use the default label, “page N”
535 	 *     menuLabel = the widget to use as a label for the
536 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
537 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
538 	 *         created label with the same text as @tab_label; if @tab_label
539 	 *         is not a #GtkLabel, @menu_label must be specified if the
540 	 *         page-switch menu is to be used.
541 	 *     position = the index (starting at 0) at which to insert the page,
542 	 *         or -1 to append the page after all other pages.
543 	 *
544 	 * Returns: the index (starting from 0) of the inserted
545 	 *     page in the notebook
546 	 */
547 	public int insertPageMenu(Widget child, Widget tabLabel, Widget menuLabel, int position)
548 	{
549 		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);
550 	}
551 
552 	/**
553 	 * Switches to the next page. Nothing happens if the current page is
554 	 * 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: if the user clicks with the right
586 	 * mouse button on the tab labels, a menu with all the pages
587 	 * will be popped up.
588 	 */
589 	public void popupEnable()
590 	{
591 		gtk_notebook_popup_enable(gtkNotebook);
592 	}
593 
594 	/**
595 	 * Prepends a page to @notebook.
596 	 *
597 	 * Params:
598 	 *     child = the #GtkWidget to use as the contents of the page
599 	 *     tabLabel = the #GtkWidget to be used as the label
600 	 *         for the page, or %NULL to use the default label, “page N”
601 	 *
602 	 * Returns: the index (starting from 0) of the prepended
603 	 *     page in the notebook, or -1 if function fails
604 	 */
605 	public int prependPage(Widget child, Widget tabLabel)
606 	{
607 		return gtk_notebook_prepend_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
608 	}
609 
610 	/**
611 	 * Prepends a page to @notebook, specifying the widget to use as the
612 	 * label in the popup menu.
613 	 *
614 	 * Params:
615 	 *     child = the #GtkWidget to use as the contents of the page
616 	 *     tabLabel = the #GtkWidget to be used as the label
617 	 *         for the page, or %NULL to use the default label, “page N”
618 	 *     menuLabel = the widget to use as a label for the
619 	 *         page-switch menu, if that is enabled. If %NULL, and @tab_label
620 	 *         is a #GtkLabel or %NULL, then the menu label will be a newly
621 	 *         created label with the same text as @tab_label; if @tab_label
622 	 *         is not a #GtkLabel, @menu_label must be specified if the
623 	 *         page-switch menu is to be used.
624 	 *
625 	 * Returns: the index (starting from 0) of the prepended
626 	 *     page in the notebook, or -1 if function fails
627 	 */
628 	public int prependPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
629 	{
630 		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());
631 	}
632 
633 	/**
634 	 * Switches to the previous page. Nothing happens if the current page
635 	 * is the first page.
636 	 */
637 	public void prevPage()
638 	{
639 		gtk_notebook_prev_page(gtkNotebook);
640 	}
641 
642 	/**
643 	 * Removes a page from the notebook given its index
644 	 * in the notebook.
645 	 *
646 	 * Params:
647 	 *     pageNum = the index of a notebook page, starting
648 	 *         from 0. If -1, the last page will be removed.
649 	 */
650 	public void removePage(int pageNum)
651 	{
652 		gtk_notebook_remove_page(gtkNotebook, pageNum);
653 	}
654 
655 	/**
656 	 * Reorders the page containing @child, so that it appears in position
657 	 * @position. If @position is greater than or equal to the number of
658 	 * children in the list or negative, @child will be moved to the end
659 	 * of the list.
660 	 *
661 	 * Params:
662 	 *     child = the child to move
663 	 *     position = the new position, or -1 to move to the end
664 	 */
665 	public void reorderChild(Widget child, int position)
666 	{
667 		gtk_notebook_reorder_child(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), position);
668 	}
669 
670 	/**
671 	 * Sets @widget as one of the action widgets. Depending on the pack type
672 	 * the widget will be placed before or after the tabs. You can use
673 	 * a #GtkBox if you need to pack more than one widget on the same side.
674 	 *
675 	 * Note that action widgets are “internal” children of the notebook and thus
676 	 * not included in the list returned from gtk_container_foreach().
677 	 *
678 	 * Params:
679 	 *     widget = a #GtkWidget
680 	 *     packType = pack type of the action widget
681 	 *
682 	 * Since: 2.20
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 	 * Since: 2.24
720 	 */
721 	public void setGroupName(string groupName)
722 	{
723 		gtk_notebook_set_group_name(gtkNotebook, Str.toStringz(groupName));
724 	}
725 
726 	/**
727 	 * Changes the menu label for the page containing @child.
728 	 *
729 	 * Params:
730 	 *     child = the child widget
731 	 *     menuLabel = the menu label, or %NULL for default
732 	 */
733 	public void setMenuLabel(Widget child, Widget menuLabel)
734 	{
735 		gtk_notebook_set_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
736 	}
737 
738 	/**
739 	 * Creates a new label and sets it as the menu label of @child.
740 	 *
741 	 * Params:
742 	 *     child = the child widget
743 	 *     menuText = the label text
744 	 */
745 	public void setMenuLabelText(Widget child, string menuText)
746 	{
747 		gtk_notebook_set_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(menuText));
748 	}
749 
750 	/**
751 	 * Sets whether the tab label area will have arrows for
752 	 * scrolling if there are too many tabs to fit in the area.
753 	 *
754 	 * Params:
755 	 *     scrollable = %TRUE if scroll arrows should be added
756 	 */
757 	public void setScrollable(bool scrollable)
758 	{
759 		gtk_notebook_set_scrollable(gtkNotebook, scrollable);
760 	}
761 
762 	/**
763 	 * Sets whether a bevel will be drawn around the notebook pages.
764 	 * This only has a visual effect when the tabs are not shown.
765 	 * See gtk_notebook_set_show_tabs().
766 	 *
767 	 * Params:
768 	 *     showBorder = %TRUE if a bevel should be drawn around the notebook
769 	 */
770 	public void setShowBorder(bool showBorder)
771 	{
772 		gtk_notebook_set_show_border(gtkNotebook, showBorder);
773 	}
774 
775 	/**
776 	 * Sets whether to show the tabs for the notebook or not.
777 	 *
778 	 * Params:
779 	 *     showTabs = %TRUE if the tabs should be shown
780 	 */
781 	public void setShowTabs(bool showTabs)
782 	{
783 		gtk_notebook_set_show_tabs(gtkNotebook, showTabs);
784 	}
785 
786 	/**
787 	 * Sets whether the tab can be detached from @notebook to another
788 	 * notebook or widget.
789 	 *
790 	 * Note that 2 notebooks must share a common group identificator
791 	 * (see gtk_notebook_set_group_name()) to allow automatic tabs
792 	 * interchange between them.
793 	 *
794 	 * If you want a widget to interact with a notebook through DnD
795 	 * (i.e.: accept dragged tabs from it) it must be set as a drop
796 	 * destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook
797 	 * will fill the selection with a GtkWidget** pointing to the child
798 	 * widget that corresponds to the dropped tab.
799 	 *
800 	 * Note that you should use gtk_notebook_detach_tab() instead
801 	 * of gtk_container_remove() if you want to remove the tab from
802 	 * the source notebook as part of accepting a drop. Otherwise,
803 	 * the source notebook will think that the dragged tab was
804 	 * removed from underneath the ongoing drag operation, and
805 	 * will initiate a drag cancel animation.
806 	 *
807 	 * |[<!-- language="C" -->
808 	 * static void
809 	 * on_drag_data_received (GtkWidget        *widget,
810 	 * GdkDragContext   *context,
811 	 * gint              x,
812 	 * gint              y,
813 	 * GtkSelectionData *data,
814 	 * guint             info,
815 	 * guint             time,
816 	 * gpointer          user_data)
817 	 * {
818 	 * GtkWidget *notebook;
819 	 * GtkWidget **child;
820 	 *
821 	 * notebook = gtk_drag_get_source_widget (context);
822 	 * child = (void*) gtk_selection_data_get_data (data);
823 	 *
824 	 * // process_widget (*child);
825 	 *
826 	 * gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
827 	 * }
828 	 * ]|
829 	 *
830 	 * If you want a notebook to accept drags from other widgets,
831 	 * you will have to set your own DnD code to do it.
832 	 *
833 	 * Params:
834 	 *     child = a child #GtkWidget
835 	 *     detachable = whether the tab is detachable or not
836 	 *
837 	 * Since: 2.10
838 	 */
839 	public void setTabDetachable(Widget child, bool detachable)
840 	{
841 		gtk_notebook_set_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), detachable);
842 	}
843 
844 	/**
845 	 * Changes the tab label for @child.
846 	 * If %NULL is specified for @tab_label, then the page will
847 	 * have the label “page N”.
848 	 *
849 	 * Params:
850 	 *     child = the page
851 	 *     tabLabel = the tab label widget to use, or %NULL
852 	 *         for default tab label
853 	 */
854 	public void setTabLabel(Widget child, Widget tabLabel)
855 	{
856 		gtk_notebook_set_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
857 	}
858 
859 	/**
860 	 * Creates a new label and sets it as the tab label for the page
861 	 * containing @child.
862 	 *
863 	 * Params:
864 	 *     child = the page
865 	 *     tabText = the label text
866 	 */
867 	public void setTabLabelText(Widget child, string tabText)
868 	{
869 		gtk_notebook_set_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(tabText));
870 	}
871 
872 	/**
873 	 * Sets the edge at which the tabs for switching pages in the
874 	 * notebook are drawn.
875 	 *
876 	 * Params:
877 	 *     pos = the edge to draw the tabs at
878 	 */
879 	public void setTabPos(GtkPositionType pos)
880 	{
881 		gtk_notebook_set_tab_pos(gtkNotebook, pos);
882 	}
883 
884 	/**
885 	 * Sets whether the notebook tab can be reordered
886 	 * via drag and drop or not.
887 	 *
888 	 * Params:
889 	 *     child = a child #GtkWidget
890 	 *     reorderable = whether the tab is reorderable or not
891 	 *
892 	 * Since: 2.10
893 	 */
894 	public void setTabReorderable(Widget child, bool reorderable)
895 	{
896 		gtk_notebook_set_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), reorderable);
897 	}
898 
899 	/** */
900 	gulong addOnChangeCurrentPage(bool delegate(int, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
901 	{
902 		return Signals.connect(this, "change-current-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
903 	}
904 
905 	/**
906 	 * The ::create-window signal is emitted when a detachable
907 	 * tab is dropped on the root window.
908 	 *
909 	 * A handler for this signal can create a window containing
910 	 * a notebook where the tab will be attached. It is also
911 	 * responsible for moving/resizing the window and adding the
912 	 * necessary properties to the notebook (e.g. the
913 	 * #GtkNotebook:group-name ).
914 	 *
915 	 * Params:
916 	 *     page = the tab of @notebook that is being detached
917 	 *     x = the X coordinate where the drop happens
918 	 *     y = the Y coordinate where the drop happens
919 	 *
920 	 * Returns: a #GtkNotebook that @page should be
921 	 *     added to, or %NULL.
922 	 *
923 	 * Since: 2.12
924 	 */
925 	gulong addOnCreateWindow(Notebook delegate(Widget, int, int, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
926 	{
927 		return Signals.connect(this, "create-window", dlg, connectFlags ^ ConnectFlags.SWAPPED);
928 	}
929 
930 	/** */
931 	gulong addOnFocusTab(bool delegate(GtkNotebookTab, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
932 	{
933 		return Signals.connect(this, "focus-tab", dlg, connectFlags ^ ConnectFlags.SWAPPED);
934 	}
935 
936 	/** */
937 	gulong addOnMoveFocusOut(void delegate(GtkDirectionType, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
938 	{
939 		return Signals.connect(this, "move-focus-out", dlg, connectFlags ^ ConnectFlags.SWAPPED);
940 	}
941 
942 	/**
943 	 * the ::page-added signal is emitted in the notebook
944 	 * right after a page is added to the notebook.
945 	 *
946 	 * Params:
947 	 *     child = the child #GtkWidget affected
948 	 *     pageNum = the new page number for @child
949 	 *
950 	 * Since: 2.10
951 	 */
952 	gulong addOnPageAdded(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
953 	{
954 		return Signals.connect(this, "page-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
955 	}
956 
957 	/**
958 	 * the ::page-removed signal is emitted in the notebook
959 	 * right after a page is removed from the notebook.
960 	 *
961 	 * Params:
962 	 *     child = the child #GtkWidget affected
963 	 *     pageNum = the @child page number
964 	 *
965 	 * Since: 2.10
966 	 */
967 	gulong addOnPageRemoved(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
968 	{
969 		return Signals.connect(this, "page-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
970 	}
971 
972 	/**
973 	 * the ::page-reordered signal is emitted in the notebook
974 	 * right after a page has been reordered.
975 	 *
976 	 * Params:
977 	 *     child = the child #GtkWidget affected
978 	 *     pageNum = the new page number for @child
979 	 *
980 	 * Since: 2.10
981 	 */
982 	gulong addOnPageReordered(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
983 	{
984 		return Signals.connect(this, "page-reordered", dlg, connectFlags ^ ConnectFlags.SWAPPED);
985 	}
986 
987 	/** */
988 	gulong addOnReorderTab(bool delegate(GtkDirectionType, bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
989 	{
990 		return Signals.connect(this, "reorder-tab", dlg, connectFlags ^ ConnectFlags.SWAPPED);
991 	}
992 
993 	/** */
994 	gulong addOnSelectPage(bool delegate(bool, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
995 	{
996 		return Signals.connect(this, "select-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
997 	}
998 
999 	/**
1000 	 * Emitted when the user or a function changes the current page.
1001 	 *
1002 	 * Params:
1003 	 *     page = the new current page
1004 	 *     pageNum = the index of the page
1005 	 */
1006 	gulong addOnSwitchPage(void delegate(Widget, uint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1007 	{
1008 		return Signals.connect(this, "switch-page", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1009 	}
1010 }