Hierarchical widgets
Posted: 02 Aug 2008 16:12
In the past months, I have been busy re-writing the widgets system.
Instead of a flat array of Widget structs, I have made a tree of widgets, based on the 'is contained in' relation.
The new widgets know their own minimal size from their contents, and their resize step size. Together with the tree, the new widgets can compute the minimal size of the window they are kept in, and how the window can be resized.
This means eg that switching to another language will cause all the windows to get resized, so the new strings fit again in the windows.
The new widgets are more OO, which means that extending widgets with your own custom behavior is now possible.
With respect to the actual implementation, there are 3 currently windows implemented as a demo against revision 13920, the airport picker window (to show nested widgets), the intro-screen window (has lots of spacing around the widgets), and the news-history window (has a scrollbar). Of the latter, the mouse-wheel doesn't work yet.
(due to attachment limit, see next post for the widget implementation)
Instead of a flat array of Widget structs, I have made a tree of widgets, based on the 'is contained in' relation.
The new widgets know their own minimal size from their contents, and their resize step size. Together with the tree, the new widgets can compute the minimal size of the window they are kept in, and how the window can be resized.
This means eg that switching to another language will cause all the windows to get resized, so the new strings fit again in the windows.
The new widgets are more OO, which means that extending widgets with your own custom behavior is now possible.
With respect to the actual implementation, there are 3 currently windows implemented as a demo against revision 13920, the airport picker window (to show nested widgets), the intro-screen window (has lots of spacing around the widgets), and the news-history window (has a scrollbar). Of the latter, the mouse-wheel doesn't work yet.
(due to attachment limit, see next post for the widget implementation)