aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/stylers/MarginStylerEditor.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-26 20:12:54 +0800
committercrupest <crupest@outlook.com>2022-02-26 20:12:54 +0800
commit673f1939beb1b477a23d9641a07a2e05fff903b4 (patch)
tree048ba6b4eab749266d8e2ec05df182bedcf3499f /src/theme_builder/components/stylers/MarginStylerEditor.cpp
parent65e288c40a593965b41378755f7111c56e123295 (diff)
downloadcru-673f1939beb1b477a23d9641a07a2e05fff903b4.tar.gz
cru-673f1939beb1b477a23d9641a07a2e05fff903b4.tar.bz2
cru-673f1939beb1b477a23d9641a07a2e05fff903b4.zip
...
Diffstat (limited to 'src/theme_builder/components/stylers/MarginStylerEditor.cpp')
-rw-r--r--src/theme_builder/components/stylers/MarginStylerEditor.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/theme_builder/components/stylers/MarginStylerEditor.cpp b/src/theme_builder/components/stylers/MarginStylerEditor.cpp
new file mode 100644
index 00000000..d7d89acb
--- /dev/null
+++ b/src/theme_builder/components/stylers/MarginStylerEditor.cpp
@@ -0,0 +1,28 @@
+#include "MarginStylerEditor.h"
+#include "cru/ui/style/Styler.h"
+
+namespace cru::theme_builder::components::stylers {
+MarginStylerEditor::MarginStylerEditor() {
+ SetLabel(u"Margin Styler");
+ GetContainer()->AddChild(thickness_editor_.GetRootControl());
+
+ thickness_editor_.SetLabel(u"Thickness");
+
+ ConnectChangeEvent(thickness_editor_);
+}
+
+MarginStylerEditor::~MarginStylerEditor() {}
+
+ClonablePtr<ui::style::MarginStyler> MarginStylerEditor::GetValue() {
+ return ui::style::MarginStyler::Create(thickness_editor_.GetValue());
+}
+
+void MarginStylerEditor::SetValue(ui::style::MarginStyler* styler,
+ bool trigger_change) {
+ thickness_editor_.SetValue(styler->GetMargin(), false);
+
+ if (trigger_change) {
+ RaiseChangeEvent();
+ }
+}
+} // namespace cru::theme_builder::components::stylers