W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Notebook

Types

T

Inherits from:

The T widget is a Gtk.Gtk.Container.T whose children are pages that can be switched between using tab labels along one edge.

There are many configuration options for T. Among other things, you can choose on which edge the tabs appear (see SetTabPos), whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added (see gtk_notebook_set_scrollable), and whether there will be a popup menu allowing the users to switch pages. (see PopupEnable, PopupDisable)

GtkNotebook as GtkBuildable

The GtkNoteboopk 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.

Example 46. A UI definition fragment with GtkNotebook

1
2
3
4
5
6
7
8
9
10
11
12
<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>




Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.Notebook.T

Creates a new T widget with no pages.

Returns the newly created T


SetWindowCreationHook(func @ Std.Function.T, data @ Std.Address.T, destroy @ Std.Function.T) : Std.Object.T

Warning

SetWindowCreationHook has been deprecated since version 2.24 and should not be used in newly-written code. Use the "create-window" signal instead



Methods

:AppendPage(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T) : Std.Integer.SmallT

Appends a page to notebook.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
Returns the index (starting from 0) of the appended page in the notebook, or -1 if function fails


:AppendPageMenu(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T, menu_label @ Gtk.Gtk.Widget.T) : Std.Integer.SmallT

Appends a page to notebook, specifying the widget to use as the label in the popup menu.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
menu_label the widget to use as a label for the page-switch menu, if that is enabled. If NULL, and tab_label is a Gtk.Gtk.Label.T or NULL, then the menu label will be a newly created label with the same text as tab_label; If tab_label is not a Gtk.Gtk.Label.T, menu_label must be specified if the page-switch menu is to be used. [allow-none]
Returns the index (starting from 0) of the appended page in the notebook, or -1 if function fails


:GetActionWidget(self @ T, pack_type @ Gtk.Gtk.PackType.T) : Gtk.Gtk.Widget.T

Gets one of the action widgets. See SetActionWidget.

notebook a T
pack_type pack type of the action widget to receive
Returns The action widget with the given pack_type or NULL when this action widget has not been set. [transfer none]


:GetCurrentPage(self @ T) : Std.Integer.SmallT

Returns the page number of the current page.

notebook a T
Returns the index (starting from 0) of the current page in the notebook. If the notebook has no pages, then -1 will be returned.


:GetGroup(self @ T) : Std.Address.T

Warning

GetGroup has been deprecated since version 2.24 and should not be used in newly-written code. Use GetGroupName instead



:GetGroupId(self @ T) : Std.Integer.SmallT

Warning

GetGroupId has been deprecated since version 2.12 and should not be used in newly-written code. use GetGroupName instead.



:GetMenuLabel(self @ T, child @ Gtk.Gtk.Widget.T) : Gtk.Gtk.Widget.T

Retrieves the menu label widget of the page containing child.

notebook a T
child a widget contained in a page of notebook
Returns the menu label, or NULL if the notebook page does not have a menu label other than the default (the tab label). [transfer none]


:GetMenuLabelText(self @ T, child @ Gtk.Gtk.Widget.T) : Std.String.T

Retrieves the text of the menu label for the page containing child.

notebook a T
child the child widget of a page of the notebook.
Returns the text of the tab label, or NULL if the widget does not have a menu label other than the default menu label, or the menu label widget is not a Gtk.Gtk.Label.T. The string is owned by the widget and must not be freed.


:GetNPages(self @ T) : Std.Integer.SmallT

Gets the number of pages in a notebook.

notebook a T
Returns the number of pages in the notebook.


:GetNthPage(self @ T, page_num @ Std.Integer.SmallT) : Gtk.Gtk.Widget.T

Returns the child widget contained in page number page_num.

notebook a T
page_num the index of a page in the notebook, or -1 to get the last page.
Returns the child widget, or NULL if page_num is out of bounds. [transfer none]


:GetScrollable(self @ T) : Std.Symbol.T

Returns whether the tab label area has arrows for scrolling. See SetScrollable.

notebook a T
Returns TRUE if arrows for scrolling are present


:GetShowBorder(self @ T) : Std.Symbol.T

Returns whether a bevel will be drawn around the notebook pages. See SetShowBorder.

notebook a T
Returns TRUE if the bevel is drawn


:GetShowTabs(self @ T) : Std.Symbol.T

Returns whether the tabs of the notebook are shown. See SetShowTabs.

notebook a T
Returns TRUE if the tabs are shown


:GetTabDetachable(self @ T, child @ Gtk.Gtk.Widget.T) : Std.Symbol.T

Returns whether the tab contents can be detached from notebook.

notebook a T
child a child Gtk.Gtk.Widget.T
Returns TRUE if the tab is detachable.


:GetTabHborder(self @ T) : Std.Integer.SmallT

Returns the horizontal width of a tab border.

notebook a T
Returns horizontal width of a tab border


:GetTabLabel(self @ T, child @ Gtk.Gtk.Widget.T) : Gtk.Gtk.Widget.T

Returns 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.

notebook a T
child the page
Returns the tab label. [transfer none]


:GetTabLabelText(self @ T, child @ Gtk.Gtk.Widget.T) : Std.String.T

Retrieves the text of the tab label for the page containing child.

notebook a T
child a widget contained in a page of notebook
Returns the text of the tab label, or NULL if the tab label widget is not a Gtk.Gtk.Label.T. The string is owned by the widget and must not be freed.


:GetTabPos(self @ T) : Gtk.Gtk.PositionType.T

Gets the edge at which the tabs for switching pages in the notebook are drawn.

notebook a T
Returns the edge at which the tabs are drawn


:GetTabReorderable(self @ T, child @ Gtk.Gtk.Widget.T) : Std.Symbol.T

Gets whether the tab can be reordered via drag and drop or not.

notebook a T
child a child Gtk.Gtk.Widget.T
Returns TRUE if the tab is reorderable.


:GetTabVborder(self @ T) : Std.Integer.SmallT

Returns the vertical width of a tab border.

notebook a T
Returns vertical width of a tab border


:Gpointer(self @ T) : Std.Object.T

:GtkNotebookPage(self @ T) : Std.Object.T

:InsertPage(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T, position @ Std.Integer.SmallT) : Std.Integer.SmallT

Insert a page into notebook at the given position.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
position the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.
Returns the index (starting from 0) of the inserted page in the notebook, or -1 if function fails


:InsertPageMenu(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T, menu_label @ Gtk.Gtk.Widget.T, position @ Std.Integer.SmallT) : Std.Integer.SmallT

Insert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
menu_label the widget to use as a label for the page-switch menu, if that is enabled. If NULL, and tab_label is a Gtk.Gtk.Label.T or NULL, then the menu label will be a newly created label with the same text as tab_label; If tab_label is not a Gtk.Gtk.Label.T, menu_label must be specified if the page-switch menu is to be used. [allow-none]
position the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.
Returns the index (starting from 0) of the inserted page in the notebook


:NextPage(self @ T) : Std.Object.T

Switches to the next page. Nothing happens if the current page is the last page.

notebook a T


:PopupDisable(self @ T) : Std.Object.T

Disables the popup menu.

notebook a T


:PopupEnable(self @ T) : Std.Object.T

Enables 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.

notebook a T


:PrependPage(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T) : Std.Integer.SmallT

Prepends a page to notebook.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
Returns the index (starting from 0) of the prepended page in the notebook, or -1 if function fails


:PrependPageMenu(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T, menu_label @ Gtk.Gtk.Widget.T) : Std.Integer.SmallT

Prepends a page to notebook, specifying the widget to use as the label in the popup menu.

notebook a T
child the Gtk.Gtk.Widget.T to use as the contents of the page.
tab_label the Gtk.Gtk.Widget.T to be used as the label for the page, or NULL to use the default label, 'page N'. [allow-none]
menu_label the widget to use as a label for the page-switch menu, if that is enabled. If NULL, and tab_label is a Gtk.Gtk.Label.T or NULL, then the menu label will be a newly created label with the same text as tab_label; If tab_label is not a Gtk.Gtk.Label.T, menu_label must be specified if the page-switch menu is to be used. [allow-none]
Returns the index (starting from 0) of the prepended page in the notebook, or -1 if function fails


:PrevPage(self @ T) : Std.Object.T

Switches to the previous page. Nothing happens if the current page is the first page.

notebook a T


:QueryTabLabelPacking(self @ T, child @ Gtk.Gtk.Widget.T, expand @ Std.Object.T, fill @ Std.Object.T, pack_type @ Std.Object.T) : Std.Object.T

Warning

QueryTabLabelPacking has been deprecated since version 2.20 and should not be used in newly-written code. Modify the "tab-expand" and "tab-fill" child properties instead.



:RemovePage(self @ T, page_num @ Std.Integer.SmallT) : Std.Object.T

Removes a page from the notebook given its index in the notebook.

notebook a T.
page_num the index of a notebook page, starting from 0. If -1, the last page will be removed.


:ReorderChild(self @ T, child @ Gtk.Gtk.Widget.T, position @ Std.Integer.SmallT) : Std.Object.T

Reorders 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 of the list.

notebook a T
child the child to move
position the new position, or -1 to move to the end


:SetActionWidget(self @ T, widget @ Gtk.Gtk.Widget.T, pack_type @ Gtk.Gtk.PackType.T) : Std.Object.T

Sets 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 Gtk.Gtk.Box.T if you need to pack more than one widget on the same side.

Note that action widgets are "internal" children of the notebook and thus not included in the list returned from Gtk.Gtk.Container.Foreach.

notebook a T
widget a Gtk.Gtk.Widget.T
pack_type pack type of the action widget


:SetCurrentPage(self @ T, page_num @ Std.Integer.SmallT) : Std.Object.T

Switches to the page number page_num.

Note that due to historical reasons, GtkNotebook refuses to switch to a page unless the child widget is visible. Therefore, it is recommended to show child widgets before adding them to a notebook.

notebook a T
page_num index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in the notebook, nothing will be done.


:SetGroup(self @ T, group @ Std.Address.T) : Std.Object.T

Warning

SetGroup has been deprecated since version 2.24 and should not be used in newly-written code. Use SetGroupName instead



:SetGroupId(self @ T, group_id @ Std.Integer.SmallT) : Std.Object.T

Warning

SetGroupId has been deprecated since version 2.12 and should not be used in newly-written code. use SetGroupName instead.



:SetHomogeneousTabs(self @ T, homogeneous @ Std.Symbol.T) : Std.Object.T

Warning

SetHomogeneousTabs is deprecated and should not be used in newly-written code.



:SetMenuLabel(self @ T, child @ Gtk.Gtk.Widget.T, menu_label @ Gtk.Gtk.Widget.T) : Std.Object.T

Changes the menu label for the page containing child.

notebook a T
child the child widget
menu_label the menu label, or NULL for default. [allow-none]


:SetMenuLabelText(self @ T, child @ Gtk.Gtk.Widget.T, menu_text @ Std.String.T) : Std.Object.T

Creates a new label and sets it as the menu label of child.

notebook a T
child the child widget
menu_text the label text


:SetScrollable(self @ T, scrollable @ Std.Symbol.T) : Std.Object.T

Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.

notebook a T
scrollable TRUE if scroll arrows should be added


:SetShowBorder(self @ T, show_border @ Std.Symbol.T) : Std.Object.T

Sets whether a bevel will be drawn around the notebook pages. This only has a visual effect when the tabs are not shown. See SetShowTabs.

notebook a T
show_border TRUE if a bevel should be drawn around the notebook.


:SetShowTabs(self @ T, show_tabs @ Std.Symbol.T) : Std.Object.T

Sets whether to show the tabs for the notebook or not.

notebook a T
show_tabs TRUE if the tabs should be shown.


:SetTabBorder(self @ T, border_width @ Std.Integer.SmallT) : Std.Object.T

Warning

SetTabBorder is deprecated and should not be used in newly-written code.



:SetTabDetachable(self @ T, child @ Gtk.Gtk.Widget.T, detachable @ Std.Symbol.T) : Std.Object.T

Sets whether the tab can be detached from notebook to another notebook or widget.

Note that 2 notebooks must share a common group identificator (see SetGroupId) to allow automatic tabs interchange between them.

If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination and accept the target "GTK_NOTEBOOK_TAB". The notebook will fill the selection with a GtkWidget** pointing to the child widget that corresponds to the dropped tab.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
static void
on_drop_zone_drag_data_received (GtkWidget        *widget,
                                 GdkDragContext   *context,
                                 gint              x,
                                 gint              y,
                                 GtkSelectionData *selection_data,
                                 guint             info,
                                 guint             time,
                                 gpointer          user_data)
{
  GtkWidget *notebook;
  GtkWidget **child;
  
  notebook = gtk_drag_get_source_widget (context);
  child = (void*) selection_data->data;
  
  process_widget (*child);
  gtk_container_remove (GTK_CONTAINER (notebook), *child);
}


:SetTabHborder(self @ T, tab_hborder @ Std.Integer.SmallT) : Std.Object.T

Warning

SetTabHborder is deprecated and should not be used in newly-written code.



:SetTabLabel(self @ T, child @ Gtk.Gtk.Widget.T, tab_label @ Gtk.Gtk.Widget.T) : Std.Object.T

Changes the tab label for child. If NULL is specified for tab_label, then the page will have the label 'page N'.

notebook a T
child the page
tab_label the tab label widget to use, or NULL for default tab label. [allow-none]


:SetTabLabelPacking(self @ T, child @ Gtk.Gtk.Widget.T, expand @ Std.Symbol.T, fill @ Std.Symbol.T, pack_type @ Gtk.Gtk.PackType.T) : Std.Object.T

Warning

SetTabLabelPacking has been deprecated since version 2.20 and should not be used in newly-written code. Modify the "tab-expand" and "tab-fill" child properties instead. Modifying the packing of the tab label is a deprecated feature and shouldn't be done anymore.



:SetTabLabelText(self @ T, child @ Gtk.Gtk.Widget.T, tab_text @ Std.String.T) : Std.Object.T

Creates a new label and sets it as the tab label for the page containing child.

notebook a T
child the page
tab_text the label text


:SetTabPos(self @ T, pos @ Gtk.Gtk.PositionType.T) : Std.Object.T

Sets the edge at which the tabs for switching pages in the notebook are drawn.

notebook a T.
pos the edge to draw the tabs at.


:SetTabReorderable(self @ T, child @ Gtk.Gtk.Widget.T, reorderable @ Std.Symbol.T) : Std.Object.T

Sets whether the notebook tab can be reordered via drag and drop or not.

notebook a T
child a child Gtk.Gtk.Widget.T
reorderable whether the tab is reorderable or not.


:SetTabVborder(self @ T, tab_vborder @ Std.Integer.SmallT) : Std.Object.T

Warning

SetTabVborder is deprecated and should not be used in newly-written code.



:setGpointer(self @ T, value @ Std.Object.T) : Std.Object.T

:setGtkNotebookPage(self @ T, value @ Std.Object.T) : Std.Object.T