gtk.notebook
Module for [Notebook] class
Types 3
The #GtkNotebook widget is a #GtkContainer whose children are pages that can be switched between using tab labels along one edge.
There are many configuration options for GtkNotebook. Among other things, you can choose on which edge the tabs appear (see gtk.notebook.Notebook.setTabPos), whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added (see gtk.notebook.Notebook.setScrollable), and whether there will be a popup menu allowing the users to switch pages. (see gtk.notebook.Notebook.popupEnable, gtk.notebook.Notebook.popupDisable)
GtkNotebook as GtkBuildable
The GtkNotebook implementation of the #GtkBuildable interface supports placing children into tabs by specifying “tab” as the “type” attribute of a <child> element. Note that the content of the tab must be created before the tab can be filled. A tab child can be specified without specifying a <child> type attribute.
To add a child widget in the notebooks action area, specify "action-start" or “action-end” as the “type” attribute of the <child> element.
An example of a UI definition fragment with GtkNotebook:
<object class="GtkNotebook">
<child>
<object class="GtkLabel" id="notebook-content">
<property name="label">Content</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="notebook-tab">
<property name="label">Tab</property>
</object>
</child>
</object>CSS nodes
notebook
├── header.top
│ ├── [<action widget>]
│ ├── tabs
│ │ ├── [arrow]
│ │ ├── tab
│ │ │ ╰── <tab label>
┊ ┊ ┊
│ │ ├── tab[.reorderable-page]
│ │ │ ╰── <tab label>
│ │ ╰── [arrow]
│ ╰── [<action widget>]
│
╰── stack
├── <child>
┊
╰── <child>GtkNotebook has a main CSS node with name notebook, a subnode with name header and below that a subnode with name tabs which contains one subnode per tab with name tab.
If action widgets are present, their CSS nodes are placed next to the tabs node. If the notebook is scrollable, CSS nodes with name arrow are placed as first and last child of the tabs node.
The main node gets the .frame style class when the notebook has a border (see gtk.notebook.Notebook.setShowBorder).
The header node gets one of the style class .top, .bottom, .left or .right, depending on where the tabs are placed. For reorderable pages, the tab node gets the .reorderable-page class.
A tab node gets the .dnd style class while it is moved with drag-and-drop.
The nodes are always arranged from left-to-right, regarldess of text direction.
NotebookGidBuilder builder() static nothrowGet builder for [gtk.notebook.Notebook] Returns: New builder objectstring groupName() @property nothrowGet `groupName` property. Returns: Group name for tab drag and drop.void groupName(string propval) @property nothrowSet `groupName` property. Params: propval = Group name for tab drag and drop.int appendPage(gtk.widget.Widget child, gtk.widget.Widget tabLabel = null) nothrowAppends a page to notebook.int appendPageMenu(gtk.widget.Widget child, gtk.widget.Widget tabLabel = null, gtk.widget.Widget menuLabel = null) nothrowAppends a page to notebook, specifying the widget to use as the label in the popup menu.gtk.widget.Widget getActionWidget(gtk.types.PackType packType) nothrowGets one of the action widgets. See [gtk.notebook.Notebook.setActionWidget].int getCurrentPage() nothrowReturns the page number of the current page. Returns: the index (starting from 0) of the current page in the notebook. If the notebook has no pages, then -1 will be returned.string getGroupName() nothrowGets the current group name for notebook. Returns: the group name, or null if none is setgtk.widget.Widget getMenuLabel(gtk.widget.Widget child) nothrowRetrieves the menu label widget of the page containing child.string getMenuLabelText(gtk.widget.Widget child) nothrowRetrieves the text of the menu label for the page containing child.int getNPages() nothrowGets the number of pages in a notebook. Returns: the number of pages in the notebookgtk.widget.Widget getNthPage(int pageNum) nothrowReturns the child widget contained in page number page_num.bool getScrollable() nothrowReturns whether the tab label area has arrows for scrolling. See [gtk.notebook.Notebook.setScrollable]. Returns: true if arrows for scrolling are presentbool getShowBorder() nothrowReturns whether a bevel will be drawn around the notebook pages. See [gtk.notebook.Notebook.setShowBorder]. Returns: true if the bevel is drawnbool getShowTabs() nothrowReturns whether the tabs of the notebook are shown. See [gtk.notebook.Notebook.setShowTabs]. Returns: true if the tabs are shownbool getTabDetachable(gtk.widget.Widget child) nothrowReturns whether the tab contents can be detached from notebook.ushort getTabHborder() nothrowReturns the horizontal width of a tab border. Returns: horizontal width of a tab bordergtk.widget.Widget getTabLabel(gtk.widget.Widget child) nothrowReturns the tab label widget for the page child. null is returned if child is not in notebook or if no tab label has specifically been set for child.string getTabLabelText(gtk.widget.Widget child) nothrowRetrieves the text of the tab label for the page containing child.gtk.types.PositionType getTabPos() nothrowGets the edge at which the tabs for switching pages in the notebook are drawn. Returns: the edge at which the tabs are drawnbool getTabReorderable(gtk.widget.Widget child) nothrowGets whether the tab can be reordered via drag and drop or not.ushort getTabVborder() nothrowReturns the vertical width of a tab border. Returns: vertical width of a tab borderint insertPage(gtk.widget.Widget child, gtk.widget.Widget tabLabel, int position) nothrowInsert a page into notebook at the given position.int insertPageMenu(gtk.widget.Widget child, gtk.widget.Widget tabLabel, gtk.widget.Widget menuLabel, int position) nothrowInsert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.void nextPage() nothrowSwitches to the next page. Nothing happens if the current page is the last page.int pageNum(gtk.widget.Widget child) nothrowFinds the index of the page which contains the given child widget.void popupEnable() nothrowEnables the popup menu: if the user clicks with the right mouse button on the tab labels, a menu with all the pages will be popped up.int prependPage(gtk.widget.Widget child, gtk.widget.Widget tabLabel = null) nothrowPrepends a page to notebook.int prependPageMenu(gtk.widget.Widget child, gtk.widget.Widget tabLabel = null, gtk.widget.Widget menuLabel = null) nothrowPrepends a page to notebook, specifying the widget to use as the label in the popup menu.void prevPage() nothrowSwitches to the previous page. Nothing happens if the current page is the first page.void removePage(int pageNum) nothrowRemoves a page from the notebook given its index in the notebook.void reorderChild(gtk.widget.Widget child, int position) nothrowReorders the page containing child, so that it appears in position position. If position is greater than or equal to the number of children in the list or negative, child will be moved to the end o...void setActionWidget(gtk.widget.Widget widget, gtk.types.PackType packType) nothrowSets widget as one of the action widgets. Depending on the pack type the widget will be placed before or after the tabs. You can use a #GtkBox if you need to pack more than one widget on the same s...void setMenuLabel(gtk.widget.Widget child, gtk.widget.Widget menuLabel = null) nothrowChanges the menu label for the page containing child.void setMenuLabelText(gtk.widget.Widget child, string menuText) nothrowCreates a new label and sets it as the menu label of child.void setScrollable(bool scrollable) nothrowSets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.void setShowBorder(bool showBorder) nothrowSets whether a bevel will be drawn around the notebook pages. This only has a visual effect when the tabs are not shown. See [gtk.notebook.Notebook.setShowTabs].void setTabDetachable(gtk.widget.Widget child, bool detachable) nothrowSets whether the tab can be detached from notebook to another notebook or widget.void setTabLabel(gtk.widget.Widget child, gtk.widget.Widget tabLabel = null) nothrowChanges the tab label for child. If null is specified for tab_label, then the page will have the label “page N”.void setTabLabelText(gtk.widget.Widget child, string tabText) nothrowCreates a new label and sets it as the tab label for the page containing child.void setTabPos(gtk.types.PositionType pos) nothrowSets the edge at which the tabs for switching pages in the notebook are drawn.void setTabReorderable(gtk.widget.Widget child, bool reorderable) nothrowSets whether the notebook tab can be reordered via drag and drop or not.gulong connectChangeCurrentPage(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.notebook.Notebook)))
&& Parameters!T.length < 3) nothrowConnect to `ChangeCurrentPage` signal.gulong connectCreateWindow(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T : gtk.notebook.Notebook)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == int)))
&& (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gtk.notebook.Notebook)))
&& Parameters!T.length < 5) nothrowConnect to `CreateWindow` signal.gulong connectFocusTab(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.NotebookTab)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.notebook.Notebook)))
&& Parameters!T.length < 3) nothrowConnect to `FocusTab` signal.gulong connectMoveFocusOut(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.DirectionType)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.notebook.Notebook)))
&& Parameters!T.length < 3) nothrowConnect to `MoveFocusOut` signal.gulong connectPageAdded(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == uint)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.notebook.Notebook)))
&& Parameters!T.length < 4) nothrowConnect to `PageAdded` signal.gulong connectPageRemoved(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == uint)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.notebook.Notebook)))
&& Parameters!T.length < 4) nothrowConnect to `PageRemoved` signal.gulong connectPageReordered(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == uint)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.notebook.Notebook)))
&& Parameters!T.length < 4) nothrowConnect to `PageReordered` signal.gulong connectReorderTab(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.DirectionType)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == bool)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.notebook.Notebook)))
&& Parameters!T.length < 4) nothrowConnect to `ReorderTab` signal.gulong connectSelectPage(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == bool)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.notebook.Notebook)))
&& Parameters!T.length < 3) nothrowConnect to `SelectPage` signal.gulong connectSwitchPage(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == uint)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.notebook.Notebook)))
&& Parameters!T.length < 4) nothrowConnect to `SwitchPage` signal.Fluent builder implementation template for gtk.notebook.Notebook
T enablePopup(bool propval) nothrowT groupName(string propval) nothrowSet `groupName` property. Params: propval = Group name for tab drag and drop. Returns: Builder instance for fluent chainingT page(int propval) nothrowT scrollable(bool propval) nothrowT showBorder(bool propval) nothrowT showTabs(bool propval) nothrowT tabPos(gtk.types.PositionType propval) nothrowFluent builder for gtk.notebook.Notebook