The basic idea I'm knocking around is that a gui is defined by two elements;
- an XML file which describes the layout of panels (with all your normal widgets in)
- a script file (Lua in my case) which handles how callbacks are dealt with etc
A bit of C++ magic will bind the two together and handle drawing/message routing/etc and we'll live happy ever after... or something like that.
The XML layout seems sane; GUIs by their very nature are hieractical and a nested structure seems perfect to describe it.
The scripting backend allows fast tweaking and control of the GUIs responce and dynamic types. The objects which exist script side have to expose certain properties/functions in order to work with the GUI C++ code, however their names and types don't matter. This means the types aren't frozen in the C++ code, instead it deals with an interface and we can make up elements as we feel the need.
So, the XML file could define a widget 'myCoolWidget' and when it's loaded the C++ loader just looks up that name in the relivent script file in order to bind it to it's actions.
Seems like a decent reusable system to me; I've a game to write this weekend however depending on how quick that gets done I might take a crack at this next week sometime before finishing off my final year project's code.