GGUI::GGWidgetLibrary class

Named widget assets, loaded from file text. Hot reload is loading a file again.

Constructors, destructors, conversion operators

GGWidgetLibrary()
No assets, and no resolvers set.
~GGWidgetLibrary()
GGWidgetLibrary(const GGWidgetLibrary&) deleted

Public functions

auto operator=(const GGWidgetLibrary&) -> GGWidgetLibrary& deleted
auto Load(std::string_view file, std::string_view text, std::vector<GGWidgetProblem>& problems) -> bool
Load or replace the asset text describes. False if it can't be read at all: the old version stays. Problems, including ones that don't stop it loading, go to problems.
auto LoadStarter(std::string_view file, std::string_view text, std::vector<GGWidgetProblem>& problems) -> bool
Load a starter: an asset the engine ships for projects to use or copy. A project asset of the same name replaces it, whichever loads first, and isn't reported as doing so.
auto IsStarter(TnxName name) const -> bool
True if the asset by that name is a starter no project asset has replaced.
auto Find(TnxName name) const -> const GGWidgetAsset*
The asset of that name; null if none.
auto Names() const -> std::vector<TnxName>
The names of every loaded asset.
auto FileOf(TnxName name) const -> std::string_view
The file the asset by that name was loaded from, as Load was given it; empty if none.
auto Regions(TnxName asset) const -> std::vector<GGRegionInfo>
The regions asset declares, in its own elements. Empty for an unknown asset.
auto Contexts(TnxName asset) const -> std::vector<GGContextInfo>
The contexts asset is given: its class's, or those its file declares, in their order. Empty for an unknown asset.
auto Inputs(TnxName asset) const -> std::vector<GGInputInfo>
The inputs asset is given: its class's, or those its file declares, in their order. Empty for an unknown asset.
auto IsHud(TnxName asset) const -> bool
True if an asset by that name is loaded and is a HUD ("kind": "hud").
auto ClassOf(TnxName asset) const -> TnxName
The class asset names ("class"); invalid if none, or no such asset.
auto LoadTable(std::string_view file, std::string_view text, std::vector<GGWidgetProblem>& problems) -> bool
Load or replace the data table text describes (.tnxtable). As Load.
auto FindTable(TnxName name) const -> const GGDataTable*
The table of that name; null if none.
auto TableItems(TnxName name) const -> const GGItemFeed*
A table's rows as list items: each row a context of the table's type, keyed by its key field.
auto TableNames() const -> std::vector<TnxName>
The names of every loaded table.
auto LoadSheet(std::string_view file, std::string_view text, std::vector<GGWidgetProblem>& problems) -> bool
Load or replace a style sheet that assets can name: "sheets": [ "StatBar.ggss" ] finds the sheet whose file is that name or ends in it. As Load.
auto LoadCurve(std::string_view file, std::string_view text, std::vector<GGWidgetProblem>& problems) -> bool
Load or replace a curve asset (.tnxcurve). As Load. A track playing it follows the new keys when its asset is next built.
auto FindCurve(TnxName name) const -> const GGCurve*
The curve of that name; null if none.
auto CurveNames() const -> std::vector<TnxName>
The names of every loaded curve.
auto UsersOfCurve(TnxName curve) const -> std::vector<TnxName>
The assets with a track that plays curve.
auto LeavingSeconds(TnxName asset) const -> float
How long asset takes to leave: its clips triggered when "hidden". 0: it goes at once.
auto StyleScopes() const -> const GGStyleScopes&
The assets' styles and tokens, each a scope over what its asset builds. Documents resolve their looks with them (UIContext::SetWidgets).
auto Changed() const -> const GGRevision&
Bumped by every Load that changed something. Documents using an asset re-run on it.
void SetContextResolver(const GGContextResolver& resolver)
How formulas read game state. Without one, a context field is a problem when used.
auto GetContextResolver() const -> const GGContextResolver&
The context resolver set.
void SetClassResolver(const GGClassResolver& resolver)
How widget classes are found. Set before loading: an asset naming a class takes its contexts, inputs, and calls from it.
auto GetClassResolver() const -> const GGClassResolver&
The class resolver set.
void SetCommandChecker(const GGCommandChecker& checker)
How command actions are checked. Without one, any command is accepted.
auto GetCommandChecker() const -> const GGCommandChecker&
The command checker set.
void SetReferenceResolver(const GGReferenceResolver& resolver)
How references by asset ID find the asset. Without one, the name written beside the ID is used.
void SetItemSources(const GGItemSources& sources)
Where named and entity lists get their items. Without one, only tables can be listed.
auto GetItemSources() const -> const GGItemSources&
The item sources set.