type=pane layouts

<layout type="pane" id="mainpane">
  <append_panes>
    <name>mainpanecontents</name>
  </append_panes>
</layout>

<factory type="pane" id="maincontents">

  <!-- ... -->

</factory>

// ....

x::w::panelayoutmanager plm=container->get_layoutmanager();

plm->generate("mainpane", generator, elements);

The contents of a layouts with type=pane specify the pane layout manager methods that get invoked to generate() its contents.

Creating type=pane layouts

A container with a type=pane creates a container that uses the pane layout manager.

Initializing x::w::new_panelayoutmanager

<container>
  <name>inventory</name>
  <type>pane</type>
  <config>
    <vertical />
    <size>inventory_width</size>
  </config>
</container>

The config element initializes the x::w::new_panelayoutmanager that creates the container:

minimum_size, preferred_size, maximum_size

These elements reference other dims in the theme file, defining the size of the pane container.

<config>
  <minimum_size>min-inventory</minimum_size>
  <preferred_size>pref-inventory</preferred_size>
  <maximum_size>max-inventory</maximum_size>
</config>

<dim id="min-inventory">100.0</dim>
<dim id="pref-inventory">150.0</dim>
<dim id="max-inventory">200.0</dim>
size

This is equivalent to specifying the same minimum_size, preferred_size, and maximum_size.

<horizontal/> and <vertical/>

Invokes the corresponding x::w::new_panelayoutmanager method.

appearance

Sets the x::w::new_panelayoutmanager's appearance value:

<config>
  <appearance>inventory-appearance</appearance>
</config>

<appearance id="inventory-appearance" type="pane">

</appearance>
name

Sets x::w::new_panelayoutmanager's name field, in order to preserve the number and sizes of panes. A full control of the preservation of number and pane sizes is done by using an installed layout creator in the x::w::uielements:

<container>
  <name>inventory</name>
  <type>pane</type>
  <config>
    <vertical />
    <name>inventory</name>
  </config>
</container>

<layout id="inventory" type="pane">
  <creator>create_inventory</creator>
</layout>

x::w::uielements elements;

elements.layout_creators.emplace(
    "create_inventory",
    []
    (const x::w::panelayoutmanager &plm)
    {
          size_t s=plm->restored_size();

          // ...
    });

The creator lambda is free to choose to restore the given number of panes, or not. When the pane container always has the same number of panes they can be created directly in the theme file:

<container>
  <name>directory</name>
  <type>pane</type>
  <config>
    <vertical />
    <name>directory</name>
  </config>
</container>

<layout id="directory" type="pane">
  <append_panes>
    <name>create-directory-contents-pane</name>
  </append_panes>
</layout>

<factory id="create-directory-contents-pane" type="pane">
  <container>
    <type>grid</type>
    <name>header-pane</name>
  </container>
  <container>
    <type>grid</type>
    <name>contents-pane</name>
  </container>
</factory>