GGUI/Public/UIWidgetFile.h file

A widget asset's file as a tree of its elements, for tools that edit it (the widget designer).

GGWidgetFile file;
file.Root = JsonParse(text, { .bRelaxed = true, .bKeepComments = true }, &error);
file.Read();
file.Insert(GGWidgetFile::NewElement("Label", false, file.FreeName("Label")), file.Elements[0].ID, GGDropPlace::Inside);
std::string saved = GGWriteWidgetFile(file.Root);

Every edit changes the JSON and reads the tree again, so Elements always says what the file has. An element's ID is its name's: names are unique in an asset, and an ID stays the same while it moves.

Namespaces

namespace GGUI

Classes

class GGUI::GGWidgetFile
A widget asset's JSON and the tree of elements read out of it.
struct GGUI::GGWidgetFile::Step
A step to an element in the JSON: a key of an object, then, if it is a list, an index.
struct GGUI::GGWidgetFile::Element
An element of the asset, as read out of the JSON.