## GtkNotebook

GtkNotebook — A tabbed notebook container

## Functions

GtkWidget * | gtk_notebook_new ()
gint | gtk_notebook_append_page ()
gint | gtk_notebook_append_page_menu ()
gint | gtk_notebook_prepend_page ()
gint | gtk_notebook_prepend_page_menu ()
gint | gtk_notebook_insert_page ()
gint | gtk_notebook_insert_page_menu ()
void | gtk_notebook_remove_page ()
void | gtk_notebook_detach_tab ()
gint | gtk_notebook_page_num ()
void | gtk_notebook_next_page ()
void | gtk_notebook_prev_page ()
void | gtk_notebook_reorder_child ()
void | gtk_notebook_set_tab_pos ()
void | gtk_notebook_set_show_tabs ()
void | gtk_notebook_set_show_border ()
void | gtk_notebook_set_scrollable ()
void | gtk_notebook_popup_enable ()
void | gtk_notebook_popup_disable ()
gint | gtk_notebook_get_current_page ()
GtkWidget * | gtk_notebook_get_menu_label ()
GtkWidget * | gtk_notebook_get_nth_page ()
gint | gtk_notebook_get_n_pages ()
GtkWidget * | gtk_notebook_get_tab_label ()
void | gtk_notebook_set_menu_label ()
void | gtk_notebook_set_menu_label_text ()
void | gtk_notebook_set_tab_label ()
void | gtk_notebook_set_tab_label_text ()
void | gtk_notebook_set_tab_reorderable ()
void | gtk_notebook_set_tab_detachable ()
const gchar * | gtk_notebook_get_menu_label_text ()
gboolean | gtk_notebook_get_scrollable ()
gboolean | gtk_notebook_get_show_border ()
gboolean | gtk_notebook_get_show_tabs ()
const gchar * | gtk_notebook_get_tab_label_text ()
GtkPositionType | gtk_notebook_get_tab_pos ()
gboolean | gtk_notebook_get_tab_reorderable ()
gboolean | gtk_notebook_get_tab_detachable ()
guint16 | gtk_notebook_get_tab_hborder ()
guint16 | gtk_notebook_get_tab_vborder ()
void | gtk_notebook_set_current_page ()
void | gtk_notebook_set_group_name ()
const gchar * | gtk_notebook_get_group_name ()
void | gtk_notebook_set_action_widget ()
GtkWidget * | gtk_notebook_get_action_widget ()

## Properties

gboolean | enable-popup | Read / Write
gchar * | group-name | Read / Write
gint | page | Read / Write
gboolean | scrollable | Read / Write
gboolean | show-border | Read / Write
gboolean | show-tabs | Read / Write
GtkPositionType | tab-pos | Read / Write

## Child Properties

gboolean | detachable | Read / Write
gchar * | menu-label | Read / Write
gint | position | Read / Write
gboolean | reorderable | Read / Write
gboolean | tab-expand | Read / Write
gboolean | tab-fill | Read / Write
gchar * | tab-label | Read / Write

## Style Properties

gint | arrow-spacing | Read
gboolean | has-backward-stepper | Read
gboolean | has-forward-stepper | Read
gboolean | has-secondary-backward-stepper | Read
gboolean | has-secondary-forward-stepper | Read
gboolean | has-tab-gap | Read
gint | initial-gap | Read
gint | tab-curvature | Read
gint | tab-overlap | Read

## Signals

gboolean | change-current-page | Action
GtkNotebook* | create-window | Run Last
gboolean | focus-tab | Action
void | move-focus-out | Action
void | page-added | Run Last
void | page-removed | Run Last
void | page-reordered | Run Last
gboolean | reorder-tab | Action
gboolean | select-page | Action
void | switch-page | Run Last

## Types and Values

struct | GtkNotebook

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkNotebook

## Implemented Interfaces

GtkNotebook implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <gtk/gtk.h>

## Description

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_set_tab_pos()`), 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 `gtk_notebook_popup_enable()`, `gtk_notebook_popup_disable()`)

### 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:

    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>

### CSS nodes

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    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_set_show_border()`).

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.

## Functions

### gtk_notebook_new ()

    GtkWidget *
    gtk_notebook_new (void);

Creates a new GtkNotebook widget with no pages.

#### Returns

the newly created GtkNotebook

### gtk_notebook_append_page ()

    gint
    gtk_notebook_append_page (GtkNotebook *notebook,
                              GtkWidget *child,
                              GtkWidget *tab_label);

Appends a page to `notebook` .

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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

### gtk_notebook_append_page_menu ()

    gint
    gtk_notebook_append_page_menu (GtkNotebook *notebook,
                                   GtkWidget *child,
                                   GtkWidget *tab_label,
                                   GtkWidget *menu_label);

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

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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 GtkLabel 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 GtkLabel, `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

### gtk_notebook_prepend_page ()

    gint
    gtk_notebook_prepend_page (GtkNotebook *notebook,
                               GtkWidget *child,
                               GtkWidget *tab_label);

Prepends a page to `notebook` .

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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

### gtk_notebook_prepend_page_menu ()

    gint
    gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
                                    GtkWidget *child,
                                    GtkWidget *tab_label,
                                    GtkWidget *menu_label);

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

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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 GtkLabel 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 GtkLabel, `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

### gtk_notebook_insert_page ()

    gint
    gtk_notebook_insert_page (GtkNotebook *notebook,
                              GtkWidget *child,
                              GtkWidget *tab_label,
                              gint position);

Insert a page into `notebook` at the given position.

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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

### gtk_notebook_insert_page_menu ()

    gint
    gtk_notebook_insert_page_menu (GtkNotebook *notebook,
                                   GtkWidget *child,
                                   GtkWidget *tab_label,
                                   GtkWidget *menu_label,
                                   gint position);

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

#### Parameters

notebook | a GtkNotebook |
child | the GtkWidget to use as the contents of the page |
tab_label | the GtkWidget 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 GtkLabel 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 GtkLabel, `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

### gtk_notebook_remove_page ()

    void
    gtk_notebook_remove_page (GtkNotebook *notebook,
                              gint page_num);

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

#### Parameters

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

### gtk_notebook_detach_tab ()

    void
    gtk_notebook_detach_tab (GtkNotebook *notebook,
                             GtkWidget *child);

Removes the child from the notebook.

This function is very similar to `gtk_container_remove()`, but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.

#### Parameters

notebook | a GtkNotebook |
child | a child |

Since: 3.16

### gtk_notebook_page_num ()

    gint
    gtk_notebook_page_num (GtkNotebook *notebook,
                           GtkWidget *child);

Finds the index of the page which contains the given child widget.

#### Parameters

notebook | a GtkNotebook |
child | a GtkWidget |

#### Returns

the index of the page containing `child` , or -1 if `child` is not in the notebook

### gtk_notebook_next_page ()

    void
    gtk_notebook_next_page (GtkNotebook *notebook);

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

#### Parameters

notebook | a GtkNotebook |

### gtk_notebook_prev_page ()

    void
    gtk_notebook_prev_page (GtkNotebook *notebook);

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

#### Parameters

notebook | a GtkNotebook |

### gtk_notebook_reorder_child ()

    void
    gtk_notebook_reorder_child (GtkNotebook *notebook,
                                GtkWidget *child,
                                gint position);

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.

#### Parameters

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

### gtk_notebook_set_tab_pos ()

    void
    gtk_notebook_set_tab_pos (GtkNotebook *notebook,
                              GtkPositionType pos);

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

#### Parameters

notebook | a GtkNotebook. |
pos | the edge to draw the tabs at |

### gtk_notebook_set_show_tabs ()

    void
    gtk_notebook_set_show_tabs (GtkNotebook *notebook,
                                gboolean show_tabs);

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

#### Parameters

notebook | a GtkNotebook |
show_tabs | `TRUE` if the tabs should be shown |

### gtk_notebook_set_show_border ()

    void
    gtk_notebook_set_show_border (GtkNotebook *notebook,
                                  gboolean show_border);

Sets 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_set_show_tabs()`.

#### Parameters

notebook | a GtkNotebook |
show_border | `TRUE` if a bevel should be drawn around the notebook |

### gtk_notebook_set_scrollable ()

    void
    gtk_notebook_set_scrollable (GtkNotebook *notebook,
                                 gboolean scrollable);

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

#### Parameters

notebook | a GtkNotebook |
scrollable | `TRUE` if scroll arrows should be added |

### gtk_notebook_popup_enable ()

    void
    gtk_notebook_popup_enable (GtkNotebook *notebook);

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.

#### Parameters

notebook | a GtkNotebook |

### gtk_notebook_popup_disable ()

    void
    gtk_notebook_popup_disable (GtkNotebook *notebook);

Disables the popup menu.

#### Parameters

notebook | a GtkNotebook |

### gtk_notebook_get_current_page ()

    gint
    gtk_notebook_get_current_page (GtkNotebook *notebook);

Returns the page number of the current page.

#### Parameters

notebook | a GtkNotebook |

#### Returns

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

### gtk_notebook_get_menu_label ()

    GtkWidget *
    gtk_notebook_get_menu_label (GtkNotebook *notebook,
                                 GtkWidget *child);

Retrieves the menu label widget of the page containing `child` .

#### Parameters

notebook | a GtkNotebook |
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).

[nullable][transfer none]

### gtk_notebook_get_nth_page ()

    GtkWidget *
    gtk_notebook_get_nth_page (GtkNotebook *notebook,
                               gint page_num);

Returns the child widget contained in page number `page_num` .

#### Parameters

notebook | a GtkNotebook |
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.

[nullable][transfer none]

### gtk_notebook_get_n_pages ()

    gint
    gtk_notebook_get_n_pages (GtkNotebook *notebook);

Gets the number of pages in a notebook.

#### Parameters

notebook | a GtkNotebook |

#### Returns

the number of pages in the notebook

Since: 2.2

### gtk_notebook_get_tab_label ()

    GtkWidget *
    gtk_notebook_get_tab_label (GtkNotebook *notebook,
                                GtkWidget *child);

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

#### Parameters

notebook | a GtkNotebook |
child | the page |

#### Returns

the tab label.

[transfer none][nullable]

### gtk_notebook_set_menu_label ()

    void
    gtk_notebook_set_menu_label (GtkNotebook *notebook,
                                 GtkWidget *child,
                                 GtkWidget *menu_label);

Changes the menu label for the page containing `child` .

#### Parameters

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

### gtk_notebook_set_menu_label_text ()

    void
    gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
                                      GtkWidget *child,
                                      const gchar *menu_text);

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

#### Parameters

notebook | a GtkNotebook |
child | the child widget |
menu_text | the label text |

### gtk_notebook_set_tab_label ()

    void
    gtk_notebook_set_tab_label (GtkNotebook *notebook,
                                GtkWidget *child,
                                GtkWidget *tab_label);

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

#### Parameters

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

### gtk_notebook_set_tab_label_text ()

    void
    gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
                                     GtkWidget *child,
                                     const gchar *tab_text);

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

#### Parameters

notebook | a GtkNotebook |
child | the page |
tab_text | the label text |

### gtk_notebook_set_tab_reorderable ()

    void
    gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
                                      GtkWidget *child,
                                      gboolean reorderable);

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

#### Parameters

notebook | a GtkNotebook |
child | a child GtkWidget |
reorderable | whether the tab is reorderable or not |

Since: 2.10

### gtk_notebook_set_tab_detachable ()

    void
    gtk_notebook_set_tab_detachable (GtkNotebook *notebook,
                                     GtkWidget *child,
                                     gboolean detachable);

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 `gtk_notebook_set_group_name()`) 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.

Note that you should use `gtk_notebook_detach_tab()` instead of `gtk_container_remove()` if you want to remove the tab from the source notebook as part of accepting a drop. Otherwise, the source notebook will think that the dragged tab was removed from underneath the ongoing drag operation, and will initiate a drag cancel animation.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    static void
    on_drag_data_received (GtkWidget        *widget,
                           GdkDragContext   *context,
                           gint              x,
                           gint              y,
                           GtkSelectionData *data,
                           guint             info,
                           guint             time,
                           gpointer          user_data)
    {
      GtkWidget *notebook;
      GtkWidget **child;

      notebook = gtk_drag_get_source_widget (context);
      child = (void*) gtk_selection_data_get_data (data);

      // process_widget (*child);

      gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
    }

If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.

#### Parameters

notebook | a GtkNotebook |
child | a child GtkWidget |
detachable | whether the tab is detachable or not |

Since: 2.10

### gtk_notebook_get_menu_label_text ()

    const gchar *
    gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
                                      GtkWidget *child);

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

#### Parameters

notebook | a GtkNotebook |
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 GtkLabel. The string is owned by the widget and must not be freed.

[nullable]

### gtk_notebook_get_scrollable ()

    gboolean
    gtk_notebook_get_scrollable (GtkNotebook *notebook);

Returns whether the tab label area has arrows for scrolling. See `gtk_notebook_set_scrollable()`.

#### Parameters

notebook | a GtkNotebook |

#### Returns

`TRUE` if arrows for scrolling are present

### gtk_notebook_get_show_border ()

    gboolean
    gtk_notebook_get_show_border (GtkNotebook *notebook);

Returns whether a bevel will be drawn around the notebook pages. See `gtk_notebook_set_show_border()`.

#### Parameters

notebook | a GtkNotebook |

#### Returns

`TRUE` if the bevel is drawn

### gtk_notebook_get_show_tabs ()

    gboolean
    gtk_notebook_get_show_tabs (GtkNotebook *notebook);

Returns whether the tabs of the notebook are shown. See `gtk_notebook_set_show_tabs()`.

#### Parameters

notebook | a GtkNotebook |

#### Returns

`TRUE` if the tabs are shown

### gtk_notebook_get_tab_label_text ()

    const gchar *
    gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
                                     GtkWidget *child);

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

#### Parameters

notebook | a GtkNotebook |
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 GtkLabel. The string is owned by the widget and must not be freed.

[nullable]

### gtk_notebook_get_tab_pos ()

    GtkPositionType
    gtk_notebook_get_tab_pos (GtkNotebook *notebook);

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

#### Parameters

notebook | a GtkNotebook |

#### Returns

the edge at which the tabs are drawn

### gtk_notebook_get_tab_reorderable ()

    gboolean
    gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
                                      GtkWidget *child);

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

#### Parameters

notebook | a GtkNotebook |
child | a child GtkWidget |

#### Returns

`TRUE` if the tab is reorderable.

Since: 2.10

### gtk_notebook_get_tab_detachable ()

    gboolean
    gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
                                     GtkWidget *child);

Returns whether the tab contents can be detached from `notebook` .

#### Parameters

notebook | a GtkNotebook |
child | a child GtkWidget |

#### Returns

`TRUE` if the tab is detachable.

Since: 2.10

### gtk_notebook_get_tab_hborder ()

    guint16
    gtk_notebook_get_tab_hborder (GtkNotebook *notebook);

`gtk_notebook_get_tab_hborder` has been deprecated since version 3.4 and should not be used in newly-written code.

this function returns zero

Returns the horizontal width of a tab border.

#### Parameters

notebook | a GtkNotebook |

#### Returns

horizontal width of a tab border

Since: 2.22

### gtk_notebook_get_tab_vborder ()

    guint16
    gtk_notebook_get_tab_vborder (GtkNotebook *notebook);

`gtk_notebook_get_tab_vborder` has been deprecated since version 3.4 and should not be used in newly-written code.

this function returns zero

Returns the vertical width of a tab border.

#### Parameters

notebook | a GtkNotebook |

#### Returns

vertical width of a tab border

Since: 2.22

### gtk_notebook_set_current_page ()

    void
    gtk_notebook_set_current_page (GtkNotebook *notebook,
                                   gint page_num);

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.

#### Parameters

notebook | a GtkNotebook |
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. |

### gtk_notebook_set_group_name ()

    void
    gtk_notebook_set_group_name (GtkNotebook *notebook,
                                 const gchar *group_name);

Sets a group name for `notebook` .

Notebooks with the same name will be able to exchange tabs via drag and drop. A notebook with a `NULL` group name will not be able to exchange tabs with any other notebook.

#### Parameters

notebook | a GtkNotebook |
group_name | the name of the notebook group, or `NULL` to unset it. | [allow-none]

Since: 2.24

### gtk_notebook_get_group_name ()

    const gchar *
    gtk_notebook_get_group_name (GtkNotebook *notebook);

Gets the current group name for `notebook` .

#### Parameters

notebook | a GtkNotebook |

#### Returns

the group name, or `NULL` if none is set.

[nullable][transfer none]

Since: 2.24

### gtk_notebook_set_action_widget ()

    void
    gtk_notebook_set_action_widget (GtkNotebook *notebook,
                                    GtkWidget *widget,
                                    GtkPackType pack_type);

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 GtkBox 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_container_foreach()`.

#### Parameters

notebook | a GtkNotebook |
widget | a GtkWidget |
pack_type | pack type of the action widget |

Since: 2.20

### gtk_notebook_get_action_widget ()

    GtkWidget *
    gtk_notebook_get_action_widget (GtkNotebook *notebook,
                                    GtkPackType pack_type);

Gets one of the action widgets. See `gtk_notebook_set_action_widget()`.

#### Parameters

notebook | a GtkNotebook |
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.

[nullable][transfer none]

Since: 2.20

## Types and Values

### struct GtkNotebook

    struct GtkNotebook;

## Property Details

### The `“enable-popup”` property

      “enable-popup”             gboolean

If TRUE, pressing the right mouse button on the notebook pops up a menu that you can use to go to a page.

Flags: Read / Write

Default value: FALSE

### The `“group-name”` property

      “group-name”               gchar *

Group name for tab drag and drop.

Flags: Read / Write

Default value: NULL

Since: 2.24

### The `“page”` property

      “page”                     gint

The index of the current page.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“scrollable”` property

      “scrollable”               gboolean

If TRUE, scroll arrows are added if there are too many tabs to fit.

Flags: Read / Write

Default value: FALSE

### The `“show-border”` property

      “show-border”              gboolean

Whether the border should be shown.

Flags: Read / Write

Default value: TRUE

### The `“show-tabs”` property

      “show-tabs”                gboolean

Whether tabs should be shown.

Flags: Read / Write

Default value: TRUE

### The `“tab-pos”` property

      “tab-pos”                  GtkPositionType

Which side of the notebook holds the tabs.

Flags: Read / Write

Default value: GTK_POS_TOP

## Child Property Details

### The `“detachable”` child property

      “detachable”               gboolean

Whether the tab is detachable.

Flags: Read / Write

Default value: FALSE

### The `“menu-label”` child property

      “menu-label”               gchar *

The string displayed in the child's menu entry.

Flags: Read / Write

Default value: NULL

### The `“position”` child property

      “position”                 gint

The index of the child in the parent.

Flags: Read / Write

Allowed values: >= -1

Default value: 0

### The `“reorderable”` child property

      “reorderable”              gboolean

Whether the tab is reorderable by user action.

Flags: Read / Write

Default value: FALSE

### The `“tab-expand”` child property

      “tab-expand”               gboolean

Whether to expand the child's tab.

Flags: Read / Write

Default value: FALSE

### The `“tab-fill”` child property

      “tab-fill”                 gboolean

Whether the child's tab should fill the allocated area.

Flags: Read / Write

Default value: TRUE

### The `“tab-label”` child property

      “tab-label”                gchar *

The string displayed on the child's tab label.

Flags: Read / Write

Default value: NULL

## Style Property Details

### The `“arrow-spacing”` style property

      “arrow-spacing”            gint

The "arrow-spacing" property defines the spacing between the scroll arrows and the tabs.

`GtkNotebook:arrow-spacing` has been deprecated since version 3.20 and should not be used in newly-written code.

This property is ignored. Use margins on arrows or the "tabs" node to achieve the same effect.

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 2.10

### The `“has-backward-stepper”` style property

      “has-backward-stepper”     gboolean

The “has-backward-stepper” property determines whether the standard backward arrow button is displayed.

Flags: Read

Default value: TRUE

Since: 2.4

### The `“has-forward-stepper”` style property

      “has-forward-stepper”      gboolean

The “has-forward-stepper” property determines whether the standard forward arrow button is displayed.

Flags: Read

Default value: TRUE

Since: 2.4

### The `“has-secondary-backward-stepper”` style property

      “has-secondary-backward-stepper” gboolean

The “has-secondary-backward-stepper” property determines whether a second backward arrow button is displayed on the opposite end of the tab area.

Flags: Read

Default value: FALSE

Since: 2.4

### The `“has-secondary-forward-stepper”` style property

      “has-secondary-forward-stepper” gboolean

The “has-secondary-forward-stepper” property determines whether a second forward arrow button is displayed on the opposite end of the tab area.

Flags: Read

Default value: FALSE

Since: 2.4

### The `“has-tab-gap”` style property

      “has-tab-gap”              gboolean

The "has-tab-gap" property defines whether the active tab is draw with a gap at the bottom. When `TRUE` the theme engine uses gtk_render_extension to draw the active tab. When `FALSE` gtk_render_background and gtk_render_frame are used.

`GtkNotebook:has-tab-gap` has been deprecated since version 3.20 and should not be used in newly-written code.

This function always behaves as if it was set to `FALSE`.

Flags: Read

Default value: TRUE

Since: 3.12

### The `“initial-gap”` style property

      “initial-gap”              gint

The "initial-gap" property defines the minimum size for the initial gap between the first tab.

`GtkNotebook:initial-gap` has been deprecated since version 3.20 and should not be used in newly-written code.

The intial gap is ignored. Use margins on the header node to achieve the same effect.

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 3.2

### The `“tab-curvature”` style property

      “tab-curvature”            gint

The “tab-curvature” property defines size of tab curvature.

`GtkNotebook:tab-curvature` has been deprecated since version 3.20 and should not be used in newly-written code.

This property is ignored. Use margins on tab nodes to achieve the same effect.

Flags: Read

Allowed values: >= 0

Default value: 1

Since: 2.10

### The `“tab-overlap”` style property

      “tab-overlap”              gint

The “tab-overlap” property defines size of tab overlap area.

`GtkNotebook:tab-overlap` has been deprecated since version 3.20 and should not be used in newly-written code.

This property is ignored. Use margins on tab nodes to achieve the same effect.

Flags: Read

Default value: 2

Since: 2.10

## Signal Details

### The `“change-current-page”` signal

    gboolean
    user_function (GtkNotebook *notebook,
                   gint         arg1,
                   gpointer     user_data)

Flags: Action

### The `“create-window”` signal

    GtkNotebook*
    user_function (GtkNotebook *notebook,
                   GtkWidget   *page,
                   gint         x,
                   gint         y,
                   gpointer     user_data)

The ::create-window signal is emitted when a detachable tab is dropped on the root window.

A handler for this signal can create a window containing a notebook where the tab will be attached. It is also responsible for moving/resizing the window and adding the necessary properties to the notebook (e.g. the “group-name” ).

#### Parameters

notebook | the GtkNotebook emitting the signal |
page | the tab of `notebook` that is being detached |
x | the X coordinate where the drop happens |
y | the Y coordinate where the drop happens |
user_data | user data set when the signal handler was connected. |

#### Returns

a GtkNotebook that `page` should be added to, or `NULL`.

[transfer none]

Flags: Run Last

Since: 2.12

### The `“focus-tab”` signal

    gboolean
    user_function (GtkNotebook   *notebook,
                   GtkNotebookTab arg1,
                   gpointer       user_data)

Flags: Action

### The `“move-focus-out”` signal

    void
    user_function (GtkNotebook     *notebook,
                   GtkDirectionType arg1,
                   gpointer         user_data)

Flags: Action

### The `“page-added”` signal

    void
    user_function (GtkNotebook *notebook,
                   GtkWidget   *child,
                   guint        page_num,
                   gpointer     user_data)

the ::page-added signal is emitted in the notebook right after a page is added to the notebook.

#### Parameters

notebook | the GtkNotebook |
child | the child GtkWidget affected |
page_num | the new page number for `child` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.10

### The `“page-removed”` signal

    void
    user_function (GtkNotebook *notebook,
                   GtkWidget   *child,
                   guint        page_num,
                   gpointer     user_data)

the ::page-removed signal is emitted in the notebook right after a page is removed from the notebook.

#### Parameters

notebook | the GtkNotebook |
child | the child GtkWidget affected |
page_num | the `child` page number |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.10

### The `“page-reordered”` signal

    void
    user_function (GtkNotebook *notebook,
                   GtkWidget   *child,
                   guint        page_num,
                   gpointer     user_data)

the ::page-reordered signal is emitted in the notebook right after a page has been reordered.

#### Parameters

notebook | the GtkNotebook |
child | the child GtkWidget affected |
page_num | the new page number for `child` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.10

### The `“reorder-tab”` signal

    gboolean
    user_function (GtkNotebook     *notebook,
                   GtkDirectionType arg1,
                   gboolean         arg2,
                   gpointer         user_data)

Flags: Action

### The `“select-page”` signal

    gboolean
    user_function (GtkNotebook *notebook,
                   gboolean     arg1,
                   gpointer     user_data)

Flags: Action

### The `“switch-page”` signal

    void
    user_function (GtkNotebook *notebook,
                   GtkWidget   *page,
                   guint        page_num,
                   gpointer     user_data)

Emitted when the user or a function changes the current page.

#### Parameters

notebook | the object which received the signal. |
page | the new current page |
page_num | the index of the page |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

## See Also

GtkContainer