 |
 |
 |
 |
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
- "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_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()) |
#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
Gets the mode of tree.
- Parameters:
-
- Returns:
- Returns the mode of tree (ETK_TREE_MODE_LIST or ETK_TREE_MODE_TREE)
References ETK_TREE_MODE_LIST, and mode.
void etk_tree_multiple_select_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
multiple_select | |
|
) |
| | |
Etk_Bool etk_tree_multiple_select_get |
( |
Etk_Tree * |
tree |
) |
|
void etk_tree_headers_visible_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
headers_visible | |
|
) |
| | |
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
References headers_visible.
void etk_tree_column_separators_visible_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
col_separators_visible | |
|
) |
| | |
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
References col_separators_visible.
void etk_tree_alternating_row_colors_set |
( |
Etk_Tree * |
tree, |
|
|
Etk_Bool |
alternating_row_colors | |
|
) |
| | |
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
References alternating_row_colors.
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 |
References ETK_MAX, ETK_OBJECT, etk_object_notify(), etk_range_increments_set(), ETK_SCROLLED_VIEW, etk_scrolled_view_vscrollbar_get(), etk_signal_emit(), ETK_WIDGET, etk_widget_redraw_queue(), rows_height, scroll_content, and scrolled_view.
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
References rows_height.
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:
-
References built.
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()
References frozen.
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
References built, columns, ETK_BUTTON_TYPE, etk_object_new(), ETK_TREE_COL, ETK_TREE_COL_TYPE, ETK_WARNING, ETK_WIDGET, etk_widget_new(), etk_widget_parent_set(), Etk_Tree_Col::header, Etk_Tree_Col::id, num_cols, Etk_Tree_Col::position, scroll_content, Etk_Tree_Col::tree, and tree_contains_headers.
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
References num_cols.
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
References columns, and num_cols.
Gets the tree which contains the given column.
- Parameters:
-
- Returns:
- Returns the tree which contains the given column, or NULL on failure
References Etk_Tree_Col::tree.
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
References Etk_Tree_Col::header.
void etk_tree_col_title_set |
( |
Etk_Tree_Col * |
col, |
|
|
const char * |
title | |
|
) |
| | |
void etk_tree_col_width_set |
( |
Etk_Tree_Col * |
col, |
|
|
int |
width | |
|
) |
| | |
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.
References Etk_Tree_Col::width.
void etk_tree_col_min_width_set |
( |
Etk_Tree_Col * |
col, |
|
|
int |
min_width | |
|
) |
| | |
Gets the minimum width of the column.
- Parameters:
-
- Returns:
- Returns the minimum width of the column
References Etk_Tree_Col::min_width.
void etk_tree_col_resizable_set |
( |
Etk_Tree_Col * |
col, |
|
|
Etk_Bool |
resizable | |
|
) |
| | |
Gets whether the column can be resized by the user.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column is resizable
References Etk_Tree_Col::resizable.
void etk_tree_col_expand_set |
( |
Etk_Tree_Col * |
col, |
|
|
Etk_Bool |
expand | |
|
) |
| | |
Gets whether the column expands.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column expands, ETK_FALSE otherwise
References Etk_Tree_Col::expand.
void etk_tree_col_alignment_set |
( |
Etk_Tree_Col * |
col, |
|
|
float |
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)
References Etk_Tree_Col::align.
void etk_tree_col_visible_set |
( |
Etk_Tree_Col * |
col, |
|
|
Etk_Bool |
visible | |
|
) |
| | |
Gets whether or not the column is visible.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the column is visible
References Etk_Tree_Col::visible.
void etk_tree_col_position_set |
( |
Etk_Tree_Col * |
col, |
|
|
int |
position | |
|
) |
| | |
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
References Etk_Tree_Col::position.
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 |
References Etk_Tree_Col::compare_cb, Etk_Tree_Col::data, and 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.
- 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 |
References Etk_Tree_Col::compare_cb, Etk_Tree_Col::data, etk_tree_col_sort_full(), and Etk_Tree_Col::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 |
References etk_tree_row_walk_next(), ETK_WIDGET, etk_widget_redraw_queue(), Etk_Tree_Row::first_child, Etk_Tree_Row::last_child, Etk_Tree_Col::last_compare_cb, Etk_Tree_Row::parent, root, Etk_Tree_Col::sort, sorted_asc, sorted_col, and Etk_Tree_Col::tree.
Referenced by etk_tree_col_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
References etk_tree_row_insert_valist().
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
References etk_tree_row_insert_valist(), Etk_Tree_Row::last_child, and root.
Referenced by etk_filechooser_widget_current_folder_set().
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
References etk_tree_row_insert_valist().
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.
References Etk_Tree_Col::compare_cb, Etk_Tree_Col::data, etk_tree_row_insert_valist(), Etk_Tree_Row::first_child, Etk_Tree_Row::last_child, Etk_Tree_Row::next, Etk_Tree_Row::num_children, Etk_Tree_Row::prev, root, Etk_Tree_Col::sort, sorted_asc, and sorted_col.
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
References built, Etk_Tree_Model::cell_data_init, Etk_Tree_Model::cell_data_size, Etk_Tree_Row::cells_data, columns, Etk_Tree_Row::data, Etk_Tree_Row::data_free_cb, Etk_Tree_Row::delete_me, ETK_OBJECT, etk_signal_emit(), etk_tree_row_fields_set_valist(), ETK_WARNING, ETK_WIDGET, etk_widget_redraw_queue(), Etk_Tree_Row::first_child, frozen, Etk_Tree_Row::last_child, Etk_Tree_Col::models, Etk_Tree_Row::next, Etk_Tree_Row::num_children, num_cols, Etk_Tree_Col::num_models, Etk_Tree_Row::num_visible_children, Etk_Tree_Row::parent, Etk_Tree_Row::prev, root, scroll_content, Etk_Tree_Row::selected, sorted_col, total_rows, Etk_Tree_Row::tree, and Etk_Tree_Row::unfolded.
Referenced by etk_tree_row_append(), etk_tree_row_insert(), etk_tree_row_insert_sorted(), and etk_tree_row_prepend().
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 |
References etk_tree_row_fields_set_valist().
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 |
References Etk_Tree_Model::cell_data_set, Etk_Tree_Row::cells_data, ETK_OBJECT, etk_signal_emit(), ETK_WIDGET, etk_widget_redraw_queue(), frozen, Etk_Tree_Col::id, Etk_Tree_Col::models, Etk_Tree_Col::num_models, sorted_col, and Etk_Tree_Row::tree.
Referenced by etk_tree_row_fields_set(), and etk_tree_row_insert_valist().
void etk_tree_row_fields_get_valist |
( |
Etk_Tree_Row * |
row, |
|
|
va_list |
args | |
|
) |
| | |
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 |
References etk_tree_row_model_fields_set_valist().
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 |
References Etk_Tree_Model::cell_data_set, Etk_Tree_Row::cells_data, Etk_Tree_Model::col, ETK_OBJECT, etk_signal_emit(), ETK_WIDGET, etk_widget_redraw_queue(), frozen, Etk_Tree_Col::id, Etk_Tree_Model::index, and Etk_Tree_Row::tree.
Referenced by etk_tree_row_model_fields_set().
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 |
References etk_tree_row_model_fields_get_valist().
void etk_tree_row_model_fields_get_valist |
( |
Etk_Tree_Row * |
row, |
|
|
va_list |
args | |
|
) |
| | |
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);
References etk_tree_row_data_set_full().
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 |
References Etk_Tree_Row::data, and Etk_Tree_Row::data_free_cb.
Referenced by etk_tree_row_data_set().
void etk_tree_select_all |
( |
Etk_Tree * |
tree |
) |
|
void etk_tree_unselect_all |
( |
Etk_Tree * |
tree |
) |
|
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:
-
References ETK_OBJECT, etk_signal_emit(), ETK_TREE_MODE_TREE, ETK_WIDGET, etk_widget_redraw_queue(), frozen, mode, Etk_Tree_Row::num_visible_children, Etk_Tree_Row::parent, scroll_content, Etk_Tree_Row::tree, and Etk_Tree_Row::unfolded.
Unfolds a row of the tree: if the tree is in the "tree" mode, the children of the row will be visible.
- Parameters:
-
References ETK_OBJECT, etk_signal_emit(), ETK_TREE_MODE_TREE, ETK_WIDGET, etk_widget_redraw_queue(), Etk_Tree_Row::first_child, frozen, mode, Etk_Tree_Row::next, Etk_Tree_Row::num_visible_children, Etk_Tree_Row::parent, scroll_content, Etk_Tree_Row::tree, and Etk_Tree_Row::unfolded.
Gets whether the row is folded or not.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the row is folded, ETK_FALSE otherwise
References Etk_Tree_Row::unfolded.
Gets the last row of the tree.
- Parameters:
-
- Returns:
- Returns the last row of the tree, or NULL if the tree is empty
References Etk_Tree_Row::last_child, and root.
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
References Etk_Tree_Row::parent, root, and Etk_Tree_Row::tree.
Gets the first child of the specified row.
- Parameters:
-
- Returns:
- Returns the first child of the row
References Etk_Tree_Row::first_child.
Gets the last child of the specified row.
- Parameters:
-
- Returns:
- Returns the last child of the row
References Etk_Tree_Row::last_child.
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()
References Etk_Tree_Row::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()
References Etk_Tree_Row::next.
Referenced by etk_filechooser_widget_selected_files_get().
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)
References Etk_Tree_Row::first_child, Etk_Tree_Row::next, Etk_Tree_Row::parent, and Etk_Tree_Row::unfolded.
Referenced by etk_tree_col_sort_full(), etk_tree_row_get_at_xy(), etk_tree_row_scroll_to(), etk_tree_select_all(), and etk_tree_unselect_all().
Gets the tree which contains the given row.
- Parameters:
-
- Returns:
- Returns the tree which contains the given row, or NULL on failure
References Etk_Tree_Row::tree.
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
References ETK_INSIDE, etk_tree_first_row_get(), etk_tree_row_walk_next(), etk_widget_inner_geometry_get(), grid, rows_height, and scroll_y.
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
References ETK_SCROLLED_VIEW, and scrolled_view.
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 |
References etk_range_value_set(), ETK_SCROLLED_VIEW, etk_scrolled_view_vscrollbar_get(), etk_tree_first_row_get(), etk_tree_row_walk_next(), etk_widget_inner_geometry_get(), grid, rows_height, scroll_y, scrolled_view, and Etk_Tree_Row::tree.
|
 |
 |
 |
 |
|