Oct 13 2006
Fill’er Up
I’ve never been very good with EWL fill policies. I always manage to get them wrong, then convince RbdPngn to fix them for me.
This isn’t such a great situation when I’m writting widgets that need to take these things into account. This is causing a bug in the Ewl_Paned widget at the moment.
So, I got a bit of a description on these from Nathan and though I’d share what I’d learned.
There are three basic fill policies, then a few combinations. The main policies are: EWL_FLAG_FILL_NONE, EWL_FLAG_FILL_SHRINK and EWL_FLAG_FILL_FILL.
EWL_FLAG_FILL_VFILL, EWL_FLAG_FILL_HFILL, EWL_FLAG_FILL_VSHRINK and EWL_FLAG_FILL_HSHRINK are all special cases of the EWL_FLAG_FILL_SHRINK or EWL_FLAG_FILL_FILL policy.
There is also EWL_FLAG_FILL_ALL which is just EWL_FLAG_FILL_SHRINK | EWL_FLAG_FILL_FILL. All fill polices at the same time.
What do these different policies mean?
- NONE will be given it’s exact preferred size.
- SHRINK will allow as much space away as possible to be removed, down to its minimum size. SHRINK will grow only as large as its preferred size setting.
- FILL will take as much space as possible up to its maximum size. FILL will shrink down to its preferred size setting.
You can also think of it as:
minimum_size <= shrink_size <= preferred_size <= fill_size <= maximum_size.
A visual representation of this can be seen in the following image.

These constraints are enforced at the object level. If you’re implementing a container you can choose to ignore them but the object will be clipped or have extra space as needed to meet these size needs.