|
|
|
|
Etk_Tree
Detailed Description
A tree is widget that displays rows of elements of different types (text, image, checkbox, etc), separated into columns.
- Object Hierarchy:
-
- Signals of Etk_Tree:
- "row-selected": Emitted when a row is selected
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has been selectedrow: the row that has been selecteddata: the user data set when the callback has been connected to the signal
- "row-unselected": Emitted when a row is unselected
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has been unselectedrow: the row that has been unselecteddata: the user data set when the callback has been connected to the signal
- "all-selected": Emitted when all the rows of a tree are selected with etk_tree_select_all()
Callback: Etk_Bool callback(Etk_Tree *tree, void *data)
tree: the tree whose all rows have been selecteddata: the user data set when the callback has been connected to the signal
- "all-unselected": Emitted when all the rows of a tree are unselected with etk_tree_unselect_all()
Callback: Etk_Bool callback(Etk_Tree *tree, void *data)
tree: the tree whose all rows have been unselecteddata: the user data set when the callback has been connected to the signal
- "row-clicked": Emitted when a row of the tree has been clicked
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, Etk_Event_Mouse_Up *event, void *data)
tree: the tree containing the row that has been clickedrow: the row that has been clickedevent: the event-structure corresponding to the click eventdata: the user data set when the callback has been connected to the signal
- "row-activated": Emitted when a row is double-clicked or when the user presses "space" on a selected row
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has been activatedrow: the row that has been activateddata: the user data set when the callback has been connected to the signal
- "row-unfolded": Emitted when a row is unfolded
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has been unfoldedrow: the row that has been unfoldeddata: the user data set when the callback has been connected to the signal
- "row-folded": Emitted when a row is folded
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has been foldedrow: the row that has been foldeddata: the user data set when the callback has been connected to the signal
- "row-shown": Emitted when a row becomes visible, i.e when the row enters in the tree's viewport
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has hecome visiblerow: the row that has hecome visibledata: the user data set when the callback has been connected to the signal
- "row-hidden": Emitted when a row becomes invisible, i.e when the row leaves in the tree's viewport
Callback: Etk_Bool callback(Etk_Tree *tree, Etk_Tree_Row *row, void *data)
tree: the tree containing the row that has hecome invisiblerow: the row that has hecome invisibledata: the user data set when the callback has been connected to the signal
- Properties of Etk_Tree:
- "mode": The current mode of the tree ("tree" or "list" mode)
Type: Integer (Etk_Tree_Mode)Access: Read/WriteDefault Value: ETK_TREE_MODE_LIST
- "multiple-select": Whether or not several rows of the tree can be selected
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "headers-visible": Whether or not the headers of the columns are visible
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "expanders-visible": Whether or not the row expanders are visible
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "depth-indent": The additional indent of child rows
Type: IntegerAccess: Read/WriteDefault Value: 0
- "column-separators-visible": Whether or not the columns are separated by a visible vertical separator
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "alternating-row-colors": Whether or not the row-colors alternate (e.g darker even rows)
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "rows-height": The height of the rows of the tree
Type: IntegerAccess: Read/WriteDefault Value: 24
- Signals of Etk_Tree_Col:
- "cell-value-changed": Emitted when the value of a cell of the column is changed
Callback: Etk_Bool callback(Etk_Tree_Col *col, Etk_Tree_Row *row, void *data)
col: the column containing the cell whose value has been changedrow: the row containing the cell whose value has been changeddata: the user data set when the callback has been connected to the signal
- Properties of Etk_Tree_Col:
- "title": The title of the column
Type: String (char *)Access: Read/WriteDefault Value: NULL
- "visible": Whether or not the column is visible
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "resizable": Whether or not the column can be resized by the user
Type: BooleanAccess: Read/WriteDefault Value: ETK_TRUE
- "position": The position of the column inside the tree (between 0 and (num_cols - 1))
Type: IntegerAccess: Read/WriteDefault Value: 0
- "expand": Whether the column should expand to take up all available width
Type: BooleanAccess: Read/WriteDefault Value: ETK_FALSE
- "width": The current width of the column
Type: BooleanAccess: Read/WriteDefault Value: 24
- "min-width": The minimum width of the column
Type: BooleanAccess: Read/WriteDefault Value: 24
- "align": The horizontal alignment of the objects inside the cells of the column, from 0.0 (left) to 1.0 (right)
Type: FloatAccess: Read/WriteDefault Value: 0.0
|
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_expanders_visible_set (Etk_Tree *tree, Etk_Bool expanders_visible) |
| Sets whether the row expanders should be visible or not. Default indentation will also be disabled, if expanders are not visible. To add custom depth indentation, etk_tree_depth_indent_set can be used().
|
Etk_Bool | etk_tree_expanders_visible_get (Etk_Tree *tree) |
| Gets whether or not the row expanders are visible.
|
void | etk_tree_depth_indent_set (Etk_Tree *tree, Etk_Bool depth_indent) |
| Adds additional indentation per depth. Does not affect indentation of first-level rows.
|
Etk_Bool | etk_tree_depth_indent_get (Etk_Tree *tree) |
| Gets the amount of additional indent, in pixels, of child rows.
|
void | etk_tree_column_separators_visible_set (Etk_Tree *tree, Etk_Bool col_separators_visible) |
| Sets whether the columns should be separated by a visible vertical separator.
|
Etk_Bool | etk_tree_column_separators_visible_get (Etk_Tree *tree) |
| Gets whether or not the columns are separated by a visible vertical separator.
|
void | etk_tree_alternating_row_colors_set (Etk_Tree *tree, Etk_Bool alternating_row_colors) |
| Sets whether the row-colors alternate (e.g. the odd rows are darker than the even rows).
|
Etk_Bool | etk_tree_alternating_row_colors_get (Etk_Tree *tree) |
| Gets whether the row-colors of the tree alternate.
|
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.
|
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().
|
void | etk_tree_col_sort (Etk_Tree_Col *col, Etk_Bool ascending) |
| Sorts the rows of the tree according to the comparison function of the given column. You can set the comparison function with etk_tree_col_sort_set(). If no comparison function is associated to the column, this function will have no effect.
|
void | etk_tree_col_sort_full (Etk_Tree_Col *col, int(*compare_cb)(Etk_Tree_Col *col, Etk_Tree_Row *row1, Etk_Tree_Row *row2, void *data), void *data, Etk_Bool ascending) |
| Sorts the rows of the tree according to the given comparison function.
|
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_sorted (Etk_Tree *tree, Etk_Tree_Row *parent,...) |
| Insert a new row in a sorted column at the right place.
|
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_Tree_Row * | etk_tree_row_get_at_xy (Etk_Tree *tree, int x, int y) |
| Gets the row that is at the absolute position ( x, y ).
|
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.
|
Define Documentation
#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()) |
Gets the type of a tree column
#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)) |
Enumeration Type Documentation
The different modes of the tree: List (rows can not have children) or tree (rows can have children).
- Enumerator:
-
ETK_TREE_MODE_LIST |
The rows of a list can not have children (the rows can not be folded/unfolded) |
ETK_TREE_MODE_TREE |
The rows of a tree can have children |
Function Documentation
Creates a new tree.
- Returns:
- Returns the new tree
Sets the mode of the tree. The tree must not be built.
- Parameters:
-
| tree | a tree |
| mode | the mode the tree should use (ETK_TREE_MODE_LIST or ETK_TREE_MODE_TREE) |
Gets the mode of tree.
- Parameters:
-
- Returns:
- Returns the mode of tree (ETK_TREE_MODE_LIST or ETK_TREE_MODE_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.
- Parameters:
-
| tree | a tree |
| multiple_select | ETK_TRUE to allow the user to select several rows, ETK_FALSE otherwise |
Etk_Bool etk_tree_multiple_select_get |
( |
Etk_Tree * |
tree |
) |
|
Gets whether or not several rows can be selected in the tree.
- Parameters:
-
- Returns:
- ETK_TRUE if several rows can be selected, ETK_FALSE otherwise
void etk_tree_headers_visible_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
headers_visible | |
|
) |
| | |
Sets whether the column-headers should be visible or not.
- Parameters:
-
| tree | a tree |
| headers_visible | ETK_TRUE to show the column-headers, ETK_FALSE to hide them |
Etk_Bool etk_tree_headers_visible_get |
( |
Etk_Tree * |
tree |
) |
|
Gets whether or not the column-headers are visible.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column-headers are visible, ETK_FALSE otherwise
void etk_tree_expanders_visible_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
expanders_visible | |
|
) |
| | |
Sets whether the row expanders should be visible or not. Default indentation will also be disabled, if expanders are not visible. To add custom depth indentation, etk_tree_depth_indent_set can be used().
- Parameters:
-
| tree | a tree |
| expanders_visible | ETK_TRUE to show the row expanders, ETK_FALSE to hide them |
- See also:
- etk_tree_depth_indent_set()
Etk_Bool etk_tree_expanders_visible_get |
( |
Etk_Tree * |
tree |
) |
|
Gets whether or not the row expanders are visible.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the row expanders are visible, ETK_FALSE otherwise
void etk_tree_depth_indent_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
depth_indent | |
|
) |
| | |
Adds additional indentation per depth. Does not affect indentation of first-level rows.
- Parameters:
-
| tree | a tree |
| indent_level | ETK_TRUE to show the row expanders, ETK_FALSE to hide them |
Etk_Bool etk_tree_depth_indent_get |
( |
Etk_Tree * |
tree |
) |
|
Gets the amount of additional indent, in pixels, of child rows.
- Parameters:
-
- Returns:
- Returns the amount of indentation in pixels
void etk_tree_column_separators_visible_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
col_separators_visible | |
|
) |
| | |
Sets whether the columns should be separated by a visible vertical separator.
- Parameters:
-
| tree | a tree |
| col_separators_visible | ETK_TRUE to show the vertical separators, ETK_FALSE to hide them |
Etk_Bool etk_tree_column_separators_visible_get |
( |
Etk_Tree * |
tree |
) |
|
Gets whether or not the columns are separated by a visible vertical separator.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the vertical separators are shown, ETK_FALSE otherwise
void etk_tree_alternating_row_colors_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
alternating_row_colors | |
|
) |
| | |
Sets whether the row-colors alternate (e.g. the odd rows are darker than the even rows).
- Parameters:
-
| tree | a tree |
| alternating_row_colors | ETK_TRUE to make the row-colors alternate, ETK_FALSE otherwise |
Etk_Bool etk_tree_alternating_row_colors_get |
( |
Etk_Tree * |
tree |
) |
|
Gets whether the row-colors of the tree alternate.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the row-colors alternate, ETK_FALSE otherwise
void etk_tree_rows_height_set |
( |
Etk_Tree * |
tree, |
|
|
int |
rows_height | |
|
) |
| | |
Sets the height of the rows of the tree.
- Parameters:
-
| tree | a tree |
| rows_height | the rows height to set. The minimum value is 12 |
int etk_tree_rows_height_get |
( |
Etk_Tree * |
tree |
) |
|
Gets the height of the rows of the tree.
- Parameters:
-
- Returns:
- Returns the height of the rows of the 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.
- Parameters:
-
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.
- Parameters:
-
- See also:
- etk_tree_thaw()
Thaws the tree: the tree will be updated the tree if it was frozen.
- Parameters:
-
- See also:
- etk_tree_freeze()
Inserts a new column into a tree.
- Parameters:
-
| tree | a tree |
| title | the tile of the column |
| width | the requested width of the column. It won't be necessary the visible width of the column since it can be expanded to fit the available space |
| alignment | the horizontal alignment of the objects inside the column, from 0.0 (left alignment) to 1.0 (right alignment) |
- Returns:
- Returns the new column
int etk_tree_num_cols_get |
( |
Etk_Tree * |
tree |
) |
|
Gets the number of columns of the tree.
- Parameters:
-
- Returns:
- Returns the number of columns of the tree
Gets the "nth" column of the tree.
- Parameters:
-
| tree | a tree |
| nth | the index of the column to get. Since the columns can be reordered or hidden, nth corresponds to the "nth" created column, which is not necessarily the "nth" visible column |
- Returns:
- Returns the "nth" column of the tree
Gets the tree which contains the given column.
- Parameters:
-
- Returns:
- Returns the tree which contains the given column, or NULL on failure
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.
- Parameters:
-
| col | a column |
| model | the model to add to the column col |
- Warning:
- the number of models per column is limited to 5
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.
- Parameters:
-
- Returns:
- Returns the column's header widget
void etk_tree_col_title_set |
( |
Etk_Tree_Col * |
col, |
|
|
const char * |
title | |
|
) |
| | |
Sets the title of the column.
- Parameters:
-
| col | a column of a tree |
| title | the title to set |
Gets the title of the column.
- Parameters:
-
- Returns:
- Returns 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.
- Parameters:
-
| col | a column of a tree |
| width | the width to set |
Gets the width of the column.
- Parameters:
-
- Returns:
- Returns the width of the column
- Note:
- This function doesn't take into account the extra-width if the column 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.
- Parameters:
-
| col | a column of a tree |
| min_width | the minimum width to set. -1 to use the default value |
Gets the minimum width of the column.
- Parameters:
-
- Returns:
- Returns 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.
- Parameters:
-
| col | a column of a tree |
| resizable | ETK_TRUE to make the column resizable, ETK_FALSE otherwise |
Gets whether the column can be resized by the user.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column is resizable
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.
- Parameters:
-
| col | a column of a tree |
| expand | ETK_TRUE to make the column expand, ETK_FALSE otherwise |
Gets whether the column expands.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column expands, ETK_FALSE otherwise
void etk_tree_col_alignment_set |
( |
Etk_Tree_Col * |
col, |
|
|
float |
alignment | |
|
) |
| | |
Sets the horizontal alignment of the objects inside the column.
- Parameters:
-
| col | a column of a tree |
| alignment | the horizontal alignment to use, from 0.0 (left alignment) to 1.0 (right alignment) |
Gets the horizontal alignment of the objects inside the column.
- Parameters:
-
- Returns:
- Returns the horizontal alignment of the column, from 0.0 (left alignment) to 1.0 (right alignment)
void etk_tree_col_visible_set |
( |
Etk_Tree_Col * |
col, |
|
|
Etk_Bool |
visible | |
|
) |
| | |
Sets whether or not the column is visible.
- Parameters:
-
| col | a column of a tree |
| visible | ETK_TRUE to show the column, ETK_FALSE to hide it |
Gets whether or not the column is visible.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column is visible
void etk_tree_col_position_set |
( |
Etk_Tree_Col * |
col, |
|
|
int |
position | |
|
) |
| | |
Changes the position of the column.
- Parameters:
-
| col | a column of a tree |
| position | the new position the column should take (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) |
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).
- Parameters:
-
- Returns:
- Returns the position of the column
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().
- Parameters:
-
| col | a column of a tree |
| compare_cb | the function to call to compare two rows. It should return a negative value if the cell of "row1" has a lower value than the cell of "row2", 0 if they have the same value, and a positive value if the cell of "row2" has a greater value than the cell of "row1" |
| data | a pointer that will be passed to compare_cb when it is called |
void etk_tree_col_sort |
( |
Etk_Tree_Col * |
col, |
|
|
Etk_Bool |
ascending | |
|
) |
| | |
Sorts the rows of the tree according to the comparison function of the given column. You can set the comparison function with etk_tree_col_sort_set(). If no comparison function is associated to the column, this function will have no effect.
- Parameters:
-
| col | the column according to which the tree's rows should be sorted |
| ascending | Etk_True to perform an ascendant sort, ETK_FALSE to perform a descendant sort |
Sorts the rows of the tree according to the given comparison function.
- Parameters:
-
| col | the column that will be passed to compare_cb when it is called |
| compare_cb | the function to call to compare two rows. It should return a negative value if the cell of "row1" has a lower value than the cell of "row2", 0 if they have the same value, and a positive value if the cell of "row1" has a greater value than the cell of "row2" |
| data | a pointer that will be passed to compare_cb when it is called |
| ascending | Etk_True to perform an ascendant sort, ETK_FALSE to perform a descendant sort |
Inserts a new row at the beginning of the tree (if parent is NULL) or as the first child of an existing row (if parent is not NULL and if the tree is in the "tree" mode) - Parameters:
-
| tree | a tree |
| parent | the parent row of the row to insert. NULL means the row will be inserted at the tree's root |
| ... | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the model used by the column, a cell value can use several parameters |
- Returns:
- Returns the new row, or NULL on failure
Inserts a new row at the end of the tree (if parent is NULL) or as the last child of an existing row (if parent is not NULL and if the tree is in the "tree" mode) - Parameters:
-
| tree | a tree |
| parent | the parent row of the row to insert. NULL means the row will be inserted at the tree's root |
| ... | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the model used by the column, a cell value can use several parameters |
- Returns:
- Returns the new row, or NULL on failure
Inserts a new row after an existing row.
- Parameters:
-
| tree | a tree |
| parent | the parent row of the row to insert. If after is not NULL, parent is optionnal (the parent of the new row will be the parent of after) |
| after | the row after which the new row will be inserted. NULL means the new row will be inserted at the beginning of the tree (if parent is NULL) or as the first child of parent (if parent is not NULL and if the tree is in the "tree" mode) |
| ... | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the model used by the column, a cell value can use several parameters |
- Returns:
- Returns the new row, or NULL on failure
Insert a new row in a sorted column at the right place.
- Parameters:
-
| tree | a tree |
| parent | the parent row of the row to insert. If after is not NULL, parent is optionnal (the parent of the new row will be the parent of after) |
| ... | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the model used by the column, a cell value can use several parameters |
- Returns:
- Returns the new row, or NULL on failure
- Warning:
- It will only work if the tree is already sorted.
Inserts a new row after an existing row.
- Parameters:
-
| tree | a tree |
| parent | the parent row of the row to insert. If after is not NULL, parent is optionnal (the parent of the new row will be the parent of after) |
| after | the row after which the new row will be inserted. NULL means the new row will be inserted at the beginning of the tree (if parent is NULL) or as the first child of parent (if parent is not NULL and if the tree is in the "tree" mode) |
| args | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the model used by the column, a cell value can use several parameters |
- Returns:
- Returns the new row, or NULL on failure
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.
- Parameters:
-
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.
- Parameters:
-
| row | a row of the tree |
| emit_signal | whether or not the "cell-value-changed" signal should be emitted on the modified columns. Most of the time, the signal don't need to be emitted (so emit_signal should be ETK_FALSE), except if you have a callback connected on this signal |
| ... | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the models used by the column, a cell value can use several parameters |
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.
- Parameters:
-
| row | a row of the tree |
| emit_signal | whether or not the "cell-value-changed" signal should be emitted on the modified columns. Most of the time, the signal don't need to be emitted (so emit_signal should be ETK_FALSE), except if you have a callback connected on this signal |
| args | an "Etk_Tree_Col *" followed by the value of the cell, then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL. Note that, according to the models used by the column, a cell value can use several parameters |
Gets the values of the cells of the row.
- Parameters:
-
| row | a row of the tree |
| ... | an "Etk_Tree_Col *" followed by the location where to store the value of the cell, then any number of "Etk_Tree_Col *"/Location pairs, and terminated by NULL. Note that some models may require several locations to store the cell value |
void etk_tree_row_fields_get_valist |
( |
Etk_Tree_Row * |
row, |
|
|
va_list |
args | |
|
) |
| | |
Gets the values of the cells of the row.
- Parameters:
-
| row | a row of the tree |
| args | an "Etk_Tree_Col *" followed by the location where to store the value of the cell, then any number of "Etk_Tree_Col *"/Location pairs, and terminated by NULL. Note that some models may require several locations to store the cell value |
void etk_tree_row_model_fields_set |
( |
Etk_Tree_Row * |
row, |
|
|
Etk_Bool |
emit_signal, |
|
|
|
... | |
|
) |
| | |
Sets the values of the models of the row.
- Parameters:
-
| row | a row of the tree |
| emit_signal | whether or not the "cell-value-changed" signal should be emitted on the modified columns. Most of the time, the signal don't need to be emitted (so emit_signal should be ETK_FALSE), except if you have a callback connected on this signal |
| ... | an "Etk_Tree_Model *" followed by the value of the model, then any number of "Etk_Tree_Model *"/Value pairs, and terminated by NULL. Note that, according to the models, a cell value can use several parameters |
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.
- Parameters:
-
| row | a row of the tree |
| emit_signal | whether or not the "cell-value-changed" signal should be emitted on the modified columns. Most of the time, the signal don't need to be emitted (so emit_signal should be ETK_FALSE), except if you have a callback connected on this signal |
| args | an "Etk_Tree_Model *" followed by the value of the model, then any number of "Etk_Tree_Model *"/Value pairs, and terminated by NULL. Note that, according to the models, a cell value can use several parameters |
void etk_tree_row_model_fields_get |
( |
Etk_Tree_Row * |
row, |
|
|
|
... | |
|
) |
| | |
Gets the values of the models of the row.
- Parameters:
-
| row | a row of the tree |
| ... | an "Etk_Tree_Model *" followed by the location where to store the value of this model, then any number of "Etk_Tree_Model *"/Location pairs, and terminated by NULL. Note that some models may require several locations to store their value |
void etk_tree_row_model_fields_get_valist |
( |
Etk_Tree_Row * |
row, |
|
|
va_list |
args | |
|
) |
| | |
Gets the values of the models of the row.
- Parameters:
-
| row | a row of the tree |
| args | an "Etk_Tree_Model *" followed by the location where to store the value of this model, then any number of "Etk_Tree_Model *"/Location pairs, and terminated by NULL. Note that some models may require several locations to store their value |
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().
- Parameters:
-
| row | a row of the tree |
| data | the data to associate to the row |
- Note:
- This is equivalent to etk_tree_row_data_set_full(row, data, NULL);
void etk_tree_row_data_set_full |
( |
Etk_Tree_Row * |
row, |
|
|
void * |
data, |
|
|
void(*)(void *data) |
free_cb | |
|
) |
| | |
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.
- Parameters:
-
| row | a row of the tree |
| data | the data to associate to the row |
| free_cb | a function to call to free the data automatically when the row is deleted |
Gets the user data associated to the row (previously set with etk_tree_row_data_set()).
- Parameters:
-
- Returns:
- Returns the user data associated to the row
Gets the row that was selected at last.
- Parameters:
-
- Returns:
- Returns the row that was selected at last, or NULL if no row is selected
- Note:
- If you want to get all the selected rows (if multiple-selection is enabled), you have to walk through all the rows, and see if they are selected with etk_tree_row_is_selected()
void etk_tree_select_all |
( |
Etk_Tree * |
tree |
) |
|
Selects all the rows of the tree.
- Parameters:
-
- Note:
- When you call etk_tree_select_all(), for performance reasons, the signal "row-selected" is not emitted for each row of the tree. Only the signal "all-selected" is emitted on the tree.
void etk_tree_unselect_all |
( |
Etk_Tree * |
tree |
) |
|
Unselects all the rows of the tree.
- Parameters:
-
- Note:
- When you call etk_tree_unselect_all(), for performance reasons, the signal "row-unselected" is not emitted for each row of the tree. Only the signal "all-unselected" is emitted on the tree.
Selects a row of the tree.
- Parameters:
-
Unselects a row of the tree.
- Parameters:
-
Gets whether or not the row is selected.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the row is selected, ETK_FALSE otherwise
Folds a row of the tree: if the tree is in the "tree" mode, the children of the row won't be visible anymore.
- Parameters:
-
Unfolds a row of the tree: if the tree is in the "tree" mode, the children of the row will be visible.
- Parameters:
-
Gets whether the row is folded or not.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the row is folded, ETK_FALSE otherwise
Gets the first row of the tree.
- Parameters:
-
- Returns:
- Returns the first row of the tree, or NULL if the tree is empty
Gets the last row of the tree.
- Parameters:
-
- Returns:
- Returns the last row of the tree, or NULL if the tree is empty
Gets the parent row of the specified row.
- Parameters:
-
- Returns:
- Returns the parent row of the specified row, or NULL if the row is at the tree's root
Gets the first child of the specified row.
- Parameters:
-
- Returns:
- Returns the first child of the row
Gets the last child of the specified row.
- Parameters:
-
- Returns:
- Returns the last child of the row
Gets the previous row before the specified row.
- Parameters:
-
- Returns:
- Returns the previous row before the specified row, or NULL if the row is the first row of its parent
- Note:
- This function does not return the previous visible row, but only the previous row that is on the same level as the specified row. So if some rows of the tree have children, you'll have to use etk_tree_row_walk_prev() if you want to walk through all the rows of the tree.
- See also:
- etk_tree_row_walk_prev()
Gets the next row after the specified row.
- Parameters:
-
- Returns:
- Returns the next row after the specified row, or NULL if the row is the last row of its parent
- Note:
- This function does not return the next visible row, but only the next row that is on the same level as the specified row. So if some rows of the tree have children, you'll have to use etk_tree_row_walk_next() if you want to walk through all the rows of the tree.
- See also:
- etk_tree_row_walk_next()
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.
- Parameters:
-
| row | a row |
| include_folded | if include_folded is ETK_TRUE, the function will return a row, even if this row is a child of a folded row |
- Returns:
- Returns the previous "visible" row
- Note:
- if the tree is in the list mode, this is equivalent to etk_tree_row_prev_get(row)
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.
- Parameters:
-
| row | a row |
| include_folded | if include_folded is ETK_TRUE, the function will return a row, even if this row is a child of a folded row |
- Returns:
- Returns the next "visible" row
- Note:
- if the tree is in the list mode, this is equivalent to etk_tree_row_next_get(row)
Gets the tree which contains the given row.
- Parameters:
-
- Returns:
- Returns the tree which contains the given row, or NULL on failure
Gets the row that is at the absolute position ( x, y ).
- Parameters:
-
| tree | a tree |
| x | the x component of the position, relative to the canvas' top-left corner |
| y | the y component of the position, relative to the canvas' top-left corner |
- Returns:
- Returns the row of the tree that is at the given position, or NULL if there is no row here
Gets the scrolled view of the tree. It can be used to change the scrollbars' policy, or to get the scroll-value.
- Parameters:
-
- Returns:
- Returns the scrolled view of the tree
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.
- Parameters:
-
| row | the row to scroll to |
| center | whether or not the row should be centered in the view |
|
|
|
|
|
|