Freddie Witherden schreef: > On 5 May 2008, at 13:22, Dennis Schridde wrote: >> Am Sonntag, 4. Mai 2008 23:49:57 schrieb Freddie Witherden: >>> The problem I am having is how a widget should tell its parent where >>> it wants to be? Should it be relative to other widgets? Should it be >>> relative to a side (north, east, south, west)? >> >> My proposal is "stolen" from Qt: "layouts" and ~"hints". >> >> Layouts: >> myLayout = newHBoxLayout(); >> myLayout->add( wdg1 ); >> myLayout->add( wdg2 ); >> >> Result: >> | wdg1 | wdg2 | >> >> (Similar for VBoxlayouts, etc.) >> >> In layouts any positional information of the widget is ignored. >> >> >> ~Hints: >> wdg1 = newWidget(); >> wdg1->setMinimumSize( 0, 0 ); >> wdg1->setMaximumSize( 1, 1 ); >> wdg1->setDefaultSize( 0.5, 0.5 ); > > I like it. It is also the same method which GTK uses. Should be nice > and easy to implement as well.
Yes, I like this method the best as well. I've encountered this in numerous widget systems (i.e. I've seen in it in these wxWidgets, GTK, Qt, SmartWin++) and all implement in _very_ similar ways, quite oftenly even the names are similar (rarely exactly the same though). On another sidenote: Freddie, you have a small test application for the widget code, right? If so could you maybe commit it to tools/ so that we can use this as well to check the widget code with. -- Giel
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev