|
|
|
NavigationPersonal tools |
EWL Tree2 ThoughtsThis website is deprecated!
Please refer and move articles to: http://trac.enlightenment.org/e/wiki/ [edit] Roadmap to TreeThe list of things to be completed before we do the Ewl_Tree2 -> Ewl_Tree conversion
[edit] Example API
#include <Ewl.h>
void *example_data_new(void);
/* model calls */
void *example_cb_data_fetch(void *data, unsigned int row, unsigned int column);
unsigned int example_cb_data_count(void *data);
int example_cb_column_sortable(void *data, unsigned int column);
void example_cb_data_sort(void *data, unsigned int column, Ewl_Sort_Direction dir);
void example_cb_data_fetch_result_free(void *data, unsigned int column);
void *example_cb_data_header_fetch(void *data, unsigned int column);
int example_cb_data_expandable_get(void *data, unsigned int row);
void *example_cb_expansion_data_fetch(void *data, unsigned int row);
Ewl_Model *example_cb_expansion_model_fetch(void *data, unsigned int row);
/* view calls */
Ewl_Widget *example_cb_widget_fetch(void *data, unsigned int row, unsigned int column);
Ewl_Widget *example_cb_header_fetch(void *data, unsigned int column);
Ewl_View *example_cb_expansion_view_fetch(void *data, unsigned int row);
int
main(int argc, char ** argv)
{
Ewl_Model *model;
Ewl_View *view;
Ewl_Widget *win, *box, *tree;
ewl_init(&argc, argv);
win = ewl_window_new();
ewl_object_size_request(EWL_OBJECT(win), 400, 300);
ewl_widget_show(win);
box = ewl_hbox_new();
ewl_container_child_append(EWL_CONTAINER(win), box);
ewl_widget_show(box);
model = ewl_model_new();
ewl_model_data_fetch_set(model, example_cb_data_fetch);
ewl_model_data_count_set(model, example_cb_data_count);
ewl_model_column_sortable_set(model, example_cb_column_sortable);
ewl_model_data_sort_set(model, example_cb_data_sort);
ewl_model_data_fetch_result_free_set(model, example_cb_data_fetch_result_free);
ewl_model_data_header_fetch_set(model, example_cb_data_header_fetch);
ewl_model_data_expandable_set(model, example_cb_data_expandable_get);
ewl_model_expansion_data_fetch_set(model, example_cb_expansion_data_fetch);
ewl_model_expansion_model_fetch_set(model, example_cb_expansion_model_fetch);
view = ewl_view_new();
ewl_view_widget_fetch_set(view, example_cb_widget_fetch);
ewl_view_header_fetch_set(view, example_cb_header_fetch);
ewl_view_expansion_view_fetch_set(view, example_cb_expansion_view_fetch);
tree = ewl_tree2_new();
ewl_mvc_data_set(tree, example_data_new());
ewl_mvc_model_set(tree, model);
ewl_mvc_view_set(tree, view);
/* create a new func to allow setting the type of content view the tree
* is using */
ewl_tree2_content_view_set(EWL_TREE2(tree),
ewl_tree2_view_scrolled_get());
ewl_container_child_append(EWL_CONTAINER(box), tree);
ewl_widget_show(tree);
ewl_main();
return 0;
}
void *
example_data_new(void)
{
return NULL;
}
/*
* Model Callbacks
*/
void *
example_cb_data_fetch(void *data, unsigned int row, unsigned int column)
{
}
unsigned int
example_cb_data_count(void *data)
{
}
int
example_cb_column_sortable(void *data, unsigned int column)
{
}
void
example_cb_data_sort(void *data, unsigned int column, Ewl_Sort_Direction dir)
{
}
void
example_cb_data_fetch_result_free(void *data, unsigned int column)
{
}
void *
example_cb_data_header_fetch(void *data, unsigned int column)
{
}
int
example_cb_data_expandable_get(void *data, unsigned int row)
{
}
void *
example_cb_expansion_data_fetch(void *data, unsigned int row)
{
}
Ewl_Model *
example_cb_expansion_model_fetch(void *data, unsigned int row)
{
}
/*
* View Callbacks
*/
Ewl_Widget *
example_cb_widget_fetch(void *data, unsigned int row, unsigned int column)
{
}
Ewl_Widget *
example_cb_header_fetch(void *data, int column)
{
}
Ewl_View *
example_cb_expansion_view_fetch(void *data, unsigned int row)
{
}
|