Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

etk_tree.h File Reference


Detailed Description


Data Structures

struct  Etk_Tree_Col
 [Object] A column of a tree More...
struct  Etk_Tree_Row
 A row of a tree. More...
struct  Etk_Tree
 [Widget] A widget that displays rows of elements of different types, separated into columns More...

Defines

#define ETK_TREE_TYPE   (etk_tree_type_get())
#define ETK_TREE(obj)   (ETK_OBJECT_CAST((obj), ETK_TREE_TYPE, Etk_Tree))
#define ETK_IS_TREE(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_TREE_TYPE))
#define ETK_TREE_COL_TYPE   (etk_tree_col_type_get())
#define ETK_TREE_COL(obj)   (ETK_OBJECT_CAST((obj), ETK_TREE_COL_TYPE, Etk_Tree_Col))
#define ETK_IS_TREE_COL(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_TREE_COL_TYPE))

Enumerations

enum  Etk_Tree_Mode {
  ETK_TREE_MODE_LIST,
  ETK_TREE_MODE_TREE
}
 The different modes of the tree: List (rows can not have children) or tree (rows can have children). More...

Functions

Etk_Widget * etk_tree_new (void)
 Creates a new tree.
void etk_tree_mode_set (Etk_Tree *tree, Etk_Tree_Mode mode)
 Sets the mode of the tree. The tree must not be built.
Etk_Tree_Mode etk_tree_mode_get (Etk_Tree *tree)
 Gets the mode of tree.
void etk_tree_multiple_select_set (Etk_Tree *tree, Etk_Bool multiple_select)
 Sets whether the user can select several rows of the tree.
Etk_Bool etk_tree_multiple_select_get (Etk_Tree *tree)
 Gets whether or not several rows can be selected in the tree.
void etk_tree_headers_visible_set (Etk_Tree *tree, Etk_Bool headers_visible)
 Sets whether the column-headers should be visible or not.
Etk_Bool etk_tree_headers_visible_get (Etk_Tree *tree)
 Gets whether or not the column-headers are visible.
void etk_tree_rows_height_set (Etk_Tree *tree, int rows_height)
 Sets the height of the rows of the tree.
int etk_tree_rows_height_get (Etk_Tree *tree)
 Gets the height of the rows of the tree.
void etk_tree_build (Etk_Tree *tree)
 Builds the tree. You have to call this function after you have added all the columns and before you add the rows to the tree. Once the tree is built, it can not be unbuilt, and you could not add new columns anymore.
void etk_tree_freeze (Etk_Tree *tree)
 Freezes the tree: the won't be updated until it is thawed. It is useful to add a lot (> 1000) of rows efficiently. To add a few rows, freeze/thaw() is not necessary.
void etk_tree_thaw (Etk_Tree *tree)
 Thaws the tree: the tree will be updated the tree if it was frozen.
Etk_Tree_Col * etk_tree_col_new (Etk_Tree *tree, const char *title, int width, float alignment)
 Inserts a new column into a tree.
int etk_tree_num_cols_get (Etk_Tree *tree)
 Gets the number of columns of the tree.
Etk_Tree_Col * etk_tree_nth_col_get (Etk_Tree *tree, int nth)
 Gets the "nth" column of the tree.
Etk_Tree * etk_tree_col_tree_get (Etk_Tree_Col *col)
 Gets the tree which contains the given column.
void etk_tree_col_model_add (Etk_Tree_Col *col, Etk_Tree_Model *model)
 Adds a model to a column of the tree. You can add several models to the same column in order to combine them. For example, if you want the column's content to be an icon followed by a text, add the "image" model and then the "text" model.
Etk_Widget * etk_tree_col_header_get (Etk_Tree_Col *col)
 Gets the column's header widget. This can be used if you want to detect clicks on it for example. The header widget is an Etk_Button.
void etk_tree_col_title_set (Etk_Tree_Col *col, const char *title)
 Sets the title of the column.
const char * etk_tree_col_title_get (Etk_Tree_Col *col)
 Gets the title of the column.
void etk_tree_col_width_set (Etk_Tree_Col *col, int width)
 Sets the width of the column. It won't be necessarily the visible width of the column since the column can expand.
int etk_tree_col_width_get (Etk_Tree_Col *col)
 Gets the width of the column. TODO: (what if the col expands??).
void etk_tree_col_min_width_set (Etk_Tree_Col *col, int min_width)
 Sets the minimum width of the column. The column can not be smaller than this width.
int etk_tree_col_min_width_get (Etk_Tree_Col *col)
 Gets the minimum width of the column.
void etk_tree_col_resizable_set (Etk_Tree_Col *col, Etk_Bool resizable)
 Sets whether the column can be resized by the user.
Etk_Bool etk_tree_col_resizable_get (Etk_Tree_Col *col)
 Gets whether the column can be resized by the user.
void etk_tree_col_expand_set (Etk_Tree_Col *col, Etk_Bool expand)
 Sets whether the column should expand if there is some free space in the tree.
Etk_Bool etk_tree_col_expand_get (Etk_Tree_Col *col)
 Gets whether the column expands.
void etk_tree_col_alignment_set (Etk_Tree_Col *col, float alignment)
 Sets the horizontal alignment of the objects inside the column.
float etk_tree_col_alignment_get (Etk_Tree_Col *col)
 Gets the horizontal alignment of the objects inside the column.
void etk_tree_col_visible_set (Etk_Tree_Col *col, Etk_Bool visible)
 Sets whether or not the column is visible.
Etk_Bool etk_tree_col_visible_get (Etk_Tree_Col *col)
 Gets whether or not the column is visible.
void etk_tree_col_position_set (Etk_Tree_Col *col, int position)
 Changes the position of the column.
int etk_tree_col_position_get (Etk_Tree_Col *col)
 Gets the position of the column (0 is the first column on the left of the tree, "etk_tree_num_cols_get(tree) - 1" is the last one on the right).
void etk_tree_col_sort_set (Etk_Tree_Col *col, int(*compare_cb)(Etk_Tree_Col *col, Etk_Tree_Row *row1, Etk_Tree_Row *row2, void *data), void *data)
 Sets the sorting function of a column. This function will be called when the header of the column is clicked or when you call etk_tree_col_sort().
Etk_Tree_Row * etk_tree_row_prepend (Etk_Tree *tree, Etk_Tree_Row *parent,...)
Etk_Tree_Row * etk_tree_row_append (Etk_Tree *tree, Etk_Tree_Row *parent,...)
Etk_Tree_Row * etk_tree_row_insert (Etk_Tree *tree, Etk_Tree_Row *parent, Etk_Tree_Row *after,...)
 Inserts a new row after an existing row.
Etk_Tree_Row * etk_tree_row_insert_valist (Etk_Tree *tree, Etk_Tree_Row *parent, Etk_Tree_Row *after, va_list args)
 Inserts a new row after an existing row.
void etk_tree_row_delete (Etk_Tree_Row *row)
 Deletes an existing row and all its children. Note that the row will just be marked as deleted. It will be effectively deleted only during the next iteration of Ecore's main loop. Thus, you can still manipulate safely a row marked as deleted.
void etk_tree_clear (Etk_Tree *tree)
 Deletes all the rows of the tree. Note that the rows will just be marked as deleted. They will be effectively deleted during the next iteration of Ecore's main loop. Thus, you can still manipulate safely the rows immediately after a clear.
void etk_tree_row_fields_set (Etk_Tree_Row *row, Etk_Bool emit_signal,...)
 Sets the values of the cells of the row.
void etk_tree_row_fields_set_valist (Etk_Tree_Row *row, Etk_Bool emit_signal, va_list args)
 Sets the values of the cells of the row.
void etk_tree_row_fields_get (Etk_Tree_Row *row,...)
 Gets the values of the cells of the row.
void etk_tree_row_fields_get_valist (Etk_Tree_Row *row, va_list args)
 Gets the values of the cells of the row.
void etk_tree_row_model_fields_set (Etk_Tree_Row *row, Etk_Bool emit_signal,...)
 Sets the values of the models of the row.
void etk_tree_row_model_fields_set_valist (Etk_Tree_Row *row, Etk_Bool emit_signal, va_list args)
 Sets the values of the models of the row.
void etk_tree_row_model_fields_get (Etk_Tree_Row *row,...)
 Gets the values of the models of the row.
void etk_tree_row_model_fields_get_valist (Etk_Tree_Row *row, va_list args)
 Gets the values of the models of the row.
void etk_tree_row_data_set (Etk_Tree_Row *row, void *data)
 Sets the user data associated to the row. The data could be retrieved later with etk_tree_row_data_get().
void etk_tree_row_data_set_full (Etk_Tree_Row *row, void *data, void(*free_cb)(void *data))
 Sets the user data associated to the row. The data could be retrieved later with etk_tree_row_data_get(). You can also set a function to call to free automatically the data when the row is deleted.
void * etk_tree_row_data_get (Etk_Tree_Row *row)
 Gets the user data associated to the row (previously set with etk_tree_row_data_set()).
Etk_Tree_Row * etk_tree_selected_row_get (Etk_Tree *tree)
 Gets the row that was selected at last.
void etk_tree_select_all (Etk_Tree *tree)
 Selects all the rows of the tree.
void etk_tree_unselect_all (Etk_Tree *tree)
 Unselects all the rows of the tree.
void etk_tree_row_select (Etk_Tree_Row *row)
 Selects a row of the tree.
void etk_tree_row_unselect (Etk_Tree_Row *row)
 Unselects a row of the tree.
Etk_Bool etk_tree_row_is_selected (Etk_Tree_Row *row)
 Gets whether or not the row is selected.
void etk_tree_row_fold (Etk_Tree_Row *row)
 Folds a row of the tree: if the tree is in the "tree" mode, the children of the row won't be visible anymore.
void etk_tree_row_unfold (Etk_Tree_Row *row)
 Unfolds a row of the tree: if the tree is in the "tree" mode, the children of the row will be visible.
Etk_Bool etk_tree_row_is_folded (Etk_Tree_Row *row)
 Gets whether the row is folded or not.
Etk_Tree_Row * etk_tree_first_row_get (Etk_Tree *tree)
 Gets the first row of the tree.
Etk_Tree_Row * etk_tree_last_row_get (Etk_Tree *tree)
 Gets the last row of the tree.
Etk_Tree_Row * etk_tree_row_parent_get (Etk_Tree_Row *row)
 Gets the parent row of the specified row.
Etk_Tree_Row * etk_tree_row_first_child_get (Etk_Tree_Row *row)
 Gets the first child of the specified row.
Etk_Tree_Row * etk_tree_row_last_child_get (Etk_Tree_Row *row)
 Gets the last child of the specified row.
Etk_Tree_Row * etk_tree_row_prev_get (Etk_Tree_Row *row)
 Gets the previous row before the specified row.
Etk_Tree_Row * etk_tree_row_next_get (Etk_Tree_Row *row)
 Gets the next row after the specified row.
Etk_Tree_Row * etk_tree_row_walk_prev (Etk_Tree_Row *row, Etk_Bool include_folded)
 Walks to the previous "visible" row. Unlike etk_tree_row_prev_get(), etk_tree_row_walk_prev() can return a row that is not on the same level as the specified row. It is useful if you want to walk easily through all the rows of the tree.
Etk_Tree_Row * etk_tree_row_walk_next (Etk_Tree_Row *row, Etk_Bool include_folded)
 Walks to the next "visible" row. Unlike etk_tree_row_next_get(), etk_tree_row_walk_next() can return a row that is not on the same level as the specified row. It is useful if you want to walk easily through all the rows of the tree.
Etk_Tree * etk_tree_row_tree_get (Etk_Tree_Row *row)
 Gets the tree which contains the given row.
Etk_Scrolled_View * etk_tree_scrolled_view_get (Etk_Tree *tree)
 Gets the scrolled view of the tree. It can be used to change the scrollbars' policy, or to get the scroll-value.
void etk_tree_row_scroll_to (Etk_Tree_Row *row, Etk_Bool center)
 Scrolls to the given row of the tree, in order to make it visible.