aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/HeadBodyEditor.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-03-29 22:55:29 +0800
committercrupest <crupest@outlook.com>2022-03-29 22:55:29 +0800
commit77e217af8bdbfb20b9147f6159d5bdfda439ea95 (patch)
tree46873c9dc28ad7d0f900a8f7610a1ea4b881f75e /src/theme_builder/components/HeadBodyEditor.cpp
parent6c09f49d51a564ff4dd0a6d3fa9804dffc2b236c (diff)
downloadcru-77e217af8bdbfb20b9147f6159d5bdfda439ea95.tar.gz
cru-77e217af8bdbfb20b9147f6159d5bdfda439ea95.tar.bz2
cru-77e217af8bdbfb20b9147f6159d5bdfda439ea95.zip
...
Diffstat (limited to 'src/theme_builder/components/HeadBodyEditor.cpp')
-rw-r--r--src/theme_builder/components/HeadBodyEditor.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/theme_builder/components/HeadBodyEditor.cpp b/src/theme_builder/components/HeadBodyEditor.cpp
new file mode 100644
index 00000000..6d7ace66
--- /dev/null
+++ b/src/theme_builder/components/HeadBodyEditor.cpp
@@ -0,0 +1,30 @@
+#include "HeadBodyEditor.h"
+#include "Common.h"
+#include "cru/ui/ThemeManager.h"
+#include "cru/ui/controls/FlexLayout.h"
+
+namespace cru::theme_builder::components {
+HeadBodyEditor::HeadBodyEditor() {
+ border_.SetChild(&container_);
+ border_.SetBackgroundBrush(CreateRandomEditorBackgroundBrush());
+
+ container_.SetFlexDirection(ui::controls::FlexDirection::Vertical);
+ container_.AddChild(&head_container_);
+ container_.SetItemCrossAlign(ui::controls::FlexCrossAlignment::Stretch);
+ head_container_.SetFlexDirection(ui::controls::FlexDirection::Horizontal);
+ head_container_.AddChild(&label_);
+
+ remove_button_.GetStyleRuleSet()->SetParent(
+ ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
+ u"cru.theme_builder.icon-button.style"));
+ remove_button_.SetIconWithSvgPathDataStringResourceKey(u"icon.close",
+ {0, 0, 16, 16});
+ remove_button_.SetIconFillColor(ui::colors::red);
+ head_container_.AddChild(&remove_button_);
+
+ remove_button_.ClickEvent()->AddSpyOnlyHandler(
+ [this] { remove_event_.Raise(nullptr); });
+}
+
+HeadBodyEditor::~HeadBodyEditor() {}
+} // namespace cru::theme_builder::components