-
Notifications
You must be signed in to change notification settings - Fork 63
Size policies
SFGUI is a GUI library that takes care of positioning and sizing widgets. This may also be called automatic layouting.
The concept is inspired by the GTK+ (GIMP ToolKit+) library, which was originally developed for GIMP, the image manipulation program.
The rules behind it are easy to understand: Every (visible) widget has two fundamental properties, which are important for the layout:
- Requisition: The requisition is the size (width and height) the widget requires at minimum. That means the widget doesn't want to get smaller than that size.
- Allocation: The allocation is the position and size (x, y, width and height) the widget finally gets.
This leads to an important constraint: The allocation's size may be larger than the requisition, but not the other way around.
Position and size is a well-known concept in nearly all GUI libraries. One sets a widget's position to specify where it's drawn on the screen, and the size to define how large it is. This is fine for static layouts, but what happens when a widget's parent window is resized?
Either the developer has to react to such events and re-arrange all the widgets by changing their positions and sizes, or that happens automatically.
SFGUI does it the latter way, and that's what the requisition is for: It tells SFGUI what size a widget needs, so it can allocate enough size for it.