GGUI::ItemSet class

ItemSet: a set of items owned by the caller, used for selection and expansion.

Because it is keyed by item and lives outside the view, it outlives any row and can be shared: a tree and a table given the same set show the same selection. Views watch the set.

UI update thread only.

Public functions

auto Contains(ItemID item) const -> bool
Whether item is in it.
auto Add(ItemID item) -> bool
Add item. True if the set changed.
auto Remove(ItemID item) -> bool
Remove item. True if the set changed.
void Toggle(ItemID item)
Add item if it isn't in it, remove it if it is.
void Clear()
Remove everything.
auto Set(std::vector<ItemID> items) -> bool
Replace the contents in one change. True if anything changed.
auto Count() const -> size_t
How many items it holds.
auto All() const -> std::span<const ItemID>
Every item, ascending.
auto Changed() const -> const GGRevision&
Bumped on every change.