aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt1
-rw-r--r--src/ui/mapper/style/BorderStylerMapper.cpp34
2 files changed, 35 insertions, 0 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 4353a541..f13f4983 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -35,6 +35,7 @@ add_library(cru_ui SHARED
mapper/PointMapper.cpp
mapper/SizeMapper.cpp
mapper/ThicknessMapper.cpp
+ mapper/style/BorderStylerMapper.cpp
render/BorderRenderObject.cpp
render/CanvasRenderObject.cpp
render/FlexLayoutRenderObject.cpp
diff --git a/src/ui/mapper/style/BorderStylerMapper.cpp b/src/ui/mapper/style/BorderStylerMapper.cpp
new file mode 100644
index 00000000..8a5df83d
--- /dev/null
+++ b/src/ui/mapper/style/BorderStylerMapper.cpp
@@ -0,0 +1,34 @@
+#include "cru/ui/mapper/style/BorderStylerMapper.hpp"
+#include "cru/common/ClonablePtr.hpp"
+#include "cru/ui/mapper/MapperRegistry.hpp"
+#include "cru/ui/style/ApplyBorderStyleInfo.hpp"
+#include "cru/ui/style/Styler.hpp"
+#include "cru/xml/XmlNode.hpp"
+
+namespace cru::ui::mapper::style {
+using cru::ui::style::ApplyBorderStyleInfo;
+using cru::ui::style::BorderStyler;
+
+bool BorderStylerMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) {
+ return node->GetTag().CaseInsensitiveEqual(u"BorderStyler");
+}
+
+ClonablePtr<BorderStyler> BorderStylerMapper::DoMapFromXml(
+ xml::XmlElementNode* node) {
+ auto border_style_mapper =
+ MapperRegistry::GetInstance()->GetMapper<ApplyBorderStyleInfo>();
+
+ ApplyBorderStyleInfo border_style;
+
+ for (auto child : node->GetChildren()) {
+ if (child->GetType() == xml::XmlElementNode::Type::Element) {
+ auto child_element = child->AsElement();
+ if (border_style_mapper->XmlElementIsOfThisType(child_element)) {
+ border_style = border_style_mapper->MapFromXml(child_element);
+ }
+ }
+ }
+
+ return BorderStyler::Create(std::move(border_style));
+}
+} // namespace cru::ui::mapper::style