Support
Contribute
Contact
Tracker
Navigation
Personal tools
 

EWL Tree2 Thoughts

Roadmap to Tree

The list of things to be completed before we do the Ewl_Tree2 -> Ewl_Tree conversion

  • Redraw efficiency sucks
    • Need to define an mvc_dirty api to allow setting rows/ranges of rows as dirty
      • ewl_mvc_dirty_index_set(Ewl_MVC *mvc, unsigned int row);
      • ewl_mvc_dirty_range_set(Ewl_MVC *mvc, unsigned int start_row, unsigned int end_row);
  • Need to look at the ewl_tree2_column_count_set() call and see if there is a better way to do it.
    • At this point we have already coded the row/column pairs into the model, so I think it makes sense to split the data count callback into row and column count callbacks.
  • Need to base the expansion row colours off of the parent colour. This also involves updating the rows below the expansions parent with new colours (and possibly their expansion nodes) if needed.
  • Currently tree2 stores information on what nodes are expanded in a linked list that is stored in a hash key'd on the expansion points data value. This doesn't work if the data value is NULL. Need to find a new way to key this value.
  • Horizontal scrolling doesn't work. Always ends up scrolling the first column.
  • In tree2 test when switching from scrolled to unscrolled headers causing sizing bugs that get worked out on configure.

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)
{
}