Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Notebook


Detailed Description

The Etk_Notebook widget is a container that can contain several widgets in different pages accessible through tabs.

notebook.png
You can add a new page to the notebook with etk_notebook_page_prepend(), etk_notebook_page_append() and etk_notebook_page_insert().
A page can then be removed from the notebook with etk_notebook_page_remove().

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
        • Etk_Notebook
Signals:
  • "current-page-changed": Emitted when the active page of the notebook is changed
    • Callback: void callback(Etk_Notebook *notebook, void *data)
      • notebook: the notebook whose active page has been changed
      • data: the user data set when the callback has been connected to the signal
Properties:
  • "tabs-visible": Whether the tab bar is visible or not
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_TRUE


Data Structures

struct  Etk_Notebook
 [Widget] A container that can contain several widgets in different pages accessible through tabs More...

Defines

#define ETK_NOTEBOOK_TYPE   (etk_notebook_type_get())
#define ETK_NOTEBOOK(obj)   (ETK_OBJECT_CAST((obj), ETK_NOTEBOOK_TYPE, Etk_Notebook))
#define ETK_IS_NOTEBOOK(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_NOTEBOOK_TYPE))

Functions

Etk_Widget * etk_notebook_new (void)
 Creates a new notebook widget.
int etk_notebook_page_prepend (Etk_Notebook *notebook, const char *tab_label, Etk_Widget *page_child)
 Creates a new page and prepends it to the notebook.
int etk_notebook_page_append (Etk_Notebook *notebook, const char *tab_label, Etk_Widget *page_child)
 Creates a new page and appends it to the notebook.
int etk_notebook_page_insert (Etk_Notebook *notebook, const char *tab_label, Etk_Widget *page_child, int position)
 Creates a new page and inserts it to the notebook at a given position.
Etk_Widget * etk_notebook_page_remove (Etk_Notebook *notebook, int page_num)
 Removes from the notebook the page corresponding to the index. The child of the widget will just be unpacked, not destroyed.
int etk_notebook_num_pages_get (Etk_Notebook *notebook)
 Gets the numbers of pages of the notebook.
void etk_notebook_current_page_set (Etk_Notebook *notebook, int page_num)
 Sets the current page of the notebook.
int etk_notebook_current_page_get (Etk_Notebook *notebook)
 Gets the index of the current page of the notebook.
int etk_notebook_page_index_get (Etk_Notebook *notebook, Etk_Widget *child)
 Gets the index of the page containing the specified widget.
int etk_notebook_page_prev (Etk_Notebook *notebook)
 Switches to the previous page of the notebook.
int etk_notebook_page_next (Etk_Notebook *notebook)
 Switches to the next page of the notebook.
void etk_notebook_page_tab_label_set (Etk_Notebook *notebook, int page_num, const char *tab_label)
 Sets the label of a tab of the notebook.
const char * etk_notebook_page_tab_label_get (Etk_Notebook *notebook, int page_num)
 Gets the label of a tab of the notebook.
void etk_notebook_page_tab_widget_set (Etk_Notebook *notebook, int page_num, Etk_Widget *tab_widget)
 Sets the child of the tab of a notebook's page For example, you can set a hbox containing an icon, a text label and a close button.
Etk_Widget * etk_notebook_page_tab_widget_get (Etk_Notebook *notebook, int page_num)
 Gets the child of the tab of a notebook's page.
void etk_notebook_page_child_set (Etk_Notebook *notebook, int page_num, Etk_Widget *child)
 Sets the child of a page of the notebook. This widget will be shown when the page is set as the current one.
Etk_Widget * etk_notebook_page_child_get (Etk_Notebook *notebook, int page_num)
 Gets the child of a page of the notebook.
void etk_notebook_tabs_visible_set (Etk_Notebook *notebook, Etk_Bool tabs_visible)
 Sets whether the tab-bar of the notebook should be visible or not.
Etk_Bool etk_notebook_tabs_visible_get (Etk_Notebook *notebook)
 Gets whether or not the tab-bar is visible.


Define Documentation

#define ETK_NOTEBOOK_TYPE   (etk_notebook_type_get())

Gets the type of a notebook

#define ETK_NOTEBOOK ( obj   )     (ETK_OBJECT_CAST((obj), ETK_NOTEBOOK_TYPE, Etk_Notebook))

Casts the object to an Etk_Notebook

#define ETK_IS_NOTEBOOK ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_NOTEBOOK_TYPE))

Checks if the object is an Etk_Notebook


Function Documentation

Etk_Widget * etk_notebook_new ( void   ) 

Creates a new notebook widget.

Returns:
Returns the new notebook

int etk_notebook_page_prepend ( Etk_Notebook *  notebook,
const char *  tab_label,
Etk_Widget *  page_child 
)

Creates a new page and prepends it to the notebook.

Parameters:
notebook a notebook
tab_label the text to set to the tab's label
page_child the child of the new page. This widget will be shown when the page is set as the current one
Returns:
Returns the position of the new page (0 since the page is prepended), or -1 on failure

int etk_notebook_page_append ( Etk_Notebook *  notebook,
const char *  tab_label,
Etk_Widget *  page_child 
)

Creates a new page and appends it to the notebook.

Parameters:
notebook a notebook
tab_label the text to set to the tab's label
page_child the child of the new page. This widget will be shown when the page is set as the current one
Returns:
Returns the position of the new page (starting from 0), or -1 on failure

int etk_notebook_page_insert ( Etk_Notebook *  notebook,
const char *  tab_label,
Etk_Widget *  page_child,
int  position 
)

Creates a new page and inserts it to the notebook at a given position.

Parameters:
notebook a notebook
tab_label the text to set to the tab's label
page_child the child of the new page. This widget will be shown when the page is set as the current one
position the position (starting from 0) where the new page will be inserted.
If position <= 0, the page will be prepended. If position >= etk_notebook_num_pages_get(notebook), the page will be appended.
Returns:
Returns the position of the new page (i.e. position in this case), or -1 on failure

Etk_Widget * etk_notebook_page_remove ( Etk_Notebook *  notebook,
int  page_num 
)

Removes from the notebook the page corresponding to the index. The child of the widget will just be unpacked, not destroyed.

Parameters:
notebook a notebook
page_num the index of the page to remove (starting from 0)
Returns:
Returns the child that has been unpacked from the page, or NULL if the page had no child

int etk_notebook_num_pages_get ( Etk_Notebook *  notebook  ) 

Gets the numbers of pages of the notebook.

Parameters:
notebook a notebook
Returns:
Returns the number of pages

void etk_notebook_current_page_set ( Etk_Notebook *  notebook,
int  page_num 
)

Sets the current page of the notebook.

Parameters:
notebook a notebook
page_num the index of the page to set as the current one

int etk_notebook_current_page_get ( Etk_Notebook *  notebook  ) 

Gets the index of the current page of the notebook.

Parameters:
notebook a notebook
Returns:
Returns the index of the current page of the notebook, or -1 on failure

int etk_notebook_page_index_get ( Etk_Notebook *  notebook,
Etk_Widget *  child 
)

Gets the index of the page containing the specified widget.

Parameters:
notebook a notebook
child the child widget of the page which you want to get the index of
Returns:
Returns the index of the page or -1 if the page is not found

int etk_notebook_page_prev ( Etk_Notebook *  notebook  ) 

Switches to the previous page of the notebook.

Parameters:
notebook a notebook
Returns:
Returns the index of the previous page of the notebook (which is now the current page), or -1 on failure

int etk_notebook_page_next ( Etk_Notebook *  notebook  ) 

Switches to the next page of the notebook.

Parameters:
notebook a notebook
Returns:
Returns the index of the next page of the notebook (which is now the current page), or -1 on failure

void etk_notebook_page_tab_label_set ( Etk_Notebook *  notebook,
int  page_num,
const char *  tab_label 
)

Sets the label of a tab of the notebook.

Parameters:
notebook a notebook
page_num the index of the page you want to set the tab-label of
tab_label the new label of the tab

const char * etk_notebook_page_tab_label_get ( Etk_Notebook *  notebook,
int  page_num 
)

Gets the label of a tab of the notebook.

Parameters:
notebook a notebook
page_num the index of the page you want to get the tab label of
Returns:
Returns the label, or NULL on failure

void etk_notebook_page_tab_widget_set ( Etk_Notebook *  notebook,
int  page_num,
Etk_Widget *  tab_widget 
)

Sets the child of the tab of a notebook's page For example, you can set a hbox containing an icon, a text label and a close button.

Parameters:
notebook a notebook
page_num the index of the page you want to set the tab-widget of
tab_widget the new widget to use as the child of the tab

Etk_Widget * etk_notebook_page_tab_widget_get ( Etk_Notebook *  notebook,
int  page_num 
)

Gets the child of the tab of a notebook's page.

Parameters:
notebook a notebook
page_num the index of the page you want to get the tab-widget of
Returns:
Returns the child of the tab, or NULL on failure

void etk_notebook_page_child_set ( Etk_Notebook *  notebook,
int  page_num,
Etk_Widget *  child 
)

Sets the child of a page of the notebook. This widget will be shown when the page is set as the current one.

Parameters:
notebook a notebook
page_num the index of the page that you want to set the child of
child the new widget to display when the corresponding tab is activated

Etk_Widget * etk_notebook_page_child_get ( Etk_Notebook *  notebook,
int  page_num 
)

Gets the child of a page of the notebook.

Parameters:
notebook a notebook
page_num the index of the page that you want to get the child of
Returns:
Returns the child of the corresponding page, or NULL on failure

void etk_notebook_tabs_visible_set ( Etk_Notebook *  notebook,
Etk_Bool  tabs_visible 
)

Sets whether the tab-bar of the notebook should be visible or not.

Parameters:
notebook a notebook
tabs_visible if tabs_visible is ETK_FALSE, the tab-bar will be hidden. Otherwise, it will be shown

Etk_Bool etk_notebook_tabs_visible_get ( Etk_Notebook *  notebook  ) 

Gets whether or not the tab-bar is visible.

Parameters:
notebook a notebook
Returns:
Returns ETK_TRUE if the tab bar is visible, ETK_FALSE otherwise