blob: 6798798c5e38b0b57f2aef0d47f527ebd43a4982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "cru/ui/mapper/style/CursorStylerMapper.h"
#include "cru/common/ClonablePtr.h"
#include "cru/platform/gui/Cursor.h"
#include "cru/ui/mapper/MapperRegistry.h"
#include "cru/ui/style/Styler.h"
namespace cru::ui::mapper::style {
bool CursorStylerMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
return node->GetTag().CaseInsensitiveEqual(u"CursorStyler");
}
ClonablePtr<ui::style::CursorStyler> CursorStylerMapper::DoMapFromXml(
xml::XmlElementNode* node) {
auto cursor_mapper =
MapperRegistry::GetInstance()->GetSharedPtrMapper<platform::gui::ICursor>();
std::shared_ptr<platform::gui::ICursor> cursor;
for (auto child : node->GetChildren()) {
if (child->GetType() == xml::XmlNode::Type::Element &&
cursor_mapper->XmlElementIsOfThisType(child->AsElement())) {
cursor = cursor_mapper->MapFromXml(child->AsElement());
}
}
return ui::style::CursorStyler::Create(cursor);
}
} // namespace cru::ui::mapper::style
|