diff options
| author | crupest <crupest@outlook.com> | 2022-02-26 20:12:54 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-02-26 20:12:54 +0800 |
| commit | 673f1939beb1b477a23d9641a07a2e05fff903b4 (patch) | |
| tree | 048ba6b4eab749266d8e2ec05df182bedcf3499f /src/ui/mapper/style/MarginStylerMapper.cpp | |
| parent | 65e288c40a593965b41378755f7111c56e123295 (diff) | |
| download | cru-673f1939beb1b477a23d9641a07a2e05fff903b4.tar.gz cru-673f1939beb1b477a23d9641a07a2e05fff903b4.tar.bz2 cru-673f1939beb1b477a23d9641a07a2e05fff903b4.zip | |
...
Diffstat (limited to 'src/ui/mapper/style/MarginStylerMapper.cpp')
| -rw-r--r-- | src/ui/mapper/style/MarginStylerMapper.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ui/mapper/style/MarginStylerMapper.cpp b/src/ui/mapper/style/MarginStylerMapper.cpp new file mode 100644 index 00000000..cb2fd7ee --- /dev/null +++ b/src/ui/mapper/style/MarginStylerMapper.cpp @@ -0,0 +1,24 @@ +#include "cru/ui/mapper/style/MarginStylerMapper.h" +#include "cru/ui/mapper/MapperRegistry.h" +#include "cru/ui/render/MeasureRequirement.h" +#include "cru/ui/style/Styler.h" + +namespace cru::ui::mapper::style { +MarginStylerMapper::MarginStylerMapper() { SetAllowedTags({u"MarginStyler"}); } + +MarginStylerMapper::~MarginStylerMapper() {} + +ClonablePtr<ui::style::MarginStyler> MarginStylerMapper::DoMapFromXml( + xml::XmlElementNode* node) { + Thickness thickness; + + auto thickness_mapper = MapperRegistry::GetInstance()->GetMapper<Thickness>(); + + auto value_attribute = node->GetOptionalAttributeCaseInsensitive(u"value"); + if (value_attribute) { + thickness = thickness_mapper->MapFromString(*value_attribute); + } + + return ui::style::MarginStyler::Create(thickness); +} +} // namespace cru::ui::mapper::style |
