aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/properties/ThicknessPropertyEditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/theme_builder/components/properties/ThicknessPropertyEditor.cpp')
-rw-r--r--src/theme_builder/components/properties/ThicknessPropertyEditor.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/theme_builder/components/properties/ThicknessPropertyEditor.cpp b/src/theme_builder/components/properties/ThicknessPropertyEditor.cpp
deleted file mode 100644
index 3e022bb1..00000000
--- a/src/theme_builder/components/properties/ThicknessPropertyEditor.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "ThicknessPropertyEditor.h"
-#include "cru/ui/mapper/MapperRegistry.h"
-#include "cru/ui/mapper/ThicknessMapper.h"
-
-namespace cru::theme_builder::components::properties {
-ThicknessPropertyEditor::ThicknessPropertyEditor() {
- container_.AddChild(&label_);
- container_.AddChild(&text_);
-
- text_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
- auto text = text_.GetText();
- auto thickness_mapper =
- ui::mapper::MapperRegistry::GetInstance()->GetMapper<ui::Thickness>();
- try {
- auto thickness = thickness_mapper->MapFromString(text);
- thickness_ = thickness;
- is_text_valid_ = true;
- RaiseChangeEvent();
- } catch (const Exception &) {
- is_text_valid_ = false;
- // TODO: Show error!
- }
- });
-}
-
-ThicknessPropertyEditor::~ThicknessPropertyEditor() {}
-
-void ThicknessPropertyEditor::SetValue(const ui::Thickness &thickness,
- bool trigger_change) {
- if (!trigger_change) SuppressNextChangeEvent();
- text_.SetText(Format(u"{} {} {} {}", thickness.left, thickness.top,
- thickness.right, thickness.bottom));
-}
-} // namespace cru::theme_builder::components::properties