aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/properties
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-26 21:13:52 +0800
committercrupest <crupest@outlook.com>2022-02-26 21:13:52 +0800
commit38221428a5ea4bc71f03508dafdc6ad65ebfbea1 (patch)
tree3248edb39faf98aa19647f30477bcc6cf734ebb3 /src/theme_builder/components/properties
parent8da596f7b5fdbcf11fbda4aa66efc87a219f58ae (diff)
downloadcru-38221428a5ea4bc71f03508dafdc6ad65ebfbea1.tar.gz
cru-38221428a5ea4bc71f03508dafdc6ad65ebfbea1.tar.bz2
cru-38221428a5ea4bc71f03508dafdc6ad65ebfbea1.zip
...
Diffstat (limited to 'src/theme_builder/components/properties')
-rw-r--r--src/theme_builder/components/properties/CornerRadiusPropertyEditor.cpp11
-rw-r--r--src/theme_builder/components/properties/OptionalPropertyEditor.h7
2 files changed, 14 insertions, 4 deletions
diff --git a/src/theme_builder/components/properties/CornerRadiusPropertyEditor.cpp b/src/theme_builder/components/properties/CornerRadiusPropertyEditor.cpp
index 91e2c614..fc86b0ed 100644
--- a/src/theme_builder/components/properties/CornerRadiusPropertyEditor.cpp
+++ b/src/theme_builder/components/properties/CornerRadiusPropertyEditor.cpp
@@ -1,12 +1,15 @@
#include "CornerRadiusPropertyEditor.h"
#include "cru/ui/Base.h"
+#include "cru/ui/controls/FlexLayout.h"
namespace cru::theme_builder::components::properties {
CornerRadiusPropertyEditor::CornerRadiusPropertyEditor() {
- left_top_editor_.SetLabel(u"Left Top");
- right_top_editor_.SetLabel(u"Right Top");
- left_bottom_editor_.SetLabel(u"Left Bottom");
- right_bottom_editor_.SetLabel(u"Right Bottom");
+ container_.SetItemCrossAlign(ui::controls::FlexCrossAlignment::Start);
+
+ left_top_editor_.SetLabel(u"⌜");
+ right_top_editor_.SetLabel(u"⌝");
+ left_bottom_editor_.SetLabel(u"⌞");
+ right_bottom_editor_.SetLabel(u"⌟");
container_.SetFlexDirection(ui::controls::FlexDirection::Vertical);
container_.AddChild(left_top_editor_.GetRootControl());
diff --git a/src/theme_builder/components/properties/OptionalPropertyEditor.h b/src/theme_builder/components/properties/OptionalPropertyEditor.h
index d7362d50..0f22616a 100644
--- a/src/theme_builder/components/properties/OptionalPropertyEditor.h
+++ b/src/theme_builder/components/properties/OptionalPropertyEditor.h
@@ -2,6 +2,7 @@
#include "../Editor.h"
#include "cru/ui/controls/CheckBox.h"
#include "cru/ui/controls/FlexLayout.h"
+#include "cru/ui/controls/TextBlock.h"
#include <optional>
@@ -12,7 +13,9 @@ class OptionalPropertyEditor : public Editor {
using PropertyType = typename TEditor::PropertyType;
OptionalPropertyEditor() {
+ container_.AddChild(&label_);
container_.AddChild(&check_box_);
+ check_box_.SetMargin({0, 0, 10, 0});
container_.AddChild(editor_.GetRootControl());
editor_.ChangeEvent()->AddHandler([this](std::nullptr_t) {
@@ -25,6 +28,9 @@ class OptionalPropertyEditor : public Editor {
ui::controls::Control* GetRootControl() override { return &container_; }
+ String GetLabel() const { return label_.GetText(); }
+ void SetLabel(String label) { label_.SetText(std::move(label)); }
+
bool IsEnabled() const { return check_box_.IsChecked(); }
void SetEnabled(bool enabled, bool trigger_change = true) {
check_box_.SetChecked(enabled);
@@ -52,6 +58,7 @@ class OptionalPropertyEditor : public Editor {
private:
ui::controls::FlexLayout container_;
+ ui::controls::TextBlock label_;
ui::controls::CheckBox check_box_;
TEditor editor_;
};