aboutsummaryrefslogtreecommitdiff
path: root/src/ThemeBuilder/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/ThemeBuilder/components')
-rw-r--r--src/ThemeBuilder/components/HeadBodyEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/HeadBodyEditor.h4
-rw-r--r--src/ThemeBuilder/components/MainWindow.cpp4
-rw-r--r--src/ThemeBuilder/components/StyleRuleEditor.cpp6
-rw-r--r--src/ThemeBuilder/components/StyleRuleSetEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/conditions/CheckedConditionEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/conditions/ClickStateConditionEditor.cpp14
-rw-r--r--src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp12
-rw-r--r--src/ThemeBuilder/components/conditions/FocusConditionEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/conditions/NoConditionEditor.cpp2
-rw-r--r--src/ThemeBuilder/components/properties/CheckBoxPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/properties/ColorPropertyEditor.cpp8
-rw-r--r--src/ThemeBuilder/components/properties/ColorPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/properties/CornerRadiusPropertyEditor.cpp8
-rw-r--r--src/ThemeBuilder/components/properties/FontPropertyEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/properties/FontPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp9
-rw-r--r--src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/properties/OptionalPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/properties/PointPropertyEditor.cpp8
-rw-r--r--src/ThemeBuilder/components/properties/PointPropertyEditor.h6
-rw-r--r--src/ThemeBuilder/components/properties/SelectPropertyEditor.h8
-rw-r--r--src/ThemeBuilder/components/properties/TextPropertyEditor.cpp7
-rw-r--r--src/ThemeBuilder/components/properties/TextPropertyEditor.h14
-rw-r--r--src/ThemeBuilder/components/properties/ThicknessPropertyEditor.cpp7
-rw-r--r--src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h4
-rw-r--r--src/ThemeBuilder/components/stylers/BorderStylerEditor.cpp10
-rw-r--r--src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp14
-rw-r--r--src/ThemeBuilder/components/stylers/CursorStylerEditor.cpp6
-rw-r--r--src/ThemeBuilder/components/stylers/MarginStylerEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/stylers/PaddingStylerEditor.cpp4
-rw-r--r--src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp6
32 files changed, 103 insertions, 102 deletions
diff --git a/src/ThemeBuilder/components/HeadBodyEditor.cpp b/src/ThemeBuilder/components/HeadBodyEditor.cpp
index 6d7ace66..3cc71d53 100644
--- a/src/ThemeBuilder/components/HeadBodyEditor.cpp
+++ b/src/ThemeBuilder/components/HeadBodyEditor.cpp
@@ -16,8 +16,8 @@ HeadBodyEditor::HeadBodyEditor() {
remove_button_.GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.icon-button.style"));
- remove_button_.SetIconWithSvgPathDataStringResourceKey(u"icon.close",
+ "cru.theme_builder.icon-button.style"));
+ remove_button_.SetIconWithSvgPathDataStringResourceKey("icon.close",
{0, 0, 16, 16});
remove_button_.SetIconFillColor(ui::colors::red);
head_container_.AddChild(&remove_button_);
diff --git a/src/ThemeBuilder/components/HeadBodyEditor.h b/src/ThemeBuilder/components/HeadBodyEditor.h
index 1fcf2f63..c8671841 100644
--- a/src/ThemeBuilder/components/HeadBodyEditor.h
+++ b/src/ThemeBuilder/components/HeadBodyEditor.h
@@ -19,8 +19,8 @@ class HeadBodyEditor : public Editor {
ui::controls::FlexLayout* GetContainer() { return &container_; }
ui::controls::FlexLayout* GetHeadContainer() { return &head_container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
IEvent<std::nullptr_t>* RemoveEvent() { return &remove_event_; }
diff --git a/src/ThemeBuilder/components/MainWindow.cpp b/src/ThemeBuilder/components/MainWindow.cpp
index 0c78ef25..4f5812b1 100644
--- a/src/ThemeBuilder/components/MainWindow.cpp
+++ b/src/ThemeBuilder/components/MainWindow.cpp
@@ -9,12 +9,12 @@ using namespace cru::ui::controls;
using namespace cru::platform::gui;
MainWindow::MainWindow() {
- window_.GetNativeWindow()->SetTitle(u"CruUI Theme Builder");
+ window_.GetNativeWindow()->SetTitle("CruUI Theme Builder");
main_layout_.SetFlexDirection(FlexDirection::Horizontal);
window_.AddChild(&main_layout_);
main_layout_.AddChild(&preview_layout_);
- preview_button_text_.SetText(u"Preview");
+ preview_button_text_.SetText("Preview");
preview_button_.SetChild(&preview_button_text_);
preview_layout_.AddChild(&preview_button_);
preview_layout_.SetChildLayoutData(
diff --git a/src/ThemeBuilder/components/StyleRuleEditor.cpp b/src/ThemeBuilder/components/StyleRuleEditor.cpp
index dcb33184..f3de97b4 100644
--- a/src/ThemeBuilder/components/StyleRuleEditor.cpp
+++ b/src/ThemeBuilder/components/StyleRuleEditor.cpp
@@ -14,14 +14,14 @@ StyleRuleEditor::StyleRuleEditor() {
main_layout_.AddChild(&head_layout_);
- label_.SetText(u"Style Rule");
+ label_.SetText("Style Rule");
head_layout_.AddChild(&label_);
head_layout_.AddChild(&remove_button_);
remove_button_.GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.icon-button.style"));
- remove_button_.SetIconWithSvgPathDataStringResourceKey(u"icon.close",
+ "cru.theme_builder.icon-button.style"));
+ remove_button_.SetIconWithSvgPathDataStringResourceKey("icon.close",
{0, 0, 16, 16});
remove_button_.SetIconFillColor(ui::colors::red);
diff --git a/src/ThemeBuilder/components/StyleRuleSetEditor.cpp b/src/ThemeBuilder/components/StyleRuleSetEditor.cpp
index 1410ff7c..ccffa591 100644
--- a/src/ThemeBuilder/components/StyleRuleSetEditor.cpp
+++ b/src/ThemeBuilder/components/StyleRuleSetEditor.cpp
@@ -23,8 +23,8 @@ StyleRuleSetEditor::StyleRuleSetEditor() {
add_button_.GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.icon-button.style"));
- add_button_.SetIconWithSvgPathDataStringResourceKey(u"icon.plus",
+ "cru.theme_builder.icon-button.style"));
+ add_button_.SetIconWithSvgPathDataStringResourceKey("icon.plus",
{0, 0, 16, 16});
add_button_.SetPreferredSize({24, 24});
add_button_.SetPadding(ui::Thickness(2));
diff --git a/src/ThemeBuilder/components/conditions/CheckedConditionEditor.cpp b/src/ThemeBuilder/components/conditions/CheckedConditionEditor.cpp
index 57e72a0f..04f2ed29 100644
--- a/src/ThemeBuilder/components/conditions/CheckedConditionEditor.cpp
+++ b/src/ThemeBuilder/components/conditions/CheckedConditionEditor.cpp
@@ -4,9 +4,9 @@
namespace cru::theme_builder::components::conditions {
CheckedConditionEditor::CheckedConditionEditor() {
- SetLabel(u"Checked Condition");
+ SetLabel("Checked Condition");
- checked_check_box_.SetLabel(u"Checked");
+ checked_check_box_.SetLabel("Checked");
GetContainer()->AddChild(checked_check_box_.GetRootControl());
ConnectChangeEvent(checked_check_box_);
diff --git a/src/ThemeBuilder/components/conditions/ClickStateConditionEditor.cpp b/src/ThemeBuilder/components/conditions/ClickStateConditionEditor.cpp
index bf0b1d98..57652ef6 100644
--- a/src/ThemeBuilder/components/conditions/ClickStateConditionEditor.cpp
+++ b/src/ThemeBuilder/components/conditions/ClickStateConditionEditor.cpp
@@ -6,11 +6,11 @@
namespace cru::theme_builder::components::conditions {
using ui::helper::ClickState;
namespace {
-const std::vector<String> kClickStates{
- u"None",
- u"Hover",
- u"Press",
- u"PressInactive",
+const std::vector<std::string> kClickStates{
+ "None",
+ "Hover",
+ "Press",
+ "PressInactive",
};
Index ConvertClickStateToIndex(ClickState click_state) {
@@ -43,10 +43,10 @@ ClickState ConvertIndexToClickState(Index index) {
} // namespace
ClickStateConditionEditor::ClickStateConditionEditor() {
- SetLabel(u"Click State Condition");
+ SetLabel("Click State Condition");
GetContainer()->AddChild(click_state_select_.GetRootControl());
- click_state_select_.SetLabel(u"Click State");
+ click_state_select_.SetLabel("Click State");
click_state_select_.SetItems(kClickStates);
click_state_select_.SetSelectedIndex(0, false);
diff --git a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp
index 8be3aa0f..a641c2df 100644
--- a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp
+++ b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp
@@ -14,7 +14,7 @@
namespace cru::theme_builder::components::conditions {
CompoundConditionEditor::CompoundConditionEditor() {
- SetLabel(u"Compound Condition");
+ SetLabel("Compound Condition");
GetContainer()->AddChild(&children_container_);
children_container_.SetMargin({10, 0, 0, 0});
@@ -26,15 +26,15 @@ CompoundConditionEditor::CompoundConditionEditor() {
add_child_button_.GetButton()->GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.icon-button.style"));
+ "cru.theme_builder.icon-button.style"));
add_child_button_.GetButton()->SetIconWithSvgPathDataStringResourceKey(
- u"icon.plus", {0, 0, 16, 16});
+ "icon.plus", {0, 0, 16, 16});
add_child_button_.GetButton()->SetPreferredSize({24, 24});
add_child_button_.GetButton()->SetPadding(ui::Thickness(2));
add_child_button_.GetButton()->SetIconFillColor(ui::colors::green);
- add_child_button_.SetMenuItems({u"And Condition", u"Or Condition",
- u"Click State Condition", u"Focus Condition",
- u"Checked Condition", u"No Condition"});
+ add_child_button_.SetMenuItems({"And Condition", "Or Condition",
+ "Click State Condition", "Focus Condition",
+ "Checked Condition", "No Condition"});
add_child_button_.MenuItemSelectedEvent()->AddHandler([this](Index index) {
std::unique_ptr<ConditionEditor> editor;
switch (index) {
diff --git a/src/ThemeBuilder/components/conditions/FocusConditionEditor.cpp b/src/ThemeBuilder/components/conditions/FocusConditionEditor.cpp
index 78c99b5c..0ac3e224 100644
--- a/src/ThemeBuilder/components/conditions/FocusConditionEditor.cpp
+++ b/src/ThemeBuilder/components/conditions/FocusConditionEditor.cpp
@@ -4,10 +4,10 @@
namespace cru::theme_builder::components::conditions {
FocusConditionEditor::FocusConditionEditor() {
- SetLabel(u"Focus Condition");
+ SetLabel("Focus Condition");
GetContainer()->AddChild(focus_check_box_.GetRootControl());
- focus_check_box_.SetLabel(u"Focus");
+ focus_check_box_.SetLabel("Focus");
ConnectChangeEvent(focus_check_box_);
}
diff --git a/src/ThemeBuilder/components/conditions/NoConditionEditor.cpp b/src/ThemeBuilder/components/conditions/NoConditionEditor.cpp
index a5087159..31b906de 100644
--- a/src/ThemeBuilder/components/conditions/NoConditionEditor.cpp
+++ b/src/ThemeBuilder/components/conditions/NoConditionEditor.cpp
@@ -1,7 +1,7 @@
#include "NoConditionEditor.h"
namespace cru::theme_builder::components::conditions {
-NoConditionEditor::NoConditionEditor() { SetLabel(u"No condition"); }
+NoConditionEditor::NoConditionEditor() { SetLabel("No condition"); }
NoConditionEditor::~NoConditionEditor() {}
} // namespace cru::theme_builder::components::conditions
diff --git a/src/ThemeBuilder/components/properties/CheckBoxPropertyEditor.h b/src/ThemeBuilder/components/properties/CheckBoxPropertyEditor.h
index f78ed6c9..8cdd541b 100644
--- a/src/ThemeBuilder/components/properties/CheckBoxPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/CheckBoxPropertyEditor.h
@@ -15,8 +15,8 @@ class CheckBoxPropertyEditor : public Editor {
public:
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
bool GetValue() const { return check_box_.IsChecked(); }
void SetValue(bool value, bool trigger_change = true);
diff --git a/src/ThemeBuilder/components/properties/ColorPropertyEditor.cpp b/src/ThemeBuilder/components/properties/ColorPropertyEditor.cpp
index 0fe3908e..c048734c 100644
--- a/src/ThemeBuilder/components/properties/ColorPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/ColorPropertyEditor.cpp
@@ -12,7 +12,7 @@ ColorPropertyEditor::ColorPropertyEditor() {
color_cube_.SetBorderEnabled(true);
color_cube_.GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.color_cube.style"));
+ "cru.theme_builder.color_cube.style"));
color_cube_brush_ = platform::gui::IUiApplication::GetInstance()
->GetGraphicsFactory()
@@ -20,12 +20,12 @@ ColorPropertyEditor::ColorPropertyEditor() {
color_cube_.SetForegroundBrush(color_cube_brush_);
- color_text_.SetText(String::FromUtf8(color_.ToString()));
+ color_text_.SetText(color_.ToString());
color_text_.SetMargin(ui::Thickness(10, 0, 0, 0));
color_text_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
auto text = color_text_.GetTextView();
- auto color = ui::Color::Parse(text.ToUtf8());
+ auto color = ui::Color::Parse(text);
if (color) {
color_ = *color;
color_cube_brush_->SetColor(*color);
@@ -43,6 +43,6 @@ ColorPropertyEditor::~ColorPropertyEditor() {}
void ColorPropertyEditor::SetValue(const ui::Color &color,
bool trigger_change) {
if (!trigger_change) SuppressNextChangeEvent();
- color_text_.SetText(String::FromUtf8(color.ToString()));
+ color_text_.SetText(color.ToString());
}
} // namespace cru::theme_builder::components::properties
diff --git a/src/ThemeBuilder/components/properties/ColorPropertyEditor.h b/src/ThemeBuilder/components/properties/ColorPropertyEditor.h
index aa6cfcfa..7c76297b 100644
--- a/src/ThemeBuilder/components/properties/ColorPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/ColorPropertyEditor.h
@@ -17,8 +17,8 @@ class ColorPropertyEditor : public Editor {
public:
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
ui::Color GetValue() const { return color_; }
void SetValue(const ui::Color& color, bool trigger_change = true);
diff --git a/src/ThemeBuilder/components/properties/CornerRadiusPropertyEditor.cpp b/src/ThemeBuilder/components/properties/CornerRadiusPropertyEditor.cpp
index fc86b0ed..47a51ddd 100644
--- a/src/ThemeBuilder/components/properties/CornerRadiusPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/CornerRadiusPropertyEditor.cpp
@@ -6,10 +6,10 @@ namespace cru::theme_builder::components::properties {
CornerRadiusPropertyEditor::CornerRadiusPropertyEditor() {
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"⌟");
+ left_top_editor_.SetLabel("⌜");
+ right_top_editor_.SetLabel("⌝");
+ left_bottom_editor_.SetLabel("⌞");
+ right_bottom_editor_.SetLabel("⌟");
container_.SetFlexDirection(ui::controls::FlexDirection::Vertical);
container_.AddChild(left_top_editor_.GetRootControl());
diff --git a/src/ThemeBuilder/components/properties/FontPropertyEditor.cpp b/src/ThemeBuilder/components/properties/FontPropertyEditor.cpp
index 927ada7d..231e45dd 100644
--- a/src/ThemeBuilder/components/properties/FontPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/FontPropertyEditor.cpp
@@ -20,12 +20,12 @@ FontPropertyEditor::FontPropertyEditor() {
font_family_container_.SetFlexDirection(FlexDirection::Horizontal);
font_family_container_.AddChild(&font_family_label_);
font_family_container_.AddChild(&font_family_text_);
- font_family_label_.SetText(u"Font Family");
+ font_family_label_.SetText("Font Family");
font_size_container_.SetFlexDirection(FlexDirection::Horizontal);
font_size_container_.AddChild(&font_size_label_);
font_size_container_.AddChild(font_size_input_.GetRootControl());
- font_size_label_.SetText(u"Font Size");
+ font_size_label_.SetText("Font Size");
font_size_input_.SetMin(0.0f);
font_family_text_.TextChangeEvent()->AddSpyOnlyHandler(
diff --git a/src/ThemeBuilder/components/properties/FontPropertyEditor.h b/src/ThemeBuilder/components/properties/FontPropertyEditor.h
index d349f1f2..ec6a6b56 100644
--- a/src/ThemeBuilder/components/properties/FontPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/FontPropertyEditor.h
@@ -17,8 +17,8 @@ class FontPropertyEditor : public Editor {
ui::controls::Control* GetRootControl() override;
- String GetLabelText() const { return label_.GetText(); }
- void SetLabelText(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabelText() const { return label_.GetText(); }
+ void SetLabelText(std::string label) { label_.SetText(std::move(label)); }
std::shared_ptr<platform::graphics::IFont> GetValue() const;
void SetValue(std::shared_ptr<platform::graphics::IFont> value,
diff --git a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp
index 9280718d..001665ae 100644
--- a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp
@@ -10,12 +10,12 @@ MeasureLengthPropertyEditor::MeasureLengthPropertyEditor() {
container_.AddChild(&text_);
text_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
- auto text = text_.GetTextView();
+ auto text = text_.GetText();
auto measure_length_mapper = ui::mapper::MapperRegistry::GetInstance()
->GetMapper<ui::render::MeasureLength>();
try {
auto measure_length =
- measure_length_mapper->MapFromString(text.ToString().ToUtf8());
+ measure_length_mapper->MapFromString(text);
measure_length_ = measure_length;
is_text_valid_ = true;
RaiseChangeEvent();
@@ -32,8 +32,7 @@ void MeasureLengthPropertyEditor::SetValue(
const ui::render::MeasureLength& value, bool trigger_change) {
if (!trigger_change) SuppressNextChangeEvent();
text_.SetText(measure_length_.IsNotSpecified()
- ? u"unspecified"
- : String::FromUtf8(std::to_string(
- measure_length_.GetLengthOrUndefined())));
+ ? "unspecified"
+ : std::to_string(measure_length_.GetLengthOrUndefined()));
}
} // namespace cru::theme_builder::components::properties
diff --git a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.h b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.h
index 43e783c5..ee99579f 100644
--- a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.h
@@ -18,8 +18,8 @@ class MeasureLengthPropertyEditor : public Editor {
public:
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
PropertyType GetValue() const { return measure_length_; }
void SetValue(const PropertyType& value, bool trigger_change = true);
diff --git a/src/ThemeBuilder/components/properties/OptionalPropertyEditor.h b/src/ThemeBuilder/components/properties/OptionalPropertyEditor.h
index 0f22616a..8db14114 100644
--- a/src/ThemeBuilder/components/properties/OptionalPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/OptionalPropertyEditor.h
@@ -28,8 +28,8 @@ 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)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
bool IsEnabled() const { return check_box_.IsChecked(); }
void SetEnabled(bool enabled, bool trigger_change = true) {
diff --git a/src/ThemeBuilder/components/properties/PointPropertyEditor.cpp b/src/ThemeBuilder/components/properties/PointPropertyEditor.cpp
index 8d7ac942..82fee18f 100644
--- a/src/ThemeBuilder/components/properties/PointPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/PointPropertyEditor.cpp
@@ -10,11 +10,11 @@ PointPropertyEditor::PointPropertyEditor() {
container_.AddChild(&text_);
text_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
- auto text = text_.GetTextView();
+ auto text = text_.GetText();
auto point_mapper =
ui::mapper::MapperRegistry::GetInstance()->GetMapper<ui::Point>();
try {
- auto point = point_mapper->MapFromString(text.ToString().ToUtf8());
+ auto point = point_mapper->MapFromString(text);
point_ = point;
is_text_valid_ = true;
RaiseChangeEvent();
@@ -33,7 +33,7 @@ void PointPropertyEditor::SetValue(const ui::Point& point,
text_.SetText(ConvertPointToString(point));
}
-String PointPropertyEditor::ConvertPointToString(const ui::Point& point) {
- return String::FromUtf8(std::format("{} {}", point.x, point.y));
+std::string PointPropertyEditor::ConvertPointToString(const ui::Point& point) {
+ return std::format("{} {}", point.x, point.y);
}
} // namespace cru::theme_builder::components::properties
diff --git a/src/ThemeBuilder/components/properties/PointPropertyEditor.h b/src/ThemeBuilder/components/properties/PointPropertyEditor.h
index bd852e3a..4f078c8b 100644
--- a/src/ThemeBuilder/components/properties/PointPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/PointPropertyEditor.h
@@ -15,14 +15,14 @@ class PointPropertyEditor : public Editor {
public:
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
ui::Point GetValue() const { return point_; }
void SetValue(const ui::Point& point, bool trigger_change = true);
private:
- static String ConvertPointToString(const ui::Point& point);
+ static std::string ConvertPointToString(const ui::Point& point);
private:
ui::Point point_;
diff --git a/src/ThemeBuilder/components/properties/SelectPropertyEditor.h b/src/ThemeBuilder/components/properties/SelectPropertyEditor.h
index 475d2d0a..0d6cbfcd 100644
--- a/src/ThemeBuilder/components/properties/SelectPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/SelectPropertyEditor.h
@@ -15,8 +15,8 @@ class SelectPropertyEditor : public Editor {
public:
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
Index GetSelectedIndex() const { return select_.GetSelectedIndex(); }
void SetSelectedIndex(Index index, bool trigger_change = true) {
@@ -24,8 +24,8 @@ class SelectPropertyEditor : public Editor {
select_.SetSelectedIndex(index);
}
- std::vector<String> GetItems() const { return select_.GetItems(); }
- void SetItems(std::vector<String> items) {
+ std::vector<std::string> GetItems() const { return select_.GetItems(); }
+ void SetItems(std::vector<std::string> items) {
select_.SetItems(std::move(items));
}
diff --git a/src/ThemeBuilder/components/properties/TextPropertyEditor.cpp b/src/ThemeBuilder/components/properties/TextPropertyEditor.cpp
index 9854019c..4d34c9e6 100644
--- a/src/ThemeBuilder/components/properties/TextPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/TextPropertyEditor.cpp
@@ -4,7 +4,7 @@ namespace cru::theme_builder::components::properties {
TextPropertyEditor::TextPropertyEditor() {
editor_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
auto text_view = editor_.GetTextView();
- String error_message;
+ std::string error_message;
auto validation_result = Validate(text_view, &error_message);
if (validation_result) {
OnTextChanged(text_view);
@@ -14,9 +14,10 @@ TextPropertyEditor::TextPropertyEditor() {
TextPropertyEditor::~TextPropertyEditor() {}
-bool TextPropertyEditor::Validate(StringView text, String* error_message) {
+bool TextPropertyEditor::Validate(std::string_view text,
+ std::string* error_message) {
return true;
}
-void TextPropertyEditor::OnTextChanged(StringView text) {}
+void TextPropertyEditor::OnTextChanged(std::string_view text) {}
} // namespace cru::theme_builder::components::properties
diff --git a/src/ThemeBuilder/components/properties/TextPropertyEditor.h b/src/ThemeBuilder/components/properties/TextPropertyEditor.h
index c4944228..040f776a 100644
--- a/src/ThemeBuilder/components/properties/TextPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/TextPropertyEditor.h
@@ -12,16 +12,16 @@ class TextPropertyEditor : public ui::components::Component {
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
- String GetText() const { return editor_.GetText(); }
- StringView GetTextView() const { return editor_.GetTextView(); }
- void SetText(String text) { editor_.SetText(std::move(text)); }
+ std::string GetText() const { return editor_.GetText(); }
+ std::string_view GetTextView() const { return editor_.GetTextView(); }
+ void SetText(std::string text) { editor_.SetText(std::move(text)); }
protected:
- virtual bool Validate(StringView text, String* error_message);
- virtual void OnTextChanged(StringView text);
+ virtual bool Validate(std::string_view text, std::string* error_message);
+ virtual void OnTextChanged(std::string_view text);
private:
ui::controls::FlexLayout container_;
diff --git a/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.cpp b/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.cpp
index 0790cd98..2ee13c06 100644
--- a/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.cpp
+++ b/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.cpp
@@ -1,4 +1,5 @@
#include "ThicknessPropertyEditor.h"
+#include <format>
#include "cru/base/Format.h"
#include "cru/ui/mapper/MapperRegistry.h"
#include "cru/ui/mapper/ThicknessMapper.h"
@@ -13,7 +14,7 @@ ThicknessPropertyEditor::ThicknessPropertyEditor() {
auto thickness_mapper =
ui::mapper::MapperRegistry::GetInstance()->GetMapper<ui::Thickness>();
try {
- auto thickness = thickness_mapper->MapFromString(text.ToUtf8());
+ auto thickness = thickness_mapper->MapFromString(text);
thickness_ = thickness;
is_text_valid_ = true;
RaiseChangeEvent();
@@ -29,7 +30,7 @@ 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));
+ text_.SetText(std::format("{} {} {} {}", thickness.left, thickness.top,
+ thickness.right, thickness.bottom));
}
} // namespace cru::theme_builder::components::properties
diff --git a/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h b/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h
index cea9ae9d..dae2e612 100644
--- a/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h
+++ b/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h
@@ -14,8 +14,8 @@ class ThicknessPropertyEditor : public Editor {
ui::controls::Control* GetRootControl() override { return &container_; }
- String GetLabel() const { return label_.GetText(); }
- void SetLabel(String label) { label_.SetText(std::move(label)); }
+ std::string GetLabel() const { return label_.GetText(); }
+ void SetLabel(std::string label) { label_.SetText(std::move(label)); }
ui::Thickness GetValue() const { return thickness_; }
void SetValue(const ui::Thickness& thickness, bool trigger_change = true);
diff --git a/src/ThemeBuilder/components/stylers/BorderStylerEditor.cpp b/src/ThemeBuilder/components/stylers/BorderStylerEditor.cpp
index 1329a08a..5f046a44 100644
--- a/src/ThemeBuilder/components/stylers/BorderStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/BorderStylerEditor.cpp
@@ -8,17 +8,17 @@
namespace cru::theme_builder::components::stylers {
BorderStylerEditor::BorderStylerEditor() {
- SetLabel(u"Border Styler");
+ SetLabel("Border Styler");
GetContainer()->AddChild(corner_radius_editor_.GetRootControl());
GetContainer()->AddChild(thickness_editor_.GetRootControl());
GetContainer()->AddChild(brush_editor_.GetRootControl());
GetContainer()->AddChild(foreground_brush_editor_.GetRootControl());
GetContainer()->AddChild(background_brush_editor_.GetRootControl());
- thickness_editor_.GetEditor()->SetLabel(u"Thickness");
- brush_editor_.GetEditor()->SetLabel(u"Border");
- foreground_brush_editor_.GetEditor()->SetLabel(u"Foreground");
- background_brush_editor_.GetEditor()->SetLabel(u"Background");
+ thickness_editor_.GetEditor()->SetLabel("Thickness");
+ brush_editor_.GetEditor()->SetLabel("Border");
+ foreground_brush_editor_.GetEditor()->SetLabel("Foreground");
+ background_brush_editor_.GetEditor()->SetLabel("Background");
ConnectChangeEvent(corner_radius_editor_);
ConnectChangeEvent(thickness_editor_);
diff --git a/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp b/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp
index c8b2a871..af22217b 100644
--- a/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp
@@ -12,7 +12,7 @@
namespace cru::theme_builder::components::stylers {
CompoundStylerEditor::CompoundStylerEditor() {
- SetLabel(u"Compound Styler");
+ SetLabel("Compound Styler");
GetContainer()->AddChild(&children_container_);
children_container_.SetFlexDirection(ui::controls::FlexDirection::Vertical);
children_container_.SetItemCrossAlign(
@@ -21,16 +21,16 @@ CompoundStylerEditor::CompoundStylerEditor() {
GetHeadContainer()->AddChild(add_child_button_.GetRootControl());
add_child_button_.GetButton()->GetStyleRuleSet()->SetParent(
ui::ThemeManager::GetInstance()->GetResourceStyleRuleSet(
- u"cru.theme_builder.icon-button.style"));
+ "cru.theme_builder.icon-button.style"));
add_child_button_.GetButton()->SetIconWithSvgPathDataStringResourceKey(
- u"icon.plus", {0, 0, 16, 16});
+ "icon.plus", {0, 0, 16, 16});
add_child_button_.GetButton()->SetPreferredSize({24, 24});
add_child_button_.GetButton()->SetPadding(ui::Thickness(2));
add_child_button_.GetButton()->SetIconFillColor(ui::colors::green);
- add_child_button_.SetMenuItems({u"Compound Styler", u"Border Styler",
- u"Cursor Styler", u"Content Brush Styler",
- u"Font Styler", u"Margin Styler",
- u"Padding Styler", u"Preferred Size Styler"});
+ add_child_button_.SetMenuItems({"Compound Styler", "Border Styler",
+ "Cursor Styler", "Content Brush Styler",
+ "Font Styler", "Margin Styler",
+ "Padding Styler", "Preferred Size Styler"});
add_child_button_.MenuItemSelectedEvent()->AddHandler([this](Index index) {
std::unique_ptr<StylerEditor> editor;
switch (index) {
diff --git a/src/ThemeBuilder/components/stylers/CursorStylerEditor.cpp b/src/ThemeBuilder/components/stylers/CursorStylerEditor.cpp
index 9984d81a..71de739a 100644
--- a/src/ThemeBuilder/components/stylers/CursorStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/CursorStylerEditor.cpp
@@ -4,11 +4,11 @@
namespace cru::theme_builder::components::stylers {
CursorStylerEditor::CursorStylerEditor() {
- SetLabel(u"Cursor Styler");
+ SetLabel("Cursor Styler");
GetContainer()->AddChild(cursor_select_.GetRootControl());
- cursor_select_.SetLabel(u"Cursor");
- cursor_select_.SetItems({u"arrow", u"hand", u"ibeam"});
+ cursor_select_.SetLabel("Cursor");
+ cursor_select_.SetItems({"arrow", "hand", "ibeam"});
cursor_select_.SetSelectedIndex(0);
ConnectChangeEvent(cursor_select_);
diff --git a/src/ThemeBuilder/components/stylers/MarginStylerEditor.cpp b/src/ThemeBuilder/components/stylers/MarginStylerEditor.cpp
index d7d89acb..c750e9b6 100644
--- a/src/ThemeBuilder/components/stylers/MarginStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/MarginStylerEditor.cpp
@@ -3,10 +3,10 @@
namespace cru::theme_builder::components::stylers {
MarginStylerEditor::MarginStylerEditor() {
- SetLabel(u"Margin Styler");
+ SetLabel("Margin Styler");
GetContainer()->AddChild(thickness_editor_.GetRootControl());
- thickness_editor_.SetLabel(u"Thickness");
+ thickness_editor_.SetLabel("Thickness");
ConnectChangeEvent(thickness_editor_);
}
diff --git a/src/ThemeBuilder/components/stylers/PaddingStylerEditor.cpp b/src/ThemeBuilder/components/stylers/PaddingStylerEditor.cpp
index 476d21f1..5cf9d3d8 100644
--- a/src/ThemeBuilder/components/stylers/PaddingStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/PaddingStylerEditor.cpp
@@ -3,10 +3,10 @@
namespace cru::theme_builder::components::stylers {
PaddingStylerEditor::PaddingStylerEditor() {
- SetLabel(u"Padding Styler");
+ SetLabel("Padding Styler");
GetContainer()->AddChild(thickness_editor_.GetRootControl());
- thickness_editor_.SetLabel(u"Thickness");
+ thickness_editor_.SetLabel("Thickness");
ConnectChangeEvent(thickness_editor_);
}
diff --git a/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp b/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp
index fb713c8c..f0e700a1 100644
--- a/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp
+++ b/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp
@@ -3,12 +3,12 @@
namespace cru::theme_builder::components::stylers {
PreferredSizeStylerEditor::PreferredSizeStylerEditor() {
- SetLabel(u"Preferred Size Styler");
+ SetLabel("Preferred Size Styler");
GetContainer()->AddChild(width_editor_.GetRootControl());
GetContainer()->AddChild(height_editor_.GetRootControl());
- width_editor_.SetLabel(u"Width");
- height_editor_.SetLabel(u"Height");
+ width_editor_.SetLabel("Width");
+ height_editor_.SetLabel("Height");
ConnectChangeEvent(width_editor_);
ConnectChangeEvent(height_editor_);