type=standard_combobox and type=editable_combobox layouts

<layout type="standard_combobox" id="option-list">
  <append_items>

    <!-- ... -->

  </append_items>
</layout>

The contents of a layouts with type=standard_combobox or type=editable_combobox specify the standard or editable combo-box layout manager methods that get invoked to generate() its contents.

Creating type=standard_combobox and type=editable_combobox layouts

A container with a type=standard_combobox or type=editable_combobox creates a container that uses the corresponding combo-box layout manager.

Initializing x::w::new_standard_comboboxlayoutmanager and x::w::new_editable_comboboxlayoutmanager

<container>
  <name>folders</name>
  <type>editable_combobox</type>
  <config>
    <optional />
  </config>
</container>

An optional config element sets non-default values of the x::w::new_standardlayoutmanager or the x::w::new_editable_comboboxlayoutmanager that creates the container:

<optional/>

Sets the selection_required flag to false:

<config>
  <optional />
</config>
synchronized_columns

Initializes the synchronized_columns object:

<config>
  <synchronized_columns>combobox_columns</synchronized_columns>
</config>

All generate()d combo-boxes with the same synchronized_columns name have the same x::w::synchronized_axis handle. The element's name is an opaque label. x::w::synchronized_axis objects get automatically created, internally, and associated with their name.

appearance and input_appearance and

appearance sets x::w::new_standard_comboboxlayoutmanager's or x::w::new_editable_comboboxlayoutmanager's appearance value:

<config>
  <appearance>my_comboboxes</appearance>
</config>

<appearance id="my_comboboxes" type="combobox">

  <!-- ... -->

</appearance>

The value of the element specifies an appearance object of type=combobox.

An editable combo-box also has an input_appearance for its input field, referencing an type=input_field. appearance object.

The config element shares additional common settings with x::w::new_listlayoutmanager :

width

Invokes one of x::w::new_list_or_comboboxlayoutmanager's methods that specifies the list's or combo-box's width:

<config>
  <width>
    <default />
  </width>
</config>

This invokes the default_width() method.

<config>
  <width>
    <variable />
  </width>
</config>

This invokes the variable_width() method.

<config>
  <width>
    <min>list-width-min</min>
    <preferred>list-width-preferred</preferred>
    <max>list-width-max</max>
  </width>
</config>

A width element with an x::w::dim_axis_arg value invokes width() with this explicit value.

columns

Sets the x::w::new_list_or_comboboxlayoutmanager's columns value:

<config>
  <columns>2</columns>
</config>

This sets columns to 2, creating a list or a combo-box with two columns.

requested_col_width

Initializes x::w::new_list_or_comboboxlayoutmanager's requested_col_widths map:

<config>
  <requested_col_width>
    <column>0</column>
    <percentage>25</percentage>
  </requested_col_width>
  <requested_col_width>
    <column>1</column>
    <percentage>75</percentage>
  </requested_col_width>
</config>

Each requested_col_width contains a column number and a percentage value from 0 to 100.

col_alignment

Initializes x::w::new_list_or_comboboxlayoutmanager's col_alignments map:

<config>
  <col_alignment>
    <column>0</column>
    <halign>right</halign>
  </col_alignment>
</config>

Each col_alignment contains a column number and an halign x::w::halign value.

row_alignment

Initializes x::w::new_listlayoutmanager's row_alignments map:

<config>
  <row_alignment>
    <column>0</column>
    <valign>middle</valign>
  </row_alignment>
</config>

Each col_alignment contains a column number and an valign x::w::valign value.

column_border

Initializes x::w::new_list_or_comboboxlayoutmanager's column_border map:

<config>
  <column_border>
    <column>1</column>
    <border>divider</border>
  </column_border>
</config>

<!-- ... -->

<border id="divider">

  <!-- ... -->

</border>

Each column_border contains a column number and a border reference.

minimum_column_width

Initializes x::w::new_list_or_comboboxlayoutmanager's minimum_column_widths map:

<config>
  <minimum_column_width>
    <column>0</column>
    <width>10.0</width>
  </minimum_column_width>
</config>

Each minimum_column_width contains a column number and a width value.

synchronized_columns

Initializes x::w::new_list_or_comboboxlayoutmanager's synchronized_columns object:

<config>
  <synchronized_columns>table_columns</synchronized_columns>
</config>

All generate()d lists or combo-boxes with the same synchronized_columns name have the same x::w::synchronized_axis handle. The element's name is an opaque label. x::w::synchronized_axis objects get automatically created, internally, and associated with their name.

lr_padding

Initializes x::w::new_list_or_comboboxlayoutmanager's lr_paddings map:

<config>
  <lr_padding>
    <column>1</column>
    <left>l-padding</left>
    <right>r-padding</right>
  </lr_padding>
</config>

<!-- ... -->

<dim id="l-padding">0</dim>
<dim id="r-padding">4</dim>

Each lr_padding contains a column number; and a left and right values that reference dim elements in the theme file.

Creating a type=editable_combobox with a validated input field

It is possible to use a theme file to create an editable combo-box with a validated input field. This is done the same way that validated input fields themselves get created.

<container>
  <name>line_size</name>
  <type>editable_combobox</type>
  <config>
    <optional />
  </config>
</container>

#include <x/w/validated_input_field.H>

x::w::uielements widgets;

widgets.create_validated_input_field(
    "line_size",
    []
    (ONLY IN_THREAD,
     const std::string &value,
     const auto &lock,
     const auto &ignore) -> std::optional<int>
    {
          // ...
    },
    []
    (const std::optional<int> &v)
    {
          // ...
    }
);

// Generate the UI

x::w::focusable_container line_size=widgets.get_element("line_size");

x::w::validated_input_field<int> line_size_validated=
    widgets.get_validated_input_field<int>("line_size");

An editable combo-box with a validated input field gets created, automatically, if a validator is installed for a name of a type=editable_combobox container.