Skip to content
Stefan Schindler edited this page Apr 5, 2017 · 1 revision

Only two types of widgets exist in SFGUI:

  • Leaf widgets: Widgets without child widgets — just like leaves on a tree.
  • Container widgets: Widgets that can have child widgets.

Everything but more

Container widgets inherit everything from leaf widgets, but add some extra functionality, like adding widgets as children, iterating through the children, removing children and much more.

Some container types have special constraints, where containers are mostly, when not always, layouters (you will read more about them in a later chapter). For example, one container (the bin) only allows one child widget to be added.

Event propagation

Another difference of containers compared to leaf widgets is that they take an important role in event propagation. When leaf widgets receive an event (like a click), they can check if it's of interest and process it. Container widgets however may have children and have therefore to decide if they want to propagate it to them.

Clone this wiki locally