Download

Support

Fill Policies

As widgets are packed together their fill policies kick in and adjust the widget sizes as needed to make everything fit. The fill policies of Ewl can be a bit confusing for the first time user, hell, I still have problems at times.

Using the fill policy

The basis for how fill policies fit together is shown the following image.

object_sizing.png

There are three sizes to any widget:

As the name implies the widget wants to be set to its preferred size whenever possible. If the fill policy allows, the widget can also shrink or grow within the bounds of its minimum and maximum sizes.

    Fill Policy       | Effect  
----------------------------------------------------------------
EWL_FLAG_FILL_NONE    | Do not fill or shrink in any direction
EWL_FLAG_FILL_VSHRINK | Vertically shrink
EWL_FLAG_FILL_HSHRINK | Horizontally shrink
EWL_FLAG_FILL_SHRINK  | Shrink both horizontally and vertically
EWL_FLAG_FILL_VFILL   | Vertically fill
EWL_FLAG_FILL_HFILL   | Horizontally fill
EWL_FLAG_FILL_FILL    | Fill both horizontally and vertically
EWL_FLAG_FILL_ALL     | Shrink or fill as needed

Guidelines for container authors

As you have seen in the previous section fill policies and the three different sizes are very closely connected. As a container author you have to set them to proper values in particular for the preferred size. Of course you do not have to overwrite them if you are inheriting this feature from the parent widget, as long it fits your needs.

Note:
The following guidelines are only commendations and not strict rules. There maybe good reason for some containers to not follow them.

The minimum size

A container should set a minimum size for any components it displays beyond the children packed inside of it. For example if you write a scrollpane, the minimum size should contain the scrollbars, but not the content added by the user of the container.

The preferred size

Every child of the container should be visible if the container has the size of its preferred size. Your container should respect the fill policy of the children, so if a child is set to SHRINK the user don't want it necessarily to be drawn in its full preferred size. For the calculation of the preferred size, it is advisable to use, what is returned from ewl_object_minimum_size_get(). If the child is not set to shrink the return value is the same like the return value of ewl_object_preferred_size_get(), but if the child is set to shrink it will return the minimum size.

The maximum size

You do not need to set this value. By default it is set to a very big number which should be sufficient in most cases. But, of course, you can set it if you need to.

Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sat May 17 16:51:08 2008