Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Notebook Class Reference

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

`#include <inti/gtk/notebook.h>`

Inheritance diagram for Inti::Gtk::Notebook:

List of all members.

## Public Member Functions

Constructors

- Notebook ()
    Construct a new notebook with no pages.
- virtual ~Notebook ()
    Destructor.

Accessors

- GtkNotebook * gtk_notebook () const
    Get a pointer to the GtkNotebook structure.
- GtkNotebookClass * gtk_notebook_class () const
    Get a pointer to the GtkNotebookClass structure.
- operator GtkNotebook * () const
    Conversion operator; safely converts a Notebook to a GtkNotebook pointer.
- int get_current_page () const
    Returns the page number of the current page.
- Widget * get_current_nth_page () const
    Returns the child widget contained in the current page.
- Widget * get_nth_page (int page_num) const
    Returns the child widget contained in page number page_num.
- int get_n_pages () const
    Returns the number of pages in the notebook.
- int page_num (const Widget &child) const
    Finds the index of the page which contains the given child widget.
- bool get_show_border () const
    Returns whether a bevel will be drawn around the notebook pages (see set_show_border()).
- bool get_show_tabs () const
    Returns whether the tabs of the notebook are shown (see set_show_tabs()).
- PositionType get_tab_pos () const
    Gets the edge at which the tabs for switching pages in the notebook are drawn.
- bool get_scrollable () const
    Returns whether the tab label area has arrows for scrolling (see set_scrollable()).
- Label * get_tab_label (const Widget &child) const
    Returns the tab label widget for the page containing child.
- Label * get_tab_label (int page_num) const
    Returns the tab label widget for the page with the index page_num.
- String get_tab_label_text (const Widget &child) const
    Retrieves the text of the tab label for the page containing child.
- String get_tab_label_text (int page_num) const
    Retrieves the text of the tab label for the page with the index page_num.
- Label * get_menu_label (const Widget &child) const
    Retrieves the menu label widget of the page containing child.
- Label * get_menu_label (int page_num) const
    Retrieves the menu label widget of the page with the index page_num.
- String get_menu_label_text (const Widget &child) const
    Retrieves the text of the menu label for the page containing child.
- String get_menu_label_text (int page_num) const
    Retrieves the text of the menu label for the page with the index page_num.
- void 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.

Methods

- void 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.
- void 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.
- void 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.
- void 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.
- void 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.
- void 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.
- void remove_page (int page_num)
    Removes the page from the notebook with the index page_num.
- void set_current_page (int page_num)
    Switches to the page number page_num.
- void next_page ()
    Switches to the next page. Nothing happens if the current page is the last page.
- void prev_page ()
    Switches to the previous page. Nothing happens if the current page is the first page.
- void set_show_border (bool show_border)
    Sets whether a bevel will be drawn around the notebook pages.
- void set_show_tabs (bool show_tabs)
    Sets whether to show the tabs for the notebook or not.
- void set_tab_pos (PositionType pos)
    Sets the edge at which the tabs for switching pages in the notebook are drawn.
- void 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.
- void popup_enable ()
    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.
- void popup_disable ()
    Disables the popup menu.
- void set_tab_label (Widget &child, Widget *tab_label)
    Changes the tab label for the page containing child.
- void 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.
- void set_menu_label (Widget &child, Widget *menu_label)
    Changes the menu label for the page containing child.
- void 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.
- void 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).
- void reorder_child (Widget &child, int position)
    Reorders the page containing child, so that it appears in position position.

Property Proxies

- const PagePropertyProxy prop_page ()
    The index of the current page (int : Read / Write).
- const TabPosPropertyProxy prop_tab_pos ()
    Which side of the notebook holds the tabs (PositionType : Read / Write).
- const TabBorderPropertyProxy prop_tab_border ()
    Width of the border around the tab labels (unsigned int : Write).
- const TabHBorderPropertyProxy prop_tab_hborder ()
    Width of the horizontal border of tab labels (unsigned int : Read / Write).
- const TabVBorderPropertyProxy prop_tab_vborder ()
    Width of the vertical border of tab labels (unsigned int : Read / Write).
- const ShowTabsPropertyProxy prop_show_tabs ()
    Whether tabs should be shown or not (bool : Read / Write).
- const ShowBorderPropertyProxy prop_show_border ()
    Whether the border should be shown or not (bool : Read / Write).
- const ScrollablePropertyProxy prop_scrollable ()
    If true, scroll arrows are added if there are too many tabs to fit (bool : Read / Write).
- const EnablePopupPropertyProxy prop_enable_popup ()
    If true, pressing the right mouse button on the notebook pops up a menu that you can use to go to a page (bool : Read / Write).
- const HomogeneousPropertyProxy prop_homogeneous ()
    Whether tabs should have homogeneous sizes (bool : Read / Write).

Child Property Proxies

- const TabLabelPropertyProxy prop_tab_label ()
    The string displayed on the childs tab label (String : Read / Write).
- const MenuLabelPropertyProxy prop_menu_label ()
    The string displayed in the childs menu entry (String : Read / Write).
- const PositionPropertyProxy prop_position ()
    The index of the child in the parent (int : Read / Write).
- const TabExpandPropertyProxy prop_tab_expand ()
    Whether to expand the childs tab or not (bool : Read / Write).
- const TabFillPropertyProxy prop_tab_fill ()
    Whether the childs tab should fill the allocated area or not (bool : Read / Write).
- const TabPackPropertyProxy prop_tab_pack ()
    A PackType indicating whether the child is packed with reference to the start or end of the parent (PackType : Read / Write).

Signal Proxies

- const SwitchPageSignalProxy sig_switch_page ()
    Connect to the switch_page_signal; emitted when the user or a function changes the current page.

## Protected Member Functions

Constructors

- Notebook (GtkNotebook *notebook, bool reference=false)
    Construct a new Notebook from an existing GtkNotebook.

Signal Handlers

- virtual void on_switch_page (GtkNotebookPage *page, unsigned int page_num)
    Called when the user or a function changes the current page.

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

## Constructor & Destructor Documentation

Inti::Gtk::Notebook::Notebook | ( | GtkNotebook * | notebook,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new Notebook from an existing GtkNotebook.

Parameters:

  notebook | A pointer to a GtkNotebook.
  reference | Set 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

void Inti::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:

  child | The Widget to use as the contents of the page.
  tab_label | The tab label text.
  menu_label | The menu_label text.

This method creates default tab and menu labels.

void Inti::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:

  child | The Widget to use as the contents of the page.
  tab_label | The Widget to be used as the label for the page, or null to use the default label, 'page N'.
  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 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.

Widget* Inti::Gtk::Notebook::get_current_nth_page | ( |  | ) | const

Returns the child widget contained in the current page.

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

int Inti::Gtk::Notebook::get_current_page | ( |  | ) | const

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* Inti::Gtk::Notebook::get_menu_label | ( | int | page_num | ) | const

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

Parameters:

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

Label* Inti::Gtk::Notebook::get_menu_label | ( | const Widget & | child | ) | const

Retrieves the menu label widget of the page containing child.

Parameters:

  child | A 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.

String Inti::Gtk::Notebook::get_menu_label_text | ( | int | page_num | ) | const

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

Parameters:

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

String Inti::Gtk::Notebook::get_menu_label_text | ( | const Widget & | child | ) | const

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

Parameters:

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

Widget* Inti::Gtk::Notebook::get_nth_page | ( | int | page_num | ) | const

Returns the child widget contained in page number page_num.

Parameters:

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

bool Inti::Gtk::Notebook::get_scrollable | ( |  | ) | const

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

Returns:
  true if arrows for scrolling are present.

bool Inti::Gtk::Notebook::get_show_border | ( |  | ) | const

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

Returns:
  true if the bevel is drawn.

bool Inti::Gtk::Notebook::get_show_tabs | ( |  | ) | const

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

Returns:
  true if the tabs are shown.

Label* Inti::Gtk::Notebook::get_tab_label | ( | int | page_num | ) | const

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

Parameters:

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

Label* Inti::Gtk::Notebook::get_tab_label | ( | const Widget & | child | ) | const

Returns the tab label widget for the page containing child.

Parameters:

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

String Inti::Gtk::Notebook::get_tab_label_text | ( | int | page_num | ) | const

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

Parameters:

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

String Inti::Gtk::Notebook::get_tab_label_text | ( | const Widget & | child | ) | const

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

Parameters:

  child | A 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.

PositionType Inti::Gtk::Notebook::get_tab_pos | ( |  | ) | const

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

Returns:
  The edge at which the tabs are drawn.

void Inti::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:

  child | The Widget to use as the contents of the page.
  position | The index (starting at 0) at which to insert the page.
  tab_label | The tab label text.
  menu_label | The menu_label text.

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.

void Inti::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:

  child | The Widget to use as the contents of the page.
  position | The index (starting at 0) at which to insert the page.
  tab_label | The Widget to be used as the label for the page, or null to use the default label, 'page N'.
  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 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.

virtual void Inti::Gtk::Notebook::on_switch_page | ( | GtkNotebookPage * | page,
|  | unsigned int | page_num
| ) | `[protected, virtual]`

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

Parameters:

  page | The new current page.
  page_num | The index of the page.

int Inti::Gtk::Notebook::page_num | ( | const Widget & | child | ) | const

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

Parameters:

  child | A Widget.

Returns:
  The index of the page containing child, or -1 if child is not in the notebook.

void Inti::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:

  child | The Widget to use as the contents of the page.
  tab_label | The tab label text.
  menu_label | The menu_label text.

This method creates default tab and menu labels.

void Inti::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:

  child | The Widget to use as the contents of the page.
  tab_label | The Widget to be used as the label for the page, or null to use the default label, 'page N'.
  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 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.

void Inti::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:

  child | The child widget.
  expand | The location to store the expand value (or null).
  fill | The location to store the fill value (or null).
  pack_type | The location to store the pack_type (or null).

void Inti::Gtk::Notebook::remove_page | ( | int | page_num | ) |

Removes the page from the notebook with the index page_num.

Parameters:

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

void Inti::Gtk::Notebook::reorder_child | ( | Widget & | child,
|  | int | position
| ) |

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

Parameters:

  child | The child to move.
  position | The 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 Inti::Gtk::Notebook::set_current_page | ( | int | page_num | ) |

Switches to the page number page_num.

Parameters:

  page_num | The 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 Inti::Gtk::Notebook::set_menu_label | ( | Widget & | child,
|  | Widget * | menu_label
| ) |

Changes the menu label for the page containing child.

Parameters:

  child | The child widget.
  menu_label | The menu label, or null for default.

void Inti::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:

  child | The child widget.
  menu_text | The label text.

void Inti::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:

  scrollable | true if scroll arrows should be added.

void Inti::Gtk::Notebook::set_show_border | ( | bool | show_border | ) |

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

Parameters:

  show_border | true 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 Inti::Gtk::Notebook::set_show_tabs | ( | bool | show_tabs | ) |

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

Parameters:

  show_tabs | true if the tabs should be shown.

void Inti::Gtk::Notebook::set_tab_label | ( | Widget & | child,
|  | Widget * | tab_label
| ) |

Changes the tab label for the page containing child.

Parameters:

  child | The child widget.
  tab_label | The tab label widget to use, or null for default tab label.

void Inti::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:

  child | The child widget
  expand | Whether to expand the bookmark or not.
  fill | Whether the bookmark should fill the allocated area or not.
  pack_type | The position of the bookmark.

void Inti::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:

  child | The child widget.
  tab_text | The label text.

void Inti::Gtk::Notebook::set_tab_pos | ( | PositionType | pos | ) |

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

Parameters:

  pos | The edge to draw the tabs at.

The documentation for this class was generated from the following file:

- notebook.h

Main Page - Footer