Modifying the contents of a list

The x::w::listlayoutmanager: does not manage discrete display elements, but a vertical list of text labels in selection lists, combo-boxes, and menus. The append_items(), insert_items(), replace_items(), and replace_all_items() items add new items to the list, combo-box, or a menu, whatever the case may be. These methods receive a std::vector containing the new list items.

This vector contains x::w::list_item_params. x::w::list_item_param is a (subclass-of a) std::variant.

llmanager->append_items(
    {
        "Lorem",
        "Ipsum",
        x::w::separator{},
        "Dolor sit amet"
    });

This is an example of passing a std::vector<x::w::list_item_param> to append_items(), adding new items to the list. The basic values of x::w::list_item_param are:

All items in a selection list are numbered starting with 0, and get automatically renumbered whenever list items get added or removed from the list. Each list item is specified by its current item number, when using selected(), enabled(), and other list methods. A x::w::separator is a discrete list item, and merits an item number of its own, in that regard. The above example creates items #0 through #3, if the selection list was empty.

Note

The height of the selection list gets specified as the number of list rows. The actual height gets computed using the default list label font. Using custom fonts and separators results in a selection list with rows of varying height.