Thoughts on adding Layout to VCL with minimal changes. - Michael Meeks * Why ? Adding more advanced, containment based widget layout has the following nice properties: + vital for cross-platform theming - necessarily different platforms have different widget sizes & it is not feasible to have a per-platform, per-language layout cost. + current per-language layout does not happen, resulting in an increasing level of unfeasible ugliness. + an automatic layout, can look identical to a manual layout at the size / locale it's designed for - resulting in no loss of visual 'quality'. It was a fool who said that manual layout is always better - in the degenerate case it's just as good; for re-sizing it's always better. + current dialogs are clunky and ugly; especially with a different font size; cf. horrific hacks such as vcl/source/window/window.cxx:395 /Force all fonts/ * Misc. requirements: + 100% backwards compatibility + the existing non-layout scheme must continue to function - and is as discussed a degenerate case of layout anyway. + no perceptible performance impact + minimaly invasive code changes * Ramblings: While many complex layout schemes are possible; the gtk+ scheme - is perhaps a good balance of simplicity and flexibility. While eg. Java's Layouts provide minimum, and preferred sizes for widgets - gtk+'s scheme is based on a hierarchy of containers which invoke either: Size RequestSize(); or AllocateSize( Size ); Since with the existing positioning scheme, we already have an method for allocating sizes, adding gtk+ style layout would entail adding a single extra virtual method to 'Window', and a set of implementations of 'RequestSize'. Many of these may simply map to the existing disparate CalcMinimumSize methods. While gtk+'s layout containers are inherited from Widget - there is no necessity for this in vcl; indeed the whole layout scheme can be layered inside new private layout classes. These could be hooked into the existing positional layout logic in Window::ImplLoadRes; and extensions made to the resource file format to allow selected windows to have layout added. Clearly many dialogs (especially re-sizable ones) currently rely on the exact positioning of widgets; thus converting dialogs to the layout scheme has to involve incremental testing / code-reading to ensure that each will continue to function well.