[][src]Module pugl_ui::layout

Facilities for widget layouting

So far there is the classical box stacking layout (like Gtk's HBox/Vbox) implemented. Other layouting algorithms can be implemented later.

This module contains the items, that are needed to layout widgets.

Principles

The UI knows the widget tree as a tree of WidgetNodes. Each node of the widget tree has an associated LayouterImpl trait object, that is responsible of layouting the children.

The layouting process has two stages.

  • Size determination

    In the first stage the UI crawls recrusively through the widget tree and asks all the widget for their minimal sizes this happens recursively as the layouting widgets ask their children about their minimal size and and then calculate how the size of the layout would be. A LayouterImpl trait object must therefor implement LayouterImpl::calc_size().

  • Layout application

    Once the minimal size of each widget and each (sub)layout is known, the sizes are applied to the individual widgets. A layouter can choose to expand widgets to fit the layout better, if the widget signals expandability. During size application the layouter also sets the position of the widget. All this happens in LayouterImpl::apply_layouts().

Modules

stacklayout

Stack layouting like Gtk's VBox/HBox

Structs

LayoutWidget

The widget that contains a layout

LayoutWidgetHandle

A handle that contains a WidgetHandle.

Traits

Layouter

A trait describing layouters in order to assign them to a LayoutWidget.

LayouterImpl

A trait to perform the layouting speicified by Layouter trait object.