20 namespace deserializers
24 using json::utility::jsonObject;
28 bool hasMenus =
false;
30 parser.
parse(description);
32 if (description.contains(
"menuStructure", json::utility::variantTypeEnum::jJSONObject))
34 menuParser.
parse(
const_cast<jsonObject&
>(description.getObject(
"menuStructure")));
78 const jsonObject& item = get<jsonObject>(i.data.front().second);
81 const string& type = item.getString(
"itemType");
85 mainMenu->addMenuItem(make_unique<MenuItem>(text, item.getString(
"functionName"), item.getString(
"moduleName")));
89 uint64_t popupId = item.getUnsignedInt(
"popupId");
90 Menu* popupMenu =
nullptr;
94 const jsonObject& popupItem = get<jsonObject>(j.data.front().second);
96 if (popupItem.getUnsignedInt(
"menuId") == popupId)
114 if (description.contains(
"hotkeys", json::utility::variantTypeEnum::jJSONArray))
119 if (description.contains(
"children", json::utility::variantTypeEnum::jJSONArray))
121 const auto& children = description.getArray(
"children");
123 for (
const auto& i : children)
125 const auto& [componentName, data] = get<jsonObject>(i.data.front().second).data.front();
126 const auto& description = get<jsonObject>(data);
130 deserializer->deserialize(componentName, description, result);
std::unique_ptr< T > smartPointerType
Compatible smart pointer type.
Base class for all windows, controls, etc.
virtual void setTextColor(uint8_t red, uint8_t green, uint8_t blue)
Base class for all windows that has children windows.
void setOnDestroy(const std::function< void()> &onDestroy)
void setExitMode(exitMode mode)
virtual std::unique_ptr< Menu > & createMainMenu(const std::wstring &menuName)
It needs to be called once.
virtual Menu & addPopupMenu(const std::wstring &menuName)
Don't call move operator with return value.
void setSmallIcon(const std::filesystem::path &pathToSmallIcon)
Set small icon(16x16) for specific window.
void setLargeIcon(const std::filesystem::path &pathToLargeIcon)
Set large icon(32x32) for specific window.
virtual void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) final override
void deserializeHotkeys(const json::utility::jsonObject &description)
Deserialize hotkeys.
const std::unordered_map< size_t, smartPointerType< utility::BaseComponentCreator > > & getCreators() const
Get all current registered creators.
const std::unordered_map< size_t, smartPointerType< interfaces::IDeserializer > > & getDeserializers() const
Get all current registered deserializers.
static GUIFramework & get()
Singleton instance access.
Standard separate window.
BaseComponent * deserialize(const std::string &componentName, const json::utility::jsonObject &description, BaseComposite *parent=nullptr) const override
SeparateWindow has no parent, you must manage the pointer.
static uint32_t getCodepage()
Base templated class for component creators.
virtual std::any getData() const
const std::string dropDownMenuItem
const std::string menuItem
wstring to_wstring(const string &stringToConvert, uint32_t codepage)
std::array< uint8_t, 3 > backgroundColor
utility::ComponentSettings settings
std::array< uint8_t, 3 > textColor
BaseComposite::exitMode mode
std::string windowFunctionName
std::string onDestroyFunctionName
std::string onDestroyFunctionModuleName
Parse SeparateWindow specific properties.
std::string pathToSmallIcon
std::string pathToLargeIcon
std::string onCloseFunctionModuleName
void parse(const json::utility::jsonObject &description) override
std::string onCloseFunctionName