GGUI::EditorRegistry class

EditorRegistry: maps field types to editor widgets.

Not thread-safe. Register everything at startup, before the UI update reads it.

Public functions

void Register(TypeID type, EditorFn editor, std::initializer_list<const GGHintInfo*> reads = {})
Editor for every field of type; replaces any existing one. reads lists the hints the editor uses, so a hint it ignores can be reported.
void RegisterField(uint64_t fieldID, EditorFn editor, std::initializer_list<const GGHintInfo*> reads = {})
Editor for one specific field, overriding its type's.
void AddDefaults()
Registers the built-in editors for FieldTypes: number (or slider, with the hint), toggle, text, vector, colour, item picker.
auto Find(const FieldInfo& field) const -> EditorFn
Field override, else type editor, else null.
auto Check(const FieldInfo& field) const -> std::string
Validates a field's hints: unread by its editor, wrong kind for it, or contradictory. Returns a one-line message, or empty if fine.
auto DescribeHints() const -> std::string
One line per hint any registered editor reads: name, description, reader count. For tools.

Function documentation

void GGUI::EditorRegistry::AddDefaults()

Registers the built-in editors for FieldTypes: number (or slider, with the hint), toggle, text, vector, colour, item picker.

Each shows the field through its binding and reports edits to the source. Numbers are edited in the field's own type.