GGWidgetFile class
#include <GGUI/Public/UIWidgetFile.h>
A widget asset's JSON and the tree of elements read out of it.
Public types
Public static functions
- static auto IdOf(std::string_view name) -> ItemID
- The ID an element of that name has.
- static auto Holds(const Element& element) -> bool
- True if elements of this kind hold others.
- static auto NewElement(std::string_view kind, bool bUse, const std::string& name) -> JsonValue
- A new element of type
kind(or, withbUse, a use of the assetkind), with what it needs to show something.
Public functions
- void Read()
- Read the element tree out of Root.
- auto Find(ItemID item) const -> const Element*
- The element with that ID; null if there is none.
- auto At(const std::vector<Step>& path) -> JsonValue*
- The element's JSON; null if the path leads nowhere.
- auto FreeName(std::string_view base, const std::vector<std::string>& taken = {}) const -> std::string
- A name no element has, from
basewithout the number it ends in (Label3 gives Label4), and none oftaken. - void NameAfresh(JsonValue& element) const
- Give every element in
element(a subtree, as a copy or a paste is) a name no element of this file has. - auto Insert(JsonValue element, ItemID onto, GGDropPlace place) -> bool
- Put
elementbefore, after, or insideonto(0: inside the root). False if it can't go there: inside something that holds nothing, or beside the root. - auto Remove(ItemID item) -> JsonValue
- Take
itemout and return it. Nothing for the root. - auto Move(const std::vector<ItemID>& items, ItemID onto, GGDropPlace place) -> bool
- Move
items, in order, before, after, or insideonto. False, with nothing changed, if that would put one inside itself. - auto Wrap(ItemID item, std::string_view type, const std::string& name) -> bool
- Put
itemin a new element of typetype, namedname, where it was. False if it isn't there. - auto Replace(ItemID item, std::string_view type) -> bool
- Make
iteman element of typetype:its name, layout, and children stay. False if it isn't there. - auto Rename(ItemID item, std::string_view name) -> bool
- Rename
item, and what names it in animations, triggers, and actions. False if the name isn't a word (letters, digits, underscores, not starting with a digit) or is taken. - auto CommentToNote(ItemID item) -> bool
- Make the comment written before
itemits note. False if there is none. - auto Migrate() -> std::vector<std::string>
- Write what the file calls by an old name by its new one (Switch is Switcher, layer is zOrder, an image's region is crop, ...), keys staying where they were.
Public variables
Function documentation
std::vector<std::string> GGUI:: GGWidgetFile:: Migrate()
Write what the file calls by an old name by its new one (Switch is Switcher, layer is zOrder, an image's region is crop, ...), keys staying where they were.
Returns what it changed, "old → new", each once.