GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
TabControlParser.cpp
Go to the documentation of this file.
1#include "TabControlParser.h"
2
3#include "Utility/Utility.h"
5
6using namespace std;
7
8namespace gui_framework
9{
10 namespace parsers
11 {
12 void TabControlParser::parse(const json::utility::jsonObject& description)
13 {
14 BaseComponentParser::parse(description);
15
16 imagesWidth = static_cast<uint16_t>(description.getUnsignedInt("imagesWidth"));
17 imagesHeight = static_cast<uint16_t>(description.getUnsignedInt("imagesHeight"));
18
19 const auto& jsonTabs = description.getArray("tabs");
20
21 tabs.reserve(jsonTabs.size());
22
23 for (const auto& i : jsonTabs)
24 {
25 auto& tab = tabs.emplace_back();
26
27 if (i.contains("tabText", json::utility::variantTypeEnum::jString))
28 {
29 tab.text = utility::to_wstring(i.getString("tabText"), interfaces::ISerializable::getCodepage());
30 }
31
32 if (i.contains("tabImagePath", json::utility::variantTypeEnum::jString))
33 {
34 tab.pathToImage = i.getString("tabImagePath");
35 }
36
37 if (i.contains("functionName", json::utility::variantTypeEnum::jString))
38 {
39 tab.functionName = i.getString("functionName");
40 tab.moduleName = i.getString("moduleName");
41 }
42 }
43 }
44 }
45}
wstring to_wstring(const string &stringToConvert, uint32_t codepage)
Definition Utility.cpp:82
virtual void parse(const json::utility::jsonObject &description)
void parse(const json::utility::jsonObject &description) override
std::vector< BaseTabControl::tabData > tabs