I sent this to the e mailing list a little while ago, but thought I’d stick it here so I’d be able to find it easier (and maybe someone who isn’t on the e mailing list might want to read it).
Some information on how we are implementing the ewl_combo, ewl_tree2 and (hopefully) soon to be ewl_list.
These widgets all work off of a Model/View/Controller setup. You create a model, a view and your data and set it into the widget. The widget will then query the model and view to get the display widgets, passing your data into the calls as needed.
The models, views and data can be reused between multiple widgets. For example, the combo test currently has two combo boxes with one model, one set of data and two views. (This will be enhanced with a third combo and another model/view.)
Using this setup it is a lot easier for the application to modify the data behind the combo or the tree and just tell the combo that its data is dirty. The combo then queries the model/view and updates its display as needed. No need to remove/append widgets to the combo/tree. You can just realloc an array and set ewl_combo_dirty_set(combo, TRUE) and it will do all the work of setting up the widgets for display.
This also means the combo/tree can have any kind of data as their widgets. You can write custom view functions to make compound widgets which should hopefully keep the system flexable.
The ewl_combo is the first widget to get this system up and running. We are working on the ewl_tree2 widget which will also be using the models and views. This will end up having a model/view per column of the tree so you can put different logic behind each column, or just pass the same model/view in to each column as needed.
The plan is to write an ewl_list which is a simple wrapper around ewl_tree that provides a default single column layout. Making it easier to get lists of things up on screen.
If you’d like to see a bit more of this take a look at the src/bin/tests/ewl_combo.c test case.
Thats about it for now, let me know if you’ve got any questions/ideas on this setup.