alternative to assert
[gtkD.git] / src / gtk / Notebook.d
blobc2e162a5cd4e9fc3d144482933bc20f38029cca0
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkNotebook.html
26 * outPack = gtk
27 * outFile = Notebook
28 * strct = GtkNotebook
29 * realStrct=
30 * ctorStrct=
31 * clss = Notebook
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_notebook_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.Label
47 * - gtk.Widget
48 * structWrap:
49 * - GtkWidget* -> Widget
50 * local aliases:
53 module gtk.Notebook;
55 private import gtk.gtktypes;
57 private import lib.gtk;
59 private import glib.Str;
60 private import gtk.Label;
61 private import gtk.Widget;
63 /**
64 * Description
65 * The GtkNotebook widget is a GtkContainer whose children are pages that
66 * can be switched between using tab labels along one edge.
67 * There are many configuration options for GtkNotebook. Among other
68 * things, you can choose on which edge the tabs appear
69 * (see gtk_notebook_set_tab_pos()), whether, if there are too many
70 * tabs to fit the noteobook should be made bigger or scrolling
71 * arrows added (see gtk_notebook_set_scrollable), and whether there
72 * will be a popup menu allowing the users to switch pages.
73 * (see gtk_notebook_enable_popup(), gtk_noteobook_disable_popup())
75 private import gtk.Container;
76 public class Notebook : Container
79 /** the main Gtk struct */
80 protected GtkNotebook* gtkNotebook;
83 public GtkNotebook* getNotebookStruct()
85 return gtkNotebook;
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gtkNotebook;
95 /**
96 * Sets our main struct and passes it to the parent class
98 public this (GtkNotebook* gtkNotebook)
100 super(cast(GtkContainer*)gtkNotebook);
101 this.gtkNotebook = gtkNotebook;
104 /** The GtkNotebookTab is not documented */
105 public enum GtkNotebookTab
107 GTK_NOTEBOOK_TAB_FIRST,
108 GTK_NOTEBOOK_TAB_LAST
110 alias GtkNotebookTab NotebookTab;
113 * Append a page with a widget and a text for a label
115 public int appendPage(Widget child, char[] tabLabel)
117 return appendPage(child, new Label(tabLabel));
120 void setCurrentPage(Widget child)
122 gtk_notebook_set_current_page(gtkNotebook,gtk_notebook_page_num(gtkNotebook, child.getWidgetStruct()));
130 // imports for the signal processing
131 private import gobject.Signals;
132 private import gdk.gdktypes;
133 int[char[]] connectedSignals;
135 void delegate(gint, Notebook)[] onChangeCurrentPageListeners;
136 void addOnChangeCurrentPage(void delegate(gint, Notebook) dlg)
138 if ( !("change-current-page" in connectedSignals) )
140 Signals.connectData(
141 getStruct(),
142 "change-current-page",
143 cast(GCallback)&callBackChangeCurrentPage,
144 this,
145 null,
146 cast(ConnectFlags)0);
147 connectedSignals["change-current-page"] = 1;
149 onChangeCurrentPageListeners ~= dlg;
151 extern(C) static void callBackChangeCurrentPage(GtkNotebook* notebookStruct, gint arg1, Notebook notebook)
153 bit consumed = false;
155 foreach ( void delegate(gint, Notebook) dlg ; notebook.onChangeCurrentPageListeners )
157 dlg(arg1, notebook);
160 return consumed;
163 gboolean delegate(GtkNotebookTab, Notebook)[] onFocusTabListeners;
164 void addOnFocusTab(gboolean delegate(GtkNotebookTab, Notebook) dlg)
166 if ( !("focus-tab" in connectedSignals) )
168 Signals.connectData(
169 getStruct(),
170 "focus-tab",
171 cast(GCallback)&callBackFocusTab,
172 this,
173 null,
174 cast(ConnectFlags)0);
175 connectedSignals["focus-tab"] = 1;
177 onFocusTabListeners ~= dlg;
179 extern(C) static void callBackFocusTab(GtkNotebook* notebookStruct, GtkNotebookTab arg1, Notebook notebook)
181 bit consumed = false;
183 foreach ( gboolean delegate(GtkNotebookTab, Notebook) dlg ; notebook.onFocusTabListeners )
185 dlg(arg1, notebook);
188 return consumed;
191 void delegate(GtkDirectionType, Notebook)[] onMoveFocusOutListeners;
192 void addOnMoveFocusOut(void delegate(GtkDirectionType, Notebook) dlg)
194 if ( !("move-focus-out" in connectedSignals) )
196 Signals.connectData(
197 getStruct(),
198 "move-focus-out",
199 cast(GCallback)&callBackMoveFocusOut,
200 this,
201 null,
202 cast(ConnectFlags)0);
203 connectedSignals["move-focus-out"] = 1;
205 onMoveFocusOutListeners ~= dlg;
207 extern(C) static void callBackMoveFocusOut(GtkNotebook* notebookStruct, GtkDirectionType arg1, Notebook notebook)
209 bit consumed = false;
211 foreach ( void delegate(GtkDirectionType, Notebook) dlg ; notebook.onMoveFocusOutListeners )
213 dlg(arg1, notebook);
216 return consumed;
219 void delegate(Widget, guint, Notebook)[] onPageAddedListeners;
220 void addOnPageAdded(void delegate(Widget, guint, Notebook) dlg)
222 if ( !("page-added" in connectedSignals) )
224 Signals.connectData(
225 getStruct(),
226 "page-added",
227 cast(GCallback)&callBackPageAdded,
228 this,
229 null,
230 cast(ConnectFlags)0);
231 connectedSignals["page-added"] = 1;
233 onPageAddedListeners ~= dlg;
235 extern(C) static void callBackPageAdded(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook notebook)
237 bit consumed = false;
239 foreach ( void delegate(Widget, guint, Notebook) dlg ; notebook.onPageAddedListeners )
241 dlg(new Widget(child), pageNum, notebook);
244 return consumed;
247 void delegate(Widget, guint, Notebook)[] onPageRemovedListeners;
248 void addOnPageRemoved(void delegate(Widget, guint, Notebook) dlg)
250 if ( !("page-removed" in connectedSignals) )
252 Signals.connectData(
253 getStruct(),
254 "page-removed",
255 cast(GCallback)&callBackPageRemoved,
256 this,
257 null,
258 cast(ConnectFlags)0);
259 connectedSignals["page-removed"] = 1;
261 onPageRemovedListeners ~= dlg;
263 extern(C) static void callBackPageRemoved(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook notebook)
265 bit consumed = false;
267 foreach ( void delegate(Widget, guint, Notebook) dlg ; notebook.onPageRemovedListeners )
269 dlg(new Widget(child), pageNum, notebook);
272 return consumed;
275 void delegate(Widget, guint, Notebook)[] onPageReorderedListeners;
276 void addOnPageReordered(void delegate(Widget, guint, Notebook) dlg)
278 if ( !("page-reordered" in connectedSignals) )
280 Signals.connectData(
281 getStruct(),
282 "page-reordered",
283 cast(GCallback)&callBackPageReordered,
284 this,
285 null,
286 cast(ConnectFlags)0);
287 connectedSignals["page-reordered"] = 1;
289 onPageReorderedListeners ~= dlg;
291 extern(C) static void callBackPageReordered(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook notebook)
293 bit consumed = false;
295 foreach ( void delegate(Widget, guint, Notebook) dlg ; notebook.onPageReorderedListeners )
297 dlg(new Widget(child), pageNum, notebook);
300 return consumed;
303 void delegate(GtkDirectionType, gboolean, Notebook)[] onReorderTabListeners;
304 void addOnReorderTab(void delegate(GtkDirectionType, gboolean, Notebook) dlg)
306 if ( !("reorder-tab" in connectedSignals) )
308 Signals.connectData(
309 getStruct(),
310 "reorder-tab",
311 cast(GCallback)&callBackReorderTab,
312 this,
313 null,
314 cast(ConnectFlags)0);
315 connectedSignals["reorder-tab"] = 1;
317 onReorderTabListeners ~= dlg;
319 extern(C) static void callBackReorderTab(GtkNotebook* notebookStruct, GtkDirectionType arg1, gboolean arg2, Notebook notebook)
321 bit consumed = false;
323 foreach ( void delegate(GtkDirectionType, gboolean, Notebook) dlg ; notebook.onReorderTabListeners )
325 dlg(arg1, arg2, notebook);
328 return consumed;
331 gboolean delegate(gboolean, Notebook)[] onSelectPageListeners;
332 void addOnSelectPage(gboolean delegate(gboolean, Notebook) dlg)
334 if ( !("select-page" in connectedSignals) )
336 Signals.connectData(
337 getStruct(),
338 "select-page",
339 cast(GCallback)&callBackSelectPage,
340 this,
341 null,
342 cast(ConnectFlags)0);
343 connectedSignals["select-page"] = 1;
345 onSelectPageListeners ~= dlg;
347 extern(C) static void callBackSelectPage(GtkNotebook* notebookStruct, gboolean arg1, Notebook notebook)
349 bit consumed = false;
351 foreach ( gboolean delegate(gboolean, Notebook) dlg ; notebook.onSelectPageListeners )
353 dlg(arg1, notebook);
356 return consumed;
359 void delegate(GtkNotebookPage*, guint, Notebook)[] onSwitchPageListeners;
360 void addOnSwitchPage(void delegate(GtkNotebookPage*, guint, Notebook) dlg)
362 if ( !("switch-page" in connectedSignals) )
364 Signals.connectData(
365 getStruct(),
366 "switch-page",
367 cast(GCallback)&callBackSwitchPage,
368 this,
369 null,
370 cast(ConnectFlags)0);
371 connectedSignals["switch-page"] = 1;
373 onSwitchPageListeners ~= dlg;
375 extern(C) static void callBackSwitchPage(GtkNotebook* notebookStruct, GtkNotebookPage* page, guint pageNum, Notebook notebook)
377 bit consumed = false;
379 foreach ( void delegate(GtkNotebookPage*, guint, Notebook) dlg ; notebook.onSwitchPageListeners )
381 dlg(page, pageNum, notebook);
384 return consumed;
391 * Creates a new GtkNotebook widget with no pages.
392 * Returns:
393 * the newly created GtkNotebook
395 public this ()
397 // GtkWidget* gtk_notebook_new (void);
398 this(cast(GtkNotebook*)gtk_notebook_new() );
402 * Appends a page to notebook.
403 * notebook:
404 * a GtkNotebook
405 * child:
406 * the GtkWidget to use as the contents of the page.
407 * tab_label:
408 * the GtkWidget to be used as the label for the page,
409 * or NULL to use the default label, 'page N'.
410 * Returns:
411 * the index (starting from 0) of the appended
412 * page in the notebook, or -1 if function fails
414 public int appendPage(Widget child, Widget tabLabel)
416 // gint gtk_notebook_append_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label);
417 return gtk_notebook_append_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
421 * Appends a page to notebook, specifying the widget to use as the
422 * label in the popup menu.
423 * notebook:
424 * a GtkNotebook
425 * child:
426 * the GtkWidget to use as the contents of the page.
427 * tab_label:
428 * the GtkWidget to be used as the label for the page,
429 * or NULL to use the default label, 'page N'.
430 * menu_label:
431 * the widget to use as a label for the page-switch
432 * menu, if that is enabled. If NULL, and tab_label
433 * is a GtkLabel or NULL, then the menu label will be
434 * a newly created label with the same text as tab_label;
435 * If tab_label is not a GtkLabel, menu_label must be
436 * specified if the page-switch menu is to be used.
437 * Returns:
438 * the index (starting from 0) of the appended
439 * page in the notebook, or -1 if function fails
441 public int appendPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
443 // gint gtk_notebook_append_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label);
444 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());
448 * Prepends a page to notebook.
449 * notebook:
450 * a GtkNotebook
451 * child:
452 * the GtkWidget to use as the contents of the page.
453 * tab_label:
454 * the GtkWidget to be used as the label for the page,
455 * or NULL to use the default label, 'page N'.
456 * Returns:
457 * the index (starting from 0) of the prepended
458 * page in the notebook, or -1 if function fails
460 public int prependPage(Widget child, Widget tabLabel)
462 // gint gtk_notebook_prepend_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label);
463 return gtk_notebook_prepend_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
467 * Prepends a page to notebook, specifying the widget to use as the
468 * label in the popup menu.
469 * notebook:
470 * a GtkNotebook
471 * child:
472 * the GtkWidget to use as the contents of the page.
473 * tab_label:
474 * the GtkWidget to be used as the label for the page,
475 * or NULL to use the default label, 'page N'.
476 * menu_label:
477 * the widget to use as a label for the page-switch
478 * menu, if that is enabled. If NULL, and tab_label
479 * is a GtkLabel or NULL, then the menu label will be
480 * a newly created label with the same text as tab_label;
481 * If tab_label is not a GtkLabel, menu_label must be
482 * specified if the page-switch menu is to be used.
483 * Returns:
484 * the index (starting from 0) of the prepended
485 * page in the notebook, or -1 if function fails
487 public int prependPageMenu(Widget child, Widget tabLabel, Widget menuLabel)
489 // gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label);
490 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());
494 * Insert a page into notebook at the given position.
495 * notebook:
496 * a GtkNotebook
497 * child:
498 * the GtkWidget to use as the contents of the page.
499 * tab_label:
500 * the GtkWidget to be used as the label for the page,
501 * or NULL to use the default label, 'page N'.
502 * position:
503 * the index (starting at 0) at which to insert the page,
504 * or -1 to append the page after all other pages.
505 * Returns:
506 * the index (starting from 0) of the inserted
507 * page in the notebook, or -1 if function fails
509 public int insertPage(Widget child, Widget tabLabel, int position)
511 // gint gtk_notebook_insert_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, gint position);
512 return gtk_notebook_insert_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), position);
516 * Insert a page into notebook at the given position, specifying
517 * the widget to use as the label in the popup menu.
518 * notebook:
519 * a GtkNotebook
520 * child:
521 * the GtkWidget to use as the contents of the page.
522 * tab_label:
523 * the GtkWidget to be used as the label for the page,
524 * or NULL to use the default label, 'page N'.
525 * menu_label:
526 * the widget to use as a label for the page-switch
527 * menu, if that is enabled. If NULL, and tab_label
528 * is a GtkLabel or NULL, then the menu label will be
529 * a newly created label with the same text as tab_label;
530 * If tab_label is not a GtkLabel, menu_label must be
531 * specified if the page-switch menu is to be used.
532 * position:
533 * the index (starting at 0) at which to insert the page,
534 * or -1 to append the page after all other pages.
535 * Returns:
536 * the index (starting from 0) of the inserted
537 * page in the notebook
539 public int insertPageMenu(Widget child, Widget tabLabel, Widget menuLabel, int position)
541 // gint gtk_notebook_insert_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label, gint position);
542 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);
546 * Removes a page from the notebook given its index
547 * in the notebook.
548 * notebook:
549 * a GtkNotebook.
550 * page_num:
551 * the index of a notebook page, starting
552 * from 0. If -1, the last page will
553 * be removed.
555 public void removePage(int pageNum)
557 // void gtk_notebook_remove_page (GtkNotebook *notebook, gint page_num);
558 gtk_notebook_remove_page(gtkNotebook, pageNum);
563 * Finds the index of the page which contains the given child
564 * widget.
565 * notebook:
566 * a GtkNotebook
567 * child:
568 * a GtkWidget
569 * Returns:
570 * the index of the page containing child, or
571 * -1 if child is not in the notebook.
573 public int pageNum(Widget child)
575 // gint gtk_notebook_page_num (GtkNotebook *notebook, GtkWidget *child);
576 return gtk_notebook_page_num(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
581 * Switches to the next page. Nothing happens if the current page is
582 * the last page.
583 * notebook:
584 * a GtkNotebook
586 public void nextPage()
588 // void gtk_notebook_next_page (GtkNotebook *notebook);
589 gtk_notebook_next_page(gtkNotebook);
593 * Switches to the previous page. Nothing happens if the current page
594 * is the first page.
595 * notebook:
596 * a GtkNotebook
598 public void prevPage()
600 // void gtk_notebook_prev_page (GtkNotebook *notebook);
601 gtk_notebook_prev_page(gtkNotebook);
605 * Reorders the page containing child, so that it appears in position
606 * position. If position is greater than or equal to the number of
607 * children in the list or negative, child will be moved to the end
608 * of the list.
609 * notebook:
610 * a GtkNotebook
611 * child:
612 * the child to move
613 * position:
614 * the new position, or -1 to move to the end
616 public void reorderChild(Widget child, int position)
618 // void gtk_notebook_reorder_child (GtkNotebook *notebook, GtkWidget *child, gint position);
619 gtk_notebook_reorder_child(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), position);
623 * Sets the edge at which the tabs for switching pages in the
624 * notebook are drawn.
625 * notebook:
626 * a GtkNotebook.
627 * pos:
628 * the edge to draw the tabs at.
630 public void setTabPos(GtkPositionType pos)
632 // void gtk_notebook_set_tab_pos (GtkNotebook *notebook, GtkPositionType pos);
633 gtk_notebook_set_tab_pos(gtkNotebook, pos);
637 * Sets whether to show the tabs for the notebook or not.
638 * notebook:
639 * a GtkNotebook
640 * show_tabs:
641 * TRUE if the tabs should be shown.
643 public void setShowTabs(int showTabs)
645 // void gtk_notebook_set_show_tabs (GtkNotebook *notebook, gboolean show_tabs);
646 gtk_notebook_set_show_tabs(gtkNotebook, showTabs);
650 * Sets whether a bevel will be drawn around the notebook pages.
651 * This only has a visual effect when the tabs are not shown.
652 * See gtk_notebook_set_show_tabs().
653 * notebook:
654 * a GtkNotebook
655 * show_border:
656 * TRUE if a bevel should be drawn around the notebook.
658 public void setShowBorder(int showBorder)
660 // void gtk_notebook_set_show_border (GtkNotebook *notebook, gboolean show_border);
661 gtk_notebook_set_show_border(gtkNotebook, showBorder);
665 * Sets whether the tab label area will have arrows for scrolling if
666 * there are too many tabs to fit in the area.
667 * notebook:
668 * a GtkNotebook
669 * scrollable:
670 * TRUE if scroll arrows should be added
672 public void setScrollable(int scrollable)
674 // void gtk_notebook_set_scrollable (GtkNotebook *notebook, gboolean scrollable);
675 gtk_notebook_set_scrollable(gtkNotebook, scrollable);
679 * Warning
680 * gtk_notebook_set_tab_border is deprecated and should not be used in newly-written code.
681 * Sets the width the border around the tab labels
682 * in a notebook. This is equivalent to calling
683 * gtk_notebook_set_tab_hborder (notebook, border_width) followed
684 * by gtk_notebook_set_tab_vborder (notebook, border_width).
685 * notebook:
686 * a GtkNotebook
687 * border_width:
688 * width of the border around the tab labels.
690 public void setTabBorder(uint borderWidth)
692 // void gtk_notebook_set_tab_border (GtkNotebook *notebook, guint border_width);
693 gtk_notebook_set_tab_border(gtkNotebook, borderWidth);
697 * Enables the popup menu: if the user clicks with the right mouse button on
698 * the bookmarks, a menu with all the pages will be popped up.
699 * notebook:
700 * a GtkNotebook
702 public void popupEnable()
704 // void gtk_notebook_popup_enable (GtkNotebook *notebook);
705 gtk_notebook_popup_enable(gtkNotebook);
709 * Disables the popup menu.
710 * notebook:
711 * a GtkNotebook
713 public void popupDisable()
715 // void gtk_notebook_popup_disable (GtkNotebook *notebook);
716 gtk_notebook_popup_disable(gtkNotebook);
720 * Returns the page number of the current page.
721 * notebook:
722 * a GtkNotebook
723 * Returns:
724 * the index (starting from 0) of the current
725 * page in the notebook. If the notebook has no pages, then
726 * -1 will be returned.
728 public int getCurrentPage()
730 // gint gtk_notebook_get_current_page (GtkNotebook *notebook);
731 return gtk_notebook_get_current_page(gtkNotebook);
735 * Retrieves the menu label widget of the page containing child.
736 * notebook:
737 * a GtkNotebook
738 * child:
739 * a widget contained in a page of notebook
740 * Returns:
741 * the menu label, or NULL if the
742 * notebook page does not have a menu label other
743 * than the default (the tab label).
745 public Widget getMenuLabel(Widget child)
747 // GtkWidget* gtk_notebook_get_menu_label (GtkNotebook *notebook, GtkWidget *child);
748 return new Widget( gtk_notebook_get_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) );
752 * Returns the child widget contained in page number page_num.
753 * notebook:
754 * a GtkNotebook
755 * page_num:
756 * the index of a page in the noteobok, or -1
757 * to get the last page.
758 * Returns:
759 * the child widget, or NULL if page_num is
760 * out of bounds.
762 public Widget getNthPage(int pageNum)
764 // GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook, gint page_num);
765 return new Widget( gtk_notebook_get_nth_page(gtkNotebook, pageNum) );
769 * Gets the number of pages in a notebook.
770 * notebook:
771 * a GtkNotebook
772 * Returns:
773 * the number of pages in the notebook.
774 * Since 2.2
776 public int getNPages()
778 // gint gtk_notebook_get_n_pages (GtkNotebook *notebook);
779 return gtk_notebook_get_n_pages(gtkNotebook);
783 * Returns the tab label widget for the page child. NULL is returned
784 * if child is not in notebook or if no tab label has specifically
785 * been set for child.
786 * notebook:
787 * a GtkNotebook
788 * child:
789 * the page
790 * Returns:
791 * the tab label
793 public Widget getTabLabel(Widget child)
795 // GtkWidget* gtk_notebook_get_tab_label (GtkNotebook *notebook, GtkWidget *child);
796 return new Widget( gtk_notebook_get_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) );
800 * Query the packing attributes for the tab label of the page
801 * containing child.
802 * notebook:
803 * a GtkNotebook
804 * child:
805 * the page
806 * expand:
807 * location to store the expand value (or NULL)
808 * fill:
809 * location to store the fill value (or NULL)
810 * pack_type:
811 * location to store the pack_type (or NULL)
813 public void queryTabLabelPacking(Widget child, int* expand, int* fill, GtkPackType* packType)
815 // void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook, GtkWidget *child, gboolean *expand, gboolean *fill, GtkPackType *pack_type);
816 gtk_notebook_query_tab_label_packing(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), expand, fill, packType);
820 * Warning
821 * gtk_notebook_set_homogeneous_tabs is deprecated and should not be used in newly-written code.
822 * Sets whether the tabs must have all the same size or not.
823 * notebook:
824 * a GtkNotebook
825 * homogeneous:
826 * TRUE if all tabs should be the same size.
828 public void setHomogeneousTabs(int homogeneous)
830 // void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook, gboolean homogeneous);
831 gtk_notebook_set_homogeneous_tabs(gtkNotebook, homogeneous);
835 * Changes the menu label for the page containing child.
836 * notebook:
837 * a GtkNotebook
838 * child:
839 * the child widget
840 * menu_label:
841 * the menu label, or NULL for default
843 public void setMenuLabel(Widget child, Widget menuLabel)
845 // void gtk_notebook_set_menu_label (GtkNotebook *notebook, GtkWidget *child, GtkWidget *menu_label);
846 gtk_notebook_set_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct());
850 * Creates a new label and sets it as the menu label of child.
851 * notebook:
852 * a GtkNotebook
853 * child:
854 * the child widget
855 * menu_text:
856 * the label text
858 public void setMenuLabelText(Widget child, char[] menuText)
860 // void gtk_notebook_set_menu_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *menu_text);
861 gtk_notebook_set_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(menuText));
865 * Warning
866 * gtk_notebook_set_tab_hborder is deprecated and should not be used in newly-written code.
867 * Sets the width of the horizontal border of tab labels.
868 * notebook:
869 * a GtkNotebook
870 * tab_hborder:
871 * width of the horizontal border of tab labels.
873 public void setTabHborder(uint tabHborder)
875 // void gtk_notebook_set_tab_hborder (GtkNotebook *notebook, guint tab_hborder);
876 gtk_notebook_set_tab_hborder(gtkNotebook, tabHborder);
880 * Changes the tab label for child. If NULL is specified
881 * for tab_label, then the page will have the label 'page N'.
882 * notebook:
883 * a GtkNotebook
884 * child:
885 * the page
886 * tab_label:
887 * the tab label widget to use, or NULL for default tab
888 * label.
890 public void setTabLabel(Widget child, Widget tabLabel)
892 // void gtk_notebook_set_tab_label (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label);
893 gtk_notebook_set_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
897 * Sets the packing parameters for the tab label of the page
898 * containing child. See gtk_box_pack_start() for the exact meaning
899 * of the parameters.
900 * notebook:
901 * a GtkNotebook
902 * child:
903 * the child widget
904 * expand:
905 * whether to expand the bookmark or not
906 * fill:
907 * whether the bookmark should fill the allocated area or not
908 * pack_type:
909 * the position of the bookmark
911 public void setTabLabelPacking(Widget child, int expand, int fill, GtkPackType packType)
913 // void gtk_notebook_set_tab_label_packing (GtkNotebook *notebook, GtkWidget *child, gboolean expand, gboolean fill, GtkPackType pack_type);
914 gtk_notebook_set_tab_label_packing(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), expand, fill, packType);
918 * Creates a new label and sets it as the tab label for the page
919 * containing child.
920 * notebook:
921 * a GtkNotebook
922 * child:
923 * the page
924 * tab_text:
925 * the label text
927 public void setTabLabelText(Widget child, char[] tabText)
929 // void gtk_notebook_set_tab_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *tab_text);
930 gtk_notebook_set_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(tabText));
934 * Warning
935 * gtk_notebook_set_tab_vborder is deprecated and should not be used in newly-written code.
936 * Sets the width of the vertical border of tab labels.
937 * notebook:
938 * a GtkNotebook
939 * tab_vborder:
940 * width of the vertical border of tab labels.
942 public void setTabVborder(uint tabVborder)
944 // void gtk_notebook_set_tab_vborder (GtkNotebook *notebook, guint tab_vborder);
945 gtk_notebook_set_tab_vborder(gtkNotebook, tabVborder);
949 * Sets whether the notebook tab can be reordered
950 * via drag and drop or not.
951 * notebook:
952 * a GtkNotebook
953 * child:
954 * a child GtkWidget
955 * reorderable:
956 * whether the tab is reorderable or not.
957 * Since 2.10
959 public void setTabReorderable(Widget child, int reorderable)
961 // void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook, GtkWidget *child, gboolean reorderable);
962 gtk_notebook_set_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), reorderable);
966 * Sets whether the tab can be detached from notebook to another
967 * notebook or widget.
968 * Note that 2 notebooks must share a common group identificator
969 * (see gtk_notebook_set_group_id()) to allow automatic tabs
970 * interchange between them.
971 * If you want a widget to interact with a notebook through DnD
972 * (i.e.: accept dragged tabs from it) it must be set as a drop
973 * destination and accept the target "GTK_NOTEBOOK_TAB". The notebook
974 * will fill the selection with a GtkWidget** pointing to the child
975 * widget that corresponds to the dropped tab.
976 * static void
977 * on_drop_zone_drag_data_received (GtkWidget *widget,
978 * GdkDragContext *context,
979 * gint x,
980 * gint y,
981 * GtkSelectionData *selection_data,
982 * guint info,
983 * guint time,
984 * gpointer user_data)
986 * GtkWidget *notebook;
987 * GtkWidget **child;
988 * notebook = gtk_drag_get_source_widget (context);
989 * child = (void*) selection_data->data;
990 * process_widget (*child);
991 * gtk_container_remove (GTK_CONTAINER (notebook), *child);
993 * If you want a notebook to accept drags from other widgets,
994 * you will have to set your own DnD code to do it.
995 * notebook:
996 * a GtkNotebook
997 * child:
998 * a child GtkWidget
999 * detachable:
1000 * whether the tab is detachable or not
1001 * Since 2.10
1003 public void setTabDetachable(Widget child, int detachable)
1005 // void gtk_notebook_set_tab_detachable (GtkNotebook *notebook, GtkWidget *child, gboolean detachable);
1006 gtk_notebook_set_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), detachable);
1010 * Retrieves the text of the menu label for the page containing
1011 * child.
1012 * notebook:
1013 * a GtkNotebook
1014 * child:
1015 * the child widget of a page of the notebook.
1016 * Returns:
1017 * value: the text of the tab label, or NULL if the
1018 * widget does not have a menu label other than
1019 * the default menu label, or the menu label widget
1020 * is not a GtkLabel. The string is owned by
1021 * the widget and must not be freed.
1023 public char[] getMenuLabelText(Widget child)
1025 // const gchar* gtk_notebook_get_menu_label_text (GtkNotebook *notebook, GtkWidget *child);
1026 return Str.toString(gtk_notebook_get_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) );
1030 * Returns whether the tab label area has arrows for scrolling. See
1031 * gtk_notebook_set_scrollable().
1032 * notebook:
1033 * a GtkNotebook
1034 * Returns:
1035 * TRUE if arrows for scrolling are present
1037 public int getScrollable()
1039 // gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook);
1040 return gtk_notebook_get_scrollable(gtkNotebook);
1044 * Returns whether a bevel will be drawn around the notebook pages. See
1045 * gtk_notebook_set_show_border().
1046 * notebook:
1047 * a GtkNotebook
1048 * Returns:
1049 * TRUE if the bevel is drawn
1051 public int getShowBorder()
1053 // gboolean gtk_notebook_get_show_border (GtkNotebook *notebook);
1054 return gtk_notebook_get_show_border(gtkNotebook);
1058 * Returns whether the tabs of the notebook are shown. See
1059 * gtk_notebook_set_show_tabs().
1060 * notebook:
1061 * a GtkNotebook
1062 * Returns:
1063 * TRUE if the tabs are shown
1065 public int getShowTabs()
1067 // gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook);
1068 return gtk_notebook_get_show_tabs(gtkNotebook);
1072 * Retrieves the text of the tab label for the page containing
1073 * child.
1074 * notebook:
1075 * a GtkNotebook
1076 * child:
1077 * a widget contained in a page of notebook
1078 * Returns:
1079 * value: the text of the tab label, or NULL if the
1080 * tab label widget is not a GtkLabel. The
1081 * string is owned by the widget and must not
1082 * be freed.
1084 public char[] getTabLabelText(Widget child)
1086 // const gchar* gtk_notebook_get_tab_label_text (GtkNotebook *notebook, GtkWidget *child);
1087 return Str.toString(gtk_notebook_get_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct()) );
1091 * Gets the edge at which the tabs for switching pages in the
1092 * notebook are drawn.
1093 * notebook:
1094 * a GtkNotebook
1095 * Returns:
1096 * the edge at which the tabs are drawn
1098 public GtkPositionType getTabPos()
1100 // GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook);
1101 return gtk_notebook_get_tab_pos(gtkNotebook);
1105 * Gets whether the tab can be reordered via drag and drop or not.
1106 * notebook:
1107 * a GtkNotebook
1108 * child:
1109 * a child GtkWidget
1110 * Returns:
1111 * TRUE if the tab is reorderable.
1112 * Since 2.10
1114 public int getTabReorderable(Widget child)
1116 // gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook, GtkWidget *child);
1117 return gtk_notebook_get_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
1121 * Returns whether the tab contents can be detached from notebook.
1122 * notebook:
1123 * a GtkNotebook
1124 * child:
1125 * a child GtkWidget
1126 * Returns:
1127 * TRUE if the tab is detachable.
1128 * Since 2.10
1130 public int getTabDetachable(Widget child)
1132 // gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook, GtkWidget *child);
1133 return gtk_notebook_get_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct());
1137 * Switches to the page number page_num.
1138 * Note that due to historical reasons, GtkNotebook refuses
1139 * to switch to a page unless the child widget is visible.
1140 * Therefore, it is recommended to show child widgets before
1141 * adding them to a notebook.
1142 * notebook:
1143 * a GtkNotebook
1144 * page_num:
1145 * index of the page to switch to, starting from 0.
1146 * If negative, the last page will be used. If greater
1147 * than the number of pages in the notebook, nothing
1148 * will be done.
1150 public void setCurrentPage(int pageNum)
1152 // void gtk_notebook_set_current_page (GtkNotebook *notebook, gint page_num);
1153 gtk_notebook_set_current_page(gtkNotebook, pageNum);
1157 * Sets an group identificator for notebook, notebooks sharing
1158 * the same group identificator will be able to exchange tabs
1159 * via drag and drop. A notebook with group identificator -1 will
1160 * not be able to exchange tabs with any other notebook.
1161 * notebook:
1162 * a GtkNotebook
1163 * group_id:
1164 * a group identificator, or -1 to unset it
1165 * Since 2.10
1167 public void setGroupId(int groupId)
1169 // void gtk_notebook_set_group_id (GtkNotebook *notebook, gint group_id);
1170 gtk_notebook_set_group_id(gtkNotebook, groupId);
1174 * Gets the current group identificator for notebook.
1175 * notebook:
1176 * a GtkNotebook
1177 * Returns:
1178 * the group identificator, or -1 if none is set.
1179 * Since 2.10
1181 public int getGroupId()
1183 // gint gtk_notebook_get_group_id (GtkNotebook *notebook);
1184 return gtk_notebook_get_group_id(gtkNotebook);
1189 * Installs a global function used to create a window
1190 * when a detached tab is dropped in an empty area.
1191 * func:
1192 * the GtkNotebookWindowCreationFunc, or NULL
1193 * data:
1194 * user data for func
1195 * destroy:
1196 * Destroy notifier for data, or NULL
1197 * Since 2.10
1198 * Property Details
1199 * The "enable-popup" property
1200 * "enable-popup" gboolean : Read / Write
1201 * If TRUE, pressing the right mouse button on the notebook pops up a menu that you can use to go to a page.
1202 * Default value: FALSE
1204 public static void setWindowCreationHook(GtkNotebookWindowCreationFunc func, void* data, GDestroyNotify destroy)
1206 // void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func, gpointer data, GDestroyNotify destroy);
1207 gtk_notebook_set_window_creation_hook(func, data, destroy);