aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/stylers/CompoundStylerEditor.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-17 18:32:52 +0800
committercrupest <crupest@outlook.com>2022-02-17 18:32:52 +0800
commitada641977cd57a50fc862243ba256c58efc065b8 (patch)
tree0f2124b88496f42e2cce2e3aaa64211131c18b37 /src/theme_builder/components/stylers/CompoundStylerEditor.cpp
parent9b3b13f78fffefb18f64aad88891d36009a8052e (diff)
downloadcru-ada641977cd57a50fc862243ba256c58efc065b8.tar.gz
cru-ada641977cd57a50fc862243ba256c58efc065b8.tar.bz2
cru-ada641977cd57a50fc862243ba256c58efc065b8.zip
...
Diffstat (limited to 'src/theme_builder/components/stylers/CompoundStylerEditor.cpp')
-rw-r--r--src/theme_builder/components/stylers/CompoundStylerEditor.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/theme_builder/components/stylers/CompoundStylerEditor.cpp b/src/theme_builder/components/stylers/CompoundStylerEditor.cpp
index 568c34f3..ac1cc0ea 100644
--- a/src/theme_builder/components/stylers/CompoundStylerEditor.cpp
+++ b/src/theme_builder/components/stylers/CompoundStylerEditor.cpp
@@ -12,7 +12,7 @@ CompoundStylerEditorChild::CompoundStylerEditorChild(
container_.AddChild(&remove_button_);
remove_button_.SetChild(&remove_button_text_);
- remove_button_text_.SetText(u"-");
+ remove_button_text_.SetText(u"X");
container_.AddChild(styler_editor_->GetRootControl());
@@ -49,17 +49,18 @@ CompoundStylerEditor::CompoundStylerEditor() {
break;
}
if (editor) {
+ ConnectChangeEvent(editor.get());
auto child =
std::make_unique<CompoundStylerEditorChild>(std::move(editor));
child->RemoveEvent()->AddSpyOnlyHandler([this, c = child.get()] {
auto index = this->children_container_.IndexOf(c->GetRootControl());
this->children_.erase(this->children_.begin() + index);
this->children_container_.RemoveChildAt(index);
- change_event_.Raise(nullptr);
+ RaiseChangeEvent();
});
children_container_.AddChild(child->GetRootControl());
children_.push_back(std::move(child));
- change_event_.Raise(nullptr);
+ RaiseChangeEvent();
}
});
}
@@ -80,18 +81,16 @@ void CompoundStylerEditor::SetValue(ui::style::CompoundStyler* value,
children_container_.ClearChildren();
for (const auto& styler : value->GetChildren()) {
auto editor = CreateStylerEditor(styler.get());
- if (editor) {
- auto child =
- std::make_unique<CompoundStylerEditorChild>(std::move(editor));
- child->RemoveEvent()->AddSpyOnlyHandler([this, c = child.get()] {
- auto index = this->children_container_.IndexOf(c->GetRootControl());
- this->children_.erase(this->children_.begin() + index);
- this->children_container_.RemoveChildAt(index);
- change_event_.Raise(nullptr);
- });
- children_.push_back(std::move(child));
- children_container_.AddChild(children_.back()->GetRootControl());
- }
+ ConnectChangeEvent(editor.get());
+ auto child = std::make_unique<CompoundStylerEditorChild>(std::move(editor));
+ child->RemoveEvent()->AddSpyOnlyHandler([this, c = child.get()] {
+ auto index = this->children_container_.IndexOf(c->GetRootControl());
+ this->children_.erase(this->children_.begin() + index);
+ this->children_container_.RemoveChildAt(index);
+ RaiseChangeEvent();
+ });
+ children_.push_back(std::move(child));
+ children_container_.AddChild(children_.back()->GetRootControl());
}
}
} // namespace cru::theme_builder::components::stylers