GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseTextListView.cpp
Go to the documentation of this file.
1#include "BaseTextListView.h"
2
4
5using namespace std;
6
7namespace gui_framework
8{
9 void BaseTextListView::updateLocalization(size_t index, wstring_view localizedText)
10 {
11 ITextListView::changeTextItem(localizedText, index);
12 }
13
14 BaseTextListView::BaseTextListView(const wstring& listViewName, const utility::ComponentSettings& settings, BaseComposite* parent) :
16 (
17 listViewName,
18 settings,
19 styles::TextListViewStyles(),
20 parent
21 ),
22 ITextListView(handle)
23 {
24
25 }
26
27 json::JSONBuilder BaseTextListView::getStructure() const
28 {
29 using json::utility::jsonObject;
30
31 uint32_t codepage = ISerializable::getCodepage();
32 json::JSONBuilder builder = BaseListView::getStructure();
33 jsonObject& current = get<jsonObject>(builder[utility::to_string(windowName, codepage)]);
34 vector<jsonObject> values;
35 size_t size = this->size();
36
37 if (size)
38 {
39 for (size_t i = 0; i < size; i++)
40 {
41 json::utility::appendArray(utility::to_string(this->getItemText(i), codepage), values);
42 }
43
44 current.data.push_back({ "listViewTextValues"s, move(values) });
45 }
46
47 return builder;
48 }
49
50 LRESULT BaseTextListView::addTextItem(string_view localizationKey)
51 {
52 this->addLocalizationKey(localizationKey);
53
54 return ITextListView::addTextItem(localizationKey);
55 }
56
57 LRESULT BaseTextListView::insertTextItem(string_view localizationKey, size_t index)
58 {
59 this->addLocalizationKey(localizationKey);
60
61 return ITextListView::insertTextItem(localizationKey, index);
62 }
63
64 LRESULT BaseTextListView::changeTextItem(string_view localizationKey, size_t index)
65 {
66 this->addLocalizationKey(localizationKey);
67
68 return ITextListView::changeTextItem(localizationKey, index);
69 }
70}
virtual json::JSONBuilder getStructure() const override
const std::wstring windowName
Base class for all windows that has children windows.
Base class for all list views.
virtual LRESULT changeTextItem(std::string_view localizationKey, size_t index) final override
virtual LRESULT insertTextItem(std::string_view localizationKey, size_t index) final override
virtual void updateLocalization(size_t index, std::wstring_view localizedText) override
virtual json::JSONBuilder getStructure() const override
BaseTextListView(const std::wstring &listViewName, const utility::ComponentSettings &settings, BaseComposite *parent)
virtual LRESULT addTextItem(std::string_view localizationKey) final override
void addLocalizationKey(std::string_view localizationKey)
virtual std::wstring getItemText(size_t index) const
string to_string(wstring_view stringToConvert, uint32_t codepage)
Definition Utility.cpp:41