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