Window constraints
May 29 1995
A quick note about constraints. In wxWidgets 1.62,
there is already a facility for specifying size and
position constraints, which can be helpful for
subwindow layout and simple panel item layout.
The problem with it is that it doesn't allow the kind
of nested constraints and grouping that, say, Motif does.
We could implement this with nested panels, perhaps,
and specify constraints on these. However, not all
windowing systems support nested windows (e.g. XView),
it can mess up tab traversal, and is generally overkill.
It wouldn't solve grouping of rows and columns, either,
where the window needs to intelligently lay out its children
and possibly shrink to fit around them.
So I'm working on 'fake' window classs based on wxSizer, which enables
you to have the effect of nested windows, without the need for real
nested windows. There will be a wxRowColSizer which can lay out its
children, and there is scope for other 'intelligent' sizers. The
layout strategy need not be totally top-down as in the present
constraint system; the sizer can choose whether to lay out its
children first and then consider its own constraints, or vice versa,
by overriding LayoutPhase1 and LayoutPhase2 handlers appropriately.
For a preview, take a peek in wx/include/base/wx_lay.h,
wx/src/base/wx_lay.cc and the layout sample if you have a recent
beta.
Eventually the resource editor mentioned in another
technical note should support the specification of constraints
and sizers. However, don't expect to see it before
Christmas 1995!