GTK+ Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Child Properties | Style Properties | Signals |
#include <gtk/gtk.h> GtkNotebook; GtkNotebookPage; GtkWidget * gtk_notebook_new (void
); gint gtk_notebook_append_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
); gint gtk_notebook_append_page_menu (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
,GtkWidget *menu_label
); gint gtk_notebook_prepend_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
); gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
,GtkWidget *menu_label
); gint gtk_notebook_insert_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
,gint position
); gint 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
); gint gtk_notebook_get_n_pages (GtkNotebook *notebook
); 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
); void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook
,GtkWidget *child
,gboolean reorderable
); void gtk_notebook_set_tab_detachable (GtkNotebook *notebook
,GtkWidget *child
,gboolean detachable
); const 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
); const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook
,GtkWidget *child
); GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook
); gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook
,GtkWidget *child
); gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook
,GtkWidget *child
); void gtk_notebook_set_current_page (GtkNotebook *notebook
,gint page_num
); void gtk_notebook_set_group_id (GtkNotebook *notebook
,gint group_id
); gint gtk_notebook_get_group_id (GtkNotebook *notebook
); void gtk_notebook_set_group (GtkNotebook *notebook
,gpointer group
); gpointer gtk_notebook_get_group (GtkNotebook *notebook
); void gtk_notebook_set_action_widget (GtkNotebook *notebook
,GtkWidget *widget
,GtkPackType pack_type
); GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook
,GtkPackType pack_type
); GtkNotebook * (*GtkNotebookWindowCreationFunc) (GtkNotebook *source
,GtkWidget *page
,gint x
,gint y
,gpointer data
); void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func
,gpointer data
,GDestroyNotify destroy
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkNotebook
"enable-popup" gboolean : Read / Write "group" gpointer : Read / Write "group-id" gint : Read / Write "homogeneous" gboolean : Read / Write "page" gint : Read / Write "scrollable" gboolean : Read / Write "show-border" gboolean : Read / Write "show-tabs" gboolean : Read / Write "tab-border" guint : Write "tab-hborder" guint : Read / Write "tab-pos" GtkPositionType : Read / Write "tab-vborder" guint : Read / Write
"detachable" gboolean : Read / Write "menu-label" gchar* : Read / Write "position" gint : Read / Write "reorderable" gboolean : Read / Write "tab-expand" gboolean : Read / Write "tab-fill" gboolean : Read / Write "tab-label" gchar* : Read / Write "tab-pack" GtkPackType : Read / Write
"arrow-spacing" gint : Read "has-backward-stepper" gboolean : Read "has-forward-stepper" gboolean : Read "has-secondary-backward-stepper" gboolean : Read "has-secondary-forward-stepper" gboolean : Read "tab-curvature" gint : Read "tab-overlap" gint : Read
"change-current-page" : Run Last / Action "create-window" : Run Last "focus-tab" : Run Last / Action "move-focus-out" : Run Last / Action "page-added" : Run Last "page-removed" : Run Last "page-reordered" : Run Last "reorder-tab" : Run Last / Action "select-page" : Run Last / Action "switch-page" : Run Last
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()
)
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 43. 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> |
typedef struct _GtkNotebookPage GtkNotebookPage;
The GtkNotebookPage is an opaque implementation detail of GtkNotebook.
GtkWidget * gtk_notebook_new (void
);
Creates a new GtkNotebook widget with no pages.
Returns : |
the newly created GtkNotebook |
gint gtk_notebook_append_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
);
Appends a page to notebook
.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
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 |
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.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
the GtkWidget to be used as the label for the page,
or NULL to use the default label, 'page N'.. allow-none. |
|
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 |
gint gtk_notebook_prepend_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
);
Prepends a page to notebook
.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
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 |
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.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
the GtkWidget to be used as the label for the page,
or NULL to use the default label, 'page N'.. allow-none. |
|
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 |
gint gtk_notebook_insert_page (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *tab_label
,gint position
);
Insert a page into notebook
at the given position.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
the GtkWidget to be used as the label for the page,
or NULL to use the default label, 'page N'.. allow-none. |
|
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 |
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.
|
a GtkNotebook |
|
the GtkWidget to use as the contents of the page. |
|
the GtkWidget to be used as the label for the page,
or NULL to use the default label, 'page N'.. allow-none. |
|
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. |
|
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 |
void gtk_notebook_remove_page (GtkNotebook *notebook
,gint page_num
);
Removes a page from the notebook given its index in the notebook.
|
a GtkNotebook. |
|
the index of a notebook page, starting from 0. If -1, the last page will be removed. |
#define gtk_notebook_current_page gtk_notebook_get_current_page
gtk_notebook_current_page
is deprecated and should not be used in newly-written code. Use gtk_notebook_get_current_page()
instead.
Deprecated compatibility macro.
gint gtk_notebook_page_num (GtkNotebook *notebook
,GtkWidget *child
);
Finds the index of the page which contains the given child widget.
|
a GtkNotebook |
|
a GtkWidget |
Returns : |
the index of the page containing child , or
-1 if child is not in the notebook.
|
#define gtk_notebook_set_page gtk_notebook_set_current_page
gtk_notebook_set_page
is deprecated and should not be used in newly-written code. Use gtk_notebook_set_current_page()
instead.
Deprecated compatibility macro.
void gtk_notebook_next_page (GtkNotebook *notebook
);
Switches to the next page. Nothing happens if the current page is the last page.
|
a GtkNotebook |
void gtk_notebook_prev_page (GtkNotebook *notebook
);
Switches to the previous page. Nothing happens if the current page is the first page.
|
a GtkNotebook |
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.
|
a GtkNotebook |
|
the child to move |
|
the new position, or -1 to move to the end |
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.
|
a GtkNotebook. |
|
the edge to draw the tabs at. |
void gtk_notebook_set_show_tabs (GtkNotebook *notebook
,gboolean show_tabs
);
Sets whether to show the tabs for the notebook or not.
|
a GtkNotebook |
|
TRUE if the tabs should be shown.
|
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()
.
|
a GtkNotebook |
|
TRUE if a bevel should be drawn around the notebook.
|
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.
|
a GtkNotebook |
|
TRUE if scroll arrows should be added
|
void gtk_notebook_set_tab_border (GtkNotebook *notebook
,guint border_width
);
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
).
|
a GtkNotebook |
|
width of the border around the tab labels. |
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.
|
a GtkNotebook |
void gtk_notebook_popup_disable (GtkNotebook *notebook
);
Disables the popup menu.
|
a GtkNotebook |
gint gtk_notebook_get_current_page (GtkNotebook *notebook
);
Returns the page number of the current page.
|
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. |
GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook
,GtkWidget *child
);
Retrieves the menu label widget of the page containing child
.
|
a GtkNotebook |
|
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).
|
GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook
,gint page_num
);
Returns the child widget contained in page number page_num
.
|
a GtkNotebook |
|
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. |
gint gtk_notebook_get_n_pages (GtkNotebook *notebook
);
Gets the number of pages in a notebook.
|
a GtkNotebook |
Returns : |
the number of pages in the notebook. |
Since 2.2
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
.
|
a GtkNotebook |
|
the page |
Returns : |
the tab label. transfer none. |
void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook
,GtkWidget *child
,gboolean *expand
,gboolean *fill
,GtkPackType *pack_type
);
gtk_notebook_query_tab_label_packing
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.
Query the packing attributes for the tab label of the page
containing child
.
|
a GtkNotebook |
|
the page |
|
location to store the expand value (or NULL) |
|
location to store the fill value (or NULL) |
|
location to store the pack_type (or NULL) |
void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook
,gboolean homogeneous
);
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.
|
a GtkNotebook |
|
TRUE if all tabs should be the same size.
|
void gtk_notebook_set_menu_label (GtkNotebook *notebook
,GtkWidget *child
,GtkWidget *menu_label
);
Changes the menu label for the page containing child
.
|
a GtkNotebook |
|
the child widget |
|
the menu label, or NULL for default. allow-none. |
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
.
|
a GtkNotebook |
|
the child widget |
|
the label text |
void gtk_notebook_set_tab_hborder (GtkNotebook *notebook
,guint tab_hborder
);
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.
|
a GtkNotebook |
|
width of the horizontal border of tab labels. |
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'.
|
a GtkNotebook |
|
the page |
|
the tab label widget to use, or NULL for default tab
label.. allow-none. |
void gtk_notebook_set_tab_label_packing (GtkNotebook *notebook
,GtkWidget *child
,gboolean expand
,gboolean fill
,GtkPackType pack_type
);
gtk_notebook_set_tab_label_packing
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.
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.
|
a GtkNotebook |
|
the child widget |
|
whether to expand the tab label or not |
|
whether the tab label should fill the allocated area or not |
|
the position of the tab label |
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
.
|
a GtkNotebook |
|
the page |
|
the label text |
void gtk_notebook_set_tab_vborder (GtkNotebook *notebook
,guint tab_vborder
);
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.
|
a GtkNotebook |
|
width of the vertical border of tab labels. |
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.
|
a GtkNotebook |
|
a child GtkWidget |
|
whether the tab is reorderable or not. |
Since 2.10
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_id()
) 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); } |
If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.
|
a GtkNotebook |
|
a child GtkWidget |
|
whether the tab is detachable or not |
Since 2.10
const gchar * gtk_notebook_get_menu_label_text (GtkNotebook *notebook
,GtkWidget *child
);
Retrieves the text of the menu label for the page containing
child
.
|
a GtkNotebook |
|
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.
|
gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook
);
Returns whether the tab label area has arrows for scrolling. See
gtk_notebook_set_scrollable()
.
|
a GtkNotebook |
Returns : |
TRUE if arrows for scrolling are present
|
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()
.
|
a GtkNotebook |
Returns : |
TRUE if the bevel is drawn
|
gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook
);
Returns whether the tabs of the notebook are shown. See
gtk_notebook_set_show_tabs()
.
|
a GtkNotebook |
Returns : |
TRUE if the tabs are shown
|
const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook
,GtkWidget *child
);
Retrieves the text of the tab label for the page containing
child
.
|
a GtkNotebook |
|
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.
|
GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook
);
Gets the edge at which the tabs for switching pages in the notebook are drawn.
|
a GtkNotebook |
Returns : |
the edge at which the tabs are drawn |
gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook
,GtkWidget *child
);
Gets whether the tab can be reordered via drag and drop or not.
|
a GtkNotebook |
|
a child GtkWidget |
Returns : |
TRUE if the tab is reorderable.
|
Since 2.10
gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook
,GtkWidget *child
);
Returns whether the tab contents can be detached from notebook
.
|
a GtkNotebook |
|
a child GtkWidget |
Returns : |
TRUE if the tab is detachable. |
Since 2.10
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.
|
a GtkNotebook |
|
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. |
void gtk_notebook_set_group_id (GtkNotebook *notebook
,gint group_id
);
gtk_notebook_set_group_id
has been deprecated since version 2.12 and should not be used in newly-written code. use gtk_notebook_set_group()
instead.
Sets an group identificator for notebook
, notebooks sharing
the same group identificator will be able to exchange tabs
via drag and drop. A notebook with group identificator -1 will
not be able to exchange tabs with any other notebook.
|
a GtkNotebook |
|
a group identificator, or -1 to unset it |
Since 2.10
gint gtk_notebook_get_group_id (GtkNotebook *notebook
);
gtk_notebook_get_group_id
has been deprecated since version 2.12 and should not be used in newly-written code. use gtk_notebook_get_group()
instead.
Gets the current group identificator for notebook
.
|
a GtkNotebook |
Returns : |
the group identificator, or -1 if none is set. |
Since 2.10
void gtk_notebook_set_group (GtkNotebook *notebook
,gpointer group
);
Sets a group identificator pointer for notebook
, notebooks sharing
the same group identificator pointer will be able to exchange tabs
via drag and drop. A notebook with a NULL
group identificator will
not be able to exchange tabs with any other notebook.
|
a GtkNotebook |
|
a pointer to identify the notebook group, or NULL to unset it. allow-none. |
Since 2.12
gpointer gtk_notebook_get_group (GtkNotebook *notebook
);
Gets the current group identificator pointer for notebook
.
|
a GtkNotebook |
Returns : |
the group identificator, or NULL if none is set.
|
Since 2.12
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()
.
|
a GtkNotebook |
|
a GtkWidget |
|
pack type of the action widget |
Since 2.20
GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook
,GtkPackType pack_type
);
Gets one of the action widgets. See gtk_notebook_set_action_widget()
.
|
a GtkNotebook |
|
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
|
Since 2.20
GtkNotebook * (*GtkNotebookWindowCreationFunc) (GtkNotebook *source
,GtkWidget *page
,gint x
,gint y
,gpointer data
);
A function used by GtkNotebook when a detachable tab is dropped
in the root window, it's used to create a window containing a notebook
where the tab will be attached. This function will also be responsible
of moving/resizing the window and adding the necessary properties to
the notebook (i.e.: group-id).
If the function returns NULL
, the drag will be cancelled.
|
The source GtkNotebook of the drag operation |
|
the child GtkWidget affected |
|
the X coordinate where the drop happens |
|
the Y coordinate where the drop happens |
|
user data |
Returns : |
The created GtkNotebook where the tab will be attached, or NULL to cancel the drag |
void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func
,gpointer data
,GDestroyNotify destroy
);
Installs a global function used to create a window when a detached tab is dropped in an empty area.
|
the GtkNotebookWindowCreationFunc, or NULL . allow-none. |
|
user data for func
|
|
Destroy notifier for data , or NULL . allow-none. |
Since 2.10
"enable-popup"
property"enable-popup" gboolean : Read / Write
If TRUE, pressing the right mouse button on the notebook pops up a menu that you can use to go to a page.
Default value: FALSE
"group-id"
property"group-id" gint : Read / Write
Group ID for tabs drag and drop.
Allowed values: >= G_MAXULONG
Default value: -1
"homogeneous"
property"homogeneous" gboolean : Read / Write
Whether tabs should have homogeneous sizes.
Default value: FALSE
"page"
property"page" gint : Read / Write
The index of the current page.
Allowed values: >= G_MAXULONG
Default value: -1
"scrollable"
property"scrollable" gboolean : Read / Write
If TRUE, scroll arrows are added if there are too many tabs to fit.
Default value: FALSE
"show-border"
property"show-border" gboolean : Read / Write
Whether the border should be shown or not.
Default value: TRUE
"show-tabs"
property"show-tabs" gboolean : Read / Write
Whether tabs should be shown or not.
Default value: TRUE
"tab-border"
property"tab-border" guint : Write
Width of the border around the tab labels.
Default value: 2
"tab-hborder"
property"tab-hborder" guint : Read / Write
Width of the horizontal border of tab labels.
Default value: 2
"tab-pos"
property"tab-pos" GtkPositionType : Read / Write
Which side of the notebook holds the tabs.
Default value: GTK_POS_TOP
"tab-vborder"
property"tab-vborder" guint : Read / Write
Width of the vertical border of tab labels.
Default value: 2
"detachable"
child property"detachable" gboolean : Read / Write
Whether the tab is detachable.
Default value: FALSE
"menu-label"
child property"menu-label" gchar* : Read / Write
The string displayed in the child's menu entry.
Default value: NULL
"position"
child property"position" gint : Read / Write
The index of the child in the parent.
Allowed values: >= G_MAXULONG
Default value: 0
"reorderable"
child property"reorderable" gboolean : Read / Write
Whether the tab is reorderable by user action or not.
Default value: FALSE
"tab-expand"
child property"tab-expand" gboolean : Read / Write
Whether to expand the child's tab or not.
Default value: FALSE
"tab-fill"
child property"tab-fill" gboolean : Read / Write
Whether the child's tab should fill the allocated area or not.
Default value: TRUE
"tab-label"
child property"tab-label" gchar* : Read / Write
The string displayed on the child's tab label.
Default value: NULL
"tab-pack"
child property"tab-pack" GtkPackType : Read / Write
Deprecated: 2.20: The tab packing functionality of children should not be used anymore and support will be removed in the future.
Default value: GTK_PACK_START
"arrow-spacing"
style property"arrow-spacing" gint : Read
The "arrow-spacing" property defines the spacing between the scroll arrows and the tabs.
Allowed values: >= 0
Default value: 0
Since 2.10
"has-backward-stepper"
style property"has-backward-stepper" gboolean : Read
The "has-backward-stepper" property determines whether the standard backward arrow button is displayed.
Default value: TRUE
Since 2.4
"has-forward-stepper"
style property"has-forward-stepper" gboolean : Read
The "has-forward-stepper" property determines whether the standard forward arrow button is displayed.
Default value: TRUE
Since 2.4
"has-secondary-backward-stepper"
style property"has-secondary-backward-stepper" gboolean : Read
The "has-secondary-backward-stepper" property determines whether a second backward arrow button is displayed on the opposite end of the tab area.
Default value: FALSE
Since 2.4
"has-secondary-forward-stepper"
style property"has-secondary-forward-stepper" gboolean : Read
The "has-secondary-forward-stepper" property determines whether a second forward arrow button is displayed on the opposite end of the tab area.
Default value: FALSE
Since 2.4
"tab-curvature"
style property"tab-curvature" gint : Read
The "tab-curvature" property defines size of tab curvature.
Allowed values: >= 0
Default value: 1
Since 2.10
"tab-overlap"
style property"tab-overlap" gint : Read
The "tab-overlap" property defines size of tab overlap area.
Default value: 2
Since 2.10
"change-current-page"
signalgboolean user_function (GtkNotebook *notebook, gint arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
"create-window"
signalGtkNotebook* user_function (GtkNotebook *notebook, GtkWidget *page, gint x, gint y, gpointer user_data) : Run Last
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-id" ).
The default handler uses the global window creation hook,
if one has been set with gtk_notebook_set_window_creation_hook()
.
|
the GtkNotebook emitting the signal |
|
the tab of notebook that is being detached
|
|
the X coordinate where the drop happens |
|
the Y coordinate where the drop happens |
|
user data set when the signal handler was connected. |
Returns : |
a GtkNotebook that page should be added to, or NULL .
|
Since 2.12
"focus-tab"
signalgboolean user_function (GtkNotebook *notebook, GtkNotebookTab arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
"move-focus-out"
signalvoid user_function (GtkNotebook *notebook, GtkDirectionType arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"page-added"
signalvoid user_function (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data) : Run Last
the ::page-added signal is emitted in the notebook right after a page is added to the notebook.
|
the GtkNotebook |
|
the child GtkWidget affected |
|
the new page number for child
|
|
user data set when the signal handler was connected. |
Since 2.10
"page-removed"
signalvoid user_function (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data) : Run Last
the ::page-removed signal is emitted in the notebook right after a page is removed from the notebook.
|
the GtkNotebook |
|
the child GtkWidget affected |
|
the child page number
|
|
user data set when the signal handler was connected. |
Since 2.10
"page-reordered"
signalvoid user_function (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data) : Run Last
the ::page-reordered signal is emitted in the notebook right after a page has been reordered.
|
the GtkNotebook |
|
the child GtkWidget affected |
|
the new page number for child
|
|
user data set when the signal handler was connected. |
Since 2.10
"reorder-tab"
signalgboolean user_function (GtkNotebook *notebook, GtkDirectionType arg1, gboolean arg2, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
Returns : |
"select-page"
signalgboolean user_function (GtkNotebook *notebook, gboolean arg1, gpointer user_data) : Run Last / Action
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
Returns : |
"switch-page"
signalvoid user_function (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data) : Run Last
Emitted when the user or a function changes the current page.
|
the object which received the signal. |
|
the new current page |
|
the index of the page |
|
user data set when the signal handler was connected. |