GtkNotebook

Name

GtkNotebook -- A tabbed notebook container.

Synopsis


#include <gtk/gtk.h>


struct      GtkNotebook;
struct      GtkNotebookPage;
GtkWidget*  gtk_notebook_new                (void);
void        gtk_notebook_append_page        (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label);
void        gtk_notebook_append_page_menu   (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label,
                                             GtkWidget *menu_label);
void        gtk_notebook_prepend_page       (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label);
void        gtk_notebook_prepend_page_menu  (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label,
                                             GtkWidget *menu_label);
void        gtk_notebook_insert_page        (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label,
                                             gint position);
void        gtk_notebook_insert_page_menu   (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label,
                                             GtkWidget *menu_label,
                                             gint position);
void        gtk_notebook_remove_page        (GtkNotebook *notebook,
                                             gint page_num);
#define     gtk_notebook_current_page
gint        gtk_notebook_page_num           (GtkNotebook *notebook,
                                             GtkWidget *child);
#define     gtk_notebook_set_page
void        gtk_notebook_next_page          (GtkNotebook *notebook);
void        gtk_notebook_prev_page          (GtkNotebook *notebook);
void        gtk_notebook_reorder_child      (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             gint position);
void        gtk_notebook_set_tab_pos        (GtkNotebook *notebook,
                                             GtkPositionType pos);
void        gtk_notebook_set_show_tabs      (GtkNotebook *notebook,
                                             gboolean show_tabs);
void        gtk_notebook_set_show_border    (GtkNotebook *notebook,
                                             gboolean show_border);
void        gtk_notebook_set_scrollable     (GtkNotebook *notebook,
                                             gboolean scrollable);
void        gtk_notebook_set_tab_border     (GtkNotebook *notebook,
                                             guint border_width);
void        gtk_notebook_popup_enable       (GtkNotebook *notebook);
void        gtk_notebook_popup_disable      (GtkNotebook *notebook);
gint        gtk_notebook_get_current_page   (GtkNotebook *notebook);
GtkWidget*  gtk_notebook_get_menu_label     (GtkNotebook *notebook,
                                             GtkWidget *child);
GtkWidget*  gtk_notebook_get_nth_page       (GtkNotebook *notebook,
                                             gint page_num);
GtkWidget*  gtk_notebook_get_tab_label      (GtkNotebook *notebook,
                                             GtkWidget *child);
void        gtk_notebook_query_tab_label_packing
                                            (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             gboolean *expand,
                                             gboolean *fill,
                                             GtkPackType *pack_type);
void        gtk_notebook_set_homogeneous_tabs
                                            (GtkNotebook *notebook,
                                             gboolean homogeneous);
void        gtk_notebook_set_menu_label     (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *menu_label);
void        gtk_notebook_set_menu_label_text
                                            (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             const gchar *menu_text);
void        gtk_notebook_set_tab_hborder    (GtkNotebook *notebook,
                                             guint tab_hborder);
void        gtk_notebook_set_tab_label      (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             GtkWidget *tab_label);
void        gtk_notebook_set_tab_label_packing
                                            (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             GtkPackType pack_type);
void        gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             const gchar *tab_text);
void        gtk_notebook_set_tab_vborder    (GtkNotebook *notebook,
                                             guint tab_vborder);
G_CONST_RETURN gchar* gtk_notebook_get_menu_label_text
                                            (GtkNotebook *notebook,
                                             GtkWidget *child);
gboolean    gtk_notebook_get_scrollable     (GtkNotebook *notebook);
gboolean    gtk_notebook_get_show_border    (GtkNotebook *notebook);
gboolean    gtk_notebook_get_show_tabs      (GtkNotebook *notebook);
G_CONST_RETURN gchar* gtk_notebook_get_tab_label_text
                                            (GtkNotebook *notebook,
                                             GtkWidget *child);
GtkPositionType gtk_notebook_get_tab_pos    (GtkNotebook *notebook);
void        gtk_notebook_set_current_page   (GtkNotebook *notebook,
                                             gint page_num);


Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkNotebook

Properties


  "tab-pos"              GtkPositionType      : Read / Write
  "show-tabs"            gboolean             : Read / Write
  "show-border"          gboolean             : Read / Write
  "scrollable"           gboolean             : Read / Write
  "tab-border"           guint                : Write
  "tab-hborder"          guint                : Read / Write
  "tab-vborder"          guint                : Read / Write
  "page"                 gint                 : Read / Write
  "enable-popup"         gboolean             : Read / Write
  "homogeneous"          gboolean             : Read / Write

Signal Prototypes


"change-current-page"
            void        user_function      (GtkNotebook *notebook,
                                            gint arg1,
                                            gpointer user_data);
"focus-tab" gboolean    user_function      (GtkNotebook *notebook,
                                            GtkNotebookTab arg1,
                                            gpointer user_data);
"move-focus-out"
            void        user_function      (GtkNotebook *notebook,
                                            GtkDirectionType arg1,
                                            gpointer user_data);
"select-page"
            gboolean    user_function      (GtkNotebook *notebook,
                                            gboolean arg1,
                                            gpointer user_data);
"switch-page"
            void        user_function      (GtkNotebook *notebook,
                                            GtkNotebookPage *page,
                                            gint page_num,
                                            gpointer user_data);

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 noteobook 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_enable_popup(), gtk_noteobook_disable_popup())

Details

struct GtkNotebook

struct GtkNotebook;


struct GtkNotebookPage

struct GtkNotebookPage;

The GtkNotebookPage is an opaque implementation detail of GtkNotebook.


gtk_notebook_new ()

GtkWidget*  gtk_notebook_new                (void);

Creates a new GtkNotebook widget with no pages.


gtk_notebook_append_page ()

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

Appends a page to notebook.


gtk_notebook_append_page_menu ()

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


gtk_notebook_prepend_page ()

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

Prepends a page to notebook.


gtk_notebook_prepend_page_menu ()

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


gtk_notebook_insert_page ()

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

Insert a page into notebook at the given position


gtk_notebook_insert_page_menu ()

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


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.


gtk_notebook_current_page

#define	gtk_notebook_current_page               gtk_notebook_get_current_page

Warning

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

Deprecated compatibility macro. Use gtk_notebook_get_current_page() instead.


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.


gtk_notebook_set_page

#define gtk_notebook_set_page                   gtk_notebook_set_current_page

Warning

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

Deprecated compatibility macro. Use gtk_notebook_set_current_page() instead.


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.


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.


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.


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.


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.


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 is only has an effect when the tabs are not shown. See gtk_notebook_set_show_tabs().


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.


gtk_notebook_set_tab_border ()

void        gtk_notebook_set_tab_border     (GtkNotebook *notebook,
                                             guint border_width);

Warning

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

Sets the width the border around the tab labels in a notebook. This is equivalent to calling gtk_notebook_set_tab_hborder (notebook, border_width) followed by gtk_notebook_set_tab_vborder (notebook, border_width).


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 bookmarks, a menu with all the pages will be popped up.


gtk_notebook_popup_disable ()

void        gtk_notebook_popup_disable      (GtkNotebook *notebook);

Disables the popup menu.


gtk_notebook_get_current_page ()

gint        gtk_notebook_get_current_page   (GtkNotebook *notebook);

Returns the page number of the current page.


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.


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.


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.


gtk_notebook_query_tab_label_packing ()

void        gtk_notebook_query_tab_label_packing
                                            (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             gboolean *expand,
                                             gboolean *fill,
                                             GtkPackType *pack_type);

Query the packing attributes for the tab label of the page containing child.


gtk_notebook_set_homogeneous_tabs ()

void        gtk_notebook_set_homogeneous_tabs
                                            (GtkNotebook *notebook,
                                             gboolean homogeneous);

Warning

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

Sets whether the tabs must have all the same size or not.


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.


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.


gtk_notebook_set_tab_hborder ()

void        gtk_notebook_set_tab_hborder    (GtkNotebook *notebook,
                                             guint tab_hborder);

Warning

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

Sets the width of the horizontal border of tab labels.


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


gtk_notebook_set_tab_label_packing ()

void        gtk_notebook_set_tab_label_packing
                                            (GtkNotebook *notebook,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             GtkPackType pack_type);

Sets the packing parameters for the tab label of the page containing child. See gtk_box_pack_start() for the exact meaning of the parameters.


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.


gtk_notebook_set_tab_vborder ()

void        gtk_notebook_set_tab_vborder    (GtkNotebook *notebook,
                                             guint tab_vborder);

Warning

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

Sets the width of the vertical border of tab labels.


gtk_notebook_get_menu_label_text ()

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

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


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


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


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


gtk_notebook_get_tab_label_text ()

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

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


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.


gtk_notebook_set_current_page ()

void        gtk_notebook_set_current_page   (GtkNotebook *notebook,
                                             gint page_num);

Switches to the page number page_num.

Properties

"tab-pos" (GtkPositionType : Read / Write)

The edge at which the tabs for switching pages are drawn.

"show-tabs" (gboolean : Read / Write)

Whether to show tabs for the notebook pages.

"show-border" (gboolean : Read / Write)

Whether to draw a bevel around the noteobook.

"scrollable" (gboolean : Read / Write)

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

"tab-border" (guint : Write)

Whether the tab labels have a border on all sides.

"tab-hborder" (guint : Read / Write)

Whether the tab labels have a horizontal border.

"tab-vborder" (guint : Read / Write)

Whether the tab labels have a vertical border.

"page" (gint : Read / Write)

The current page

"enable-popup" (gboolean : Read / Write)

Whether the popup menu for switching pages is enabled.

"homogeneous" (gboolean : Read / Write)

whether the tabs must have all the same size.

Signals

The "change-current-page" signal

void        user_function                  (GtkNotebook *notebook,
                                            gint arg1,
                                            gpointer user_data);


The "focus-tab" signal

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


The "move-focus-out" signal

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


The "select-page" signal

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


The "switch-page" signal

void        user_function                  (GtkNotebook *notebook,
                                            GtkNotebookPage *page,
                                            gint page_num,
                                            gpointer user_data);

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

See Also

GtkContainer

For functions that apply to every GtkContainer (like GtkList).