Creating new panes

x::w::panelayoutmanager's append_panes(), insert_panes(), replace_panes(), and replace_all_panes() return a x::w::panefactory, which is a factory. Every display element created by the factory becomes a new pane in the pane layout manager's container.

The factory's set_initial_size() sets the new element's initial size(). This is just a suggestion, since the pane container, with all of its elements, always gets constrained by its specified size.

x::w::new_panelayoutmanager npl{
   x::w::dim_axis_arg{40} // 40 millimeter-long container
};

factory->create_focusable_container(
     [&]
     (const x::w::container &new_container)
     {
          x::w::panelayoutmanager plm=new_container->get_layoutmanager();

          x::w::panefactory f=plm->append_panes();

          f->set_initial_size(20); // 20 millimeters (almost)
          f->create_label("Lorem Ipsum")->show();

          f->set_initial_size(20); // Ditto
          f->create_label("Lorem Ipsum")->show();
     }, npl);

This example creates a 40 millimeter-long container, with two initial panes. Each pane's size gets set to 20 millimeters, so the pane container's alloted 40 millimeter size gets evenly divided between them.

The actual size of each element in this container is slightly less than 20 millimeters. The draggable divider between the two panes takes up some space too, and it has to fit within its container's 40 millimeter size. The two new panes' sizes get slightly adjusted, in order to leave sufficient space for the dividers.

The sizes set by set_initial_size(), in this manner, are just guidelines, or hints, and the actual size of each new element gets proportionately adjusted, together with the sizes of any existing panes, so that the entire container stays within its bounds.