Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions | Static Protected Attributes
Xfc::Gtk::Notebook Class Reference

A GtkNotebook C++ wrapper class. More...

#include <xfc/gtk/notebook.hh>

Inheritance diagram for Xfc::Gtk::Notebook:
Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable

List of all members.

Public Member Functions

Static Protected Attributes

Constructors


Detailed Description

A GtkNotebook C++ wrapper class.

The Notebook widget is a Container whose children are pages that can be switched between using tab labels along one edge. There are many configuration options for Notebook. Among other things, you can choose on which edge the tabs appear (see set_tab_pos()), whether, if there are too many tabs to fit the noteobook should be made bigger or scrolling arrows added (see set_scrollable()), and whether there will be a popup menu allowing the users to switch pages. (see popup_enable(), popup_disable()).

See also: the Notebook HOWTO and example.


Constructor & Destructor Documentation

Xfc::Gtk::Notebook::Notebook ( GtkNotebook *  notebook,
bool  owns_reference = false 
) [explicit, protected]

Construct a new Notebook from an existing GtkNotebook.

Parameters:
notebookA pointer to a GtkNotebook.
owns_referenceSet false if the initial reference count is floating, set true if it's not.

The notebook can be a newly created GtkNotebook or an existing GtkNotebook (see G::Object::Object).


Member Function Documentation

int Xfc::Gtk::Notebook::append_page ( Widget child,
Widget tab_label = 0,
Widget menu_label = 0 
)

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

Parameters:
childThe Widget to use as the contents of the page.
tab_labelThe Widget to be used as the label for the page, or null to use the default label, 'page N'.
menu_labelThe widget to use as a label for the page-switch menu, if that is enabled.
Returns:
The index (starting from 0) of the appended page in the notebook, or -1 if it fails.

If null, and tab_label is a Label 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 Label, menu_label must be specified if the page-switch menu is to be used.

int Xfc::Gtk::Notebook::append_page ( Widget child,
const String tab_label,
const String menu_label = 0 
)

Appends a page to the notebook with the specified tab label text and the popup menu label text.

Parameters:
childThe Widget to use as the contents of the page.
tab_labelThe tab label text.
menu_labelThe menu_label text.
Returns:
The index (starting from 0) of the appended page in the notebook, or -1 if it fails.

This method creates default tab and menu labels.

Returns the child widget contained in the current page.

Returns:
The child widget, or null if the notebook has no pages.

Returns the page number of the current page.

Returns:
The index (starting from 0) of the current page in the notebook.

If the notebook has no pages, then -1 will be returned.

Label* Xfc::Gtk::Notebook::get_menu_label ( const Widget child) const

Retrieves the menu label widget of the page containing child.

Parameters:
childA widget contained in a page of notebook.
Returns:
The menu label, or null if the page does not have a menu label other than the default.
Label* Xfc::Gtk::Notebook::get_menu_label ( int  page_num) const

Retrieves the menu label widget of the page with the index page_num.

Parameters:
page_numThe index of a page in the noteobok, or -1 to get the last page.
Returns:
The menu label, or null if the page does not have a menu label other than the default.

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

Parameters:
childThe child widget of a page of the notebook.
Returns:
The text of the menu label, or a null String if the widget does not have a menu label other than the default menu label, or the menu label widget is not a Label.

Retrieves the text of the menu label for the page with the index page_num.

Parameters:
page_numThe index of a page in the noteobok, or -1 to get the last page.
Returns:
The text of the menu label, or a null String if the widget does not have a menu label other than the default menu label, or the menu label widget is not a Label.
Widget* Xfc::Gtk::Notebook::get_nth_page ( int  page_num) const

Returns the child widget contained in page number page_num.

Parameters:
page_numThe index of a page in the noteobok, or -1 to get the last page.
Returns:
The child widget, or null if page_num is out of bounds.

Returns whether the tab label area has arrows for scrolling (see set_scrollable()).

Returns:
true if arrows for scrolling are present.

Returns whether a bevel will be drawn around the notebook pages (see set_show_border()).

Returns:
true if the bevel is drawn.

Returns whether the tabs of the notebook are shown (see set_show_tabs()).

Returns:
true if the tabs are shown.
Label* Xfc::Gtk::Notebook::get_tab_label ( const Widget child) const

Returns the tab label widget for the page containing child.

Parameters:
childThe page.
Returns:
The tab label.

null is returned if child is not in notebook or if no tab label has specifically been set for child.

Label* Xfc::Gtk::Notebook::get_tab_label ( int  page_num) const

Returns the tab label widget for the page with the index page_num.

Parameters:
page_numThe index of a page in the noteobok, or -1 to get the last page.
Returns:
The tab label.

null is returned if child is not in notebook or if no tab label has specifically been set for child.

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

Parameters:
childA widget contained in a page of notebook.
Returns:
The text of the tab label, or a null String if the tab label widget is not a Label.

Retrieves the text of the tab label for the page with the index page_num.

Parameters:
page_numThe index of a page in the noteobok, or -1 to get the last page.
Returns:
The text of the tab label, or a null String if the tab label widget is not a Label.

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

Returns:
The edge at which the tabs are drawn.
int Xfc::Gtk::Notebook::insert_page ( Widget child,
int  position,
Widget tab_label = 0,
Widget menu_label = 0 
)

Insert a page into the notebook, specifying the widget to use as the label in the tab and the widget to use as the label in the popup menu.

Parameters:
childThe Widget to use as the contents of the page.
positionThe index (starting at 0) at which to insert the page.
tab_labelThe Widget to be used as the label for the page, or null to use the default label, 'page N'.
menu_labelThe widget to use as a label for the page-switch menu, if that is enabled.
Returns:
The index (starting from 0) of the inserted page in the notebook, or -1 if it fails.

If null, and tab_label is a Label 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 Label, menu_label must be specified if the page-switch menu is to be used. A position value of 0 prepends the new page before all the others. A position value of -1 will append the new page after all the others.

int Xfc::Gtk::Notebook::insert_page ( Widget child,
int  position,
const String tab_label,
const String menu_label = 0 
)

Insert a page into the notebook with the specified tab label text and the popup menu label text.

Parameters:
childThe Widget to use as the contents of the page.
positionThe index (starting at 0) at which to insert the page.
tab_labelThe tab label text.
menu_labelThe menu_label text.
Returns:
The index (starting from 0) of the inserted page in the notebook, or -1 if it fails.

This method creates default tab and menu labels. A position value of 0 prepends the new page before all the others. A position value of -1 will append the new page after all the others.

int Xfc::Gtk::Notebook::page_num ( const Widget child) const

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

Parameters:
childA Widget.
Returns:
The index of the page containing child, or -1 if child is not in the 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.

int Xfc::Gtk::Notebook::prepend_page ( Widget child,
Widget tab_label = 0,
Widget menu_label = 0 
)

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

Parameters:
childThe Widget to use as the contents of the page.
tab_labelThe Widget to be used as the label for the page, or null to use the default label, 'page N'.
menu_labelThe widget to use as a label for the page-switch menu, if that is enabled.
Returns:
The index (starting from 0) of the prepended page in the notebook, or -1 if it fails.

If null, and tab_label is a Label 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 Label, menu_label must be specified if the page-switch menu is to be used.

int Xfc::Gtk::Notebook::prepend_page ( Widget child,
const String tab_label,
const String menu_label = 0 
)

Prepends a page to the notebook with the specified tab label text and the popup menu label text.

Parameters:
childThe Widget to use as the contents of the page.
tab_labelThe tab label text.
menu_labelThe menu_label text.
Returns:
The index (starting from 0) of the prepended page in the notebook, or -1 if it fails.

This method creates default tab and menu labels.

void Xfc::Gtk::Notebook::query_tab_label_packing ( const Widget child,
bool *  expand,
bool *  fill,
PackType pack_type 
) const

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

Parameters:
childThe child widget.
expandThe location to store the expand value (or null).
fillThe location to store the fill value (or null).
pack_typeThe location to store the pack_type (or null).
void Xfc::Gtk::Notebook::remove_page ( int  page_num)

Removes the page from the notebook with the index page_num.

Parameters:
page_numThe index of a notebook page, starting from 0. If -1, the last page will be removed.
void Xfc::Gtk::Notebook::reorder_child ( Widget child,
int  position 
)

Reorders the page containing child, so that it appears in position position.

Parameters:
childThe child to move.
positionThe new position, or -1 to move to the end.

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.

void Xfc::Gtk::Notebook::set_current_page ( int  page_num)

Switches to the page number page_num.

Parameters:
page_numThe index of the page to switch to, starting from 0.

If page_num is negative, the last page will be used. If page_num is greater than the number of pages in the notebook, nothing will be done.

void Xfc::Gtk::Notebook::set_menu_label ( Widget child,
Widget menu_label 
)

Changes the menu label for the page containing child.

Parameters:
childThe child widget.
menu_labelThe menu label, or null for default.
void Xfc::Gtk::Notebook::set_menu_label_text ( Widget child,
const String menu_text 
)

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

Parameters:
childThe child widget.
menu_textThe label text.
void Xfc::Gtk::Notebook::set_scrollable ( bool  scrollable)

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

Parameters:
scrollabletrue if scroll arrows should be added.
void Xfc::Gtk::Notebook::set_show_border ( bool  show_border)

Sets whether a bevel will be drawn around the notebook pages.

Parameters:
show_bordertrue if a bevel should be drawn around the notebook.

This only has a visual effect when the tabs are not shown (see set_show_tabs()).

void Xfc::Gtk::Notebook::set_show_tabs ( bool  show_tabs)

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

Parameters:
show_tabstrue if the tabs should be shown.
void Xfc::Gtk::Notebook::set_tab_label ( Widget child,
Widget tab_label 
)

Changes the tab label for the page containing child.

Parameters:
childThe child widget.
tab_labelThe tab label widget to use, or null for default tab label.
void Xfc::Gtk::Notebook::set_tab_label_packing ( Widget child,
bool  expand,
bool  fill,
PackType  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).

Parameters:
childThe child widget
expandWhether to expand the bookmark or not.
fillWhether the bookmark should fill the allocated area or not.
pack_typeThe position of the bookmark.
void Xfc::Gtk::Notebook::set_tab_label_text ( Widget child,
const String tab_text 
)

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

Parameters:
childThe child widget.
tab_textThe label text.

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

Parameters:
posThe edge to draw the tabs at.

Connect to the switch_page_signal; emitted when the user or a function changes the current page.


Member Data Documentation

Switch page signal (see signal_switch_page()).

Calls a slot with the signature:

< void function(Widget& page_child, unsigned int page_num);
< // page_child: The child widget that is the contents of the new current page.
< // page_num: The index of the new current page.
<

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC