Table of Contents
The single most important part of the library is the widget tree structure.
The root of the Tree is the Application Object (stk::application), it contains a list of state which all represents one set of visible widgets at a time, these are contained in the children list of all containers.(state is a container too)
All linking in the widget tree is established by using smart pointers, Parents use shared_ptrs to link to their children, which expresses an ownership of the childrens. Children use weak_ptrs to establish a link to their parents, this is used instead of a shared_ptr because a child doesnt/cannot own his own parent in terms of reference counting.
Something happens to a widget that causes it to need to be redrawn. It calls parent_->redraw(rect_), the parent (which is a container) adds the rect to its redraw_rect_ (rectangle + rectangle uses the min and max points to form a new rectangle), and calls parent_->redraw(redraw_rect_) and so on until application is reached. The next time application starts to draw it calls current_state_->draw(). The state only draws the portion defined by redraw_rect_ (this speeds up redraw time and ensures the background for potentially partially transparent widgets or fonts is drawn), it then calls draw on all its children widgets who intersect the redraw_rect. Containers only draw the area defined by redraw_rect_, leaf widgets always redraw themselves entirely.