I look at more specifically the "src/client/menu" code last weekend and i think i understand it sufficiently to know how to clean up; to allow next time the possibility to expand it. I propose only a code restructuration for the first time, because currently this code look to me very hard to maintain.
If you think you will continue to use your "menu" code, without changing it for a third party, maybe i can help you by working a little on it.
This aim to create "real" componants by removing dependancy from the core (mn_input, mn_display...) to the nodes. All this steps can be done transparentelly for the global architecture, i think.
- Move node function (event, call) into node file (foobar_diplay, foobar_click functions -> node_foobar.c)
- Normalize all node function. Example: only foobar_clickright(menu, node, x, y), instead of both clickright(x, y) or some clickright(menu, node)
- Create a node object. Something look like struct node_object{void clickright(menu, node, x, y);void display(menu, node);...} And create one instance by beaviour node existing
- Remove simple switch from the core. Something look like switch(node->type) can now be remplaced by something look like node_object_list[node->type].clickright(menu,node,x,y) where node_object_list contain all node beaviour
- Remove last use of MN_CONTAINER, MN_CHECKBOX... from the core, by adding new function/var/returnValue into the node beaviour structure.
- Thinking about cleaning the node structure of node instance data (for example the node->height). Iv got simple idea to do it without changing a lot of thing.
The core can now work with only a node description, without special case (no use of MN_...).
Its more easy to add new component, and to change beavious. We can easilly create new componants, more complex, or adding new events (mouseover?)... and thinking as an OO program.
Are you interested by that? I dont think its a too much long work, but i realy think it's
a need (if i dont missed a big thing). But its important to understand its only a code
restructuration. At the end of all this thing, there are no more functionality, but, i hope
a more extenssible code. I can work on this part of the code if you want... but i am very slow and i dont have access to the svn (access restricted).