diff options
Diffstat (limited to 'src/ui')
28 files changed, 178 insertions, 187 deletions
diff --git a/src/ui/Helper.h b/src/ui/Helper.h index 8bee72a6..625ba6e3 100644 --- a/src/ui/Helper.h +++ b/src/ui/Helper.h @@ -1,14 +1,5 @@ #pragma once -#include "cru/ui/Base.h" - -namespace cru::platform { -namespace graphics { -struct IGraphicsFactory; -} -namespace native { -struct IUiApplication; -} // namespace native -} // namespace cru::platform +#include <cru/platform/gui/UiApplication.h> namespace cru::ui { cru::platform::graphics::IGraphicsFactory* GetGraphicsFactory(); diff --git a/src/ui/ThemeManager.cpp b/src/ui/ThemeManager.cpp index a95900b4..0f4daeb7 100644 --- a/src/ui/ThemeManager.cpp +++ b/src/ui/ThemeManager.cpp @@ -1,14 +1,9 @@ #include "cru/ui/ThemeManager.h" -#include "Helper.h" -#include "cru/base/StringUtil.h" #include "cru/base/io/Resource.h" #include "cru/platform/graphics/Brush.h" -#include "cru/platform/graphics/Factory.h" -#include "cru/platform/gui/UiApplication.h" #include "cru/ui/ThemeResourceDictionary.h" #include "cru/ui/style/StyleRuleSet.h" -#include "cru/xml/XmlParser.h" namespace cru::ui { ThemeManager* ThemeManager::GetInstance() { @@ -48,22 +43,22 @@ void ThemeManager::PrependThemeResourceDictionary( theme_resource_change_event_.Raise(nullptr); } -String ThemeManager::GetResourceString(const String& key) { - return GetResource<String>(key); +std::string ThemeManager::GetResourceString(std::string_view key) { + return GetResource<String>(key).ToUtf8(); } std::shared_ptr<platform::graphics::IBrush> ThemeManager::GetResourceBrush( - const String& key) { + std::string_view key) { return GetResource<std::shared_ptr<platform::graphics::IBrush>>(key); } std::shared_ptr<platform::graphics::IFont> ThemeManager::GetResourceFont( - const String& key) { + std::string_view key) { return GetResource<std::shared_ptr<platform::graphics::IFont>>(key); } std::shared_ptr<style::StyleRuleSet> ThemeManager::GetResourceStyleRuleSet( - const String& key) { + std::string_view key) { return GetResource<std::shared_ptr<style::StyleRuleSet>>(key); } } // namespace cru::ui diff --git a/src/ui/ThemeResourceDictionary.cpp b/src/ui/ThemeResourceDictionary.cpp index d6f2d3e3..f76bdde8 100644 --- a/src/ui/ThemeResourceDictionary.cpp +++ b/src/ui/ThemeResourceDictionary.cpp @@ -43,7 +43,7 @@ void ThemeResourceDictionary::UpdateResourceMap(xml::XmlElementNode* xml_root) { ResourceEntry entry; - entry.name = String::FromUtf8(*key_attr); + entry.name = *key_attr; entry.xml_node = c->GetFirstChildElement(); resource_map_[entry.name] = std::move(entry); diff --git a/src/ui/components/Input.cpp b/src/ui/components/Input.cpp index 6a53b938..e75eccc5 100644 --- a/src/ui/components/Input.cpp +++ b/src/ui/components/Input.cpp @@ -1,13 +1,13 @@ #include "cru/ui/components/Input.h" -#include "cru/base/Format.h" #include "cru/base/StringToNumberConverter.h" #include "cru/ui/controls/Control.h" #include <cmath> #include <optional> +#include <string> namespace cru::ui::components { -Input::Input() : last_validate_result_{true, u"Good value"} { +Input::Input() : last_validate_result_{true, "Good value"} { text_box_.TextChangeEvent()->AddSpyOnlyHandler([this] { auto text = text_box_.GetText(); auto validate_result = Validate(); @@ -20,9 +20,9 @@ Input::~Input() {} controls::Control* Input::GetRootControl() { return &text_box_; } -String Input::GetText() const { return text_box_.GetText(); } +std::string Input::GetText() const { return text_box_.GetText(); } -void Input::SetText(String text) { text_box_.SetText(std::move(text)); } +void Input::SetText(std::string text) { text_box_.SetText(std::move(text)); } IInputValidator* Input::GetValidator() const { return validator_; } @@ -35,7 +35,7 @@ InputValidateResult Input::Validate() { if (validator_) last_validate_result_ = validator_->Validate(text_box_.GetTextView()); else - last_validate_result_ = {true, u"Good value"}; + last_validate_result_ = {true, "Good value"}; return last_validate_result_; } @@ -43,23 +43,23 @@ InputValidateResult Input::GetLastValidateResult() const { return last_validate_result_; } -InputValidateResult FloatInputValidator::Validate(StringView text) const { - auto result = - text.ParseToFloat(nullptr, StringToNumberFlags::kAllowLeadingSpaces & - StringToNumberFlags::kAllowTrailingSpaces); +InputValidateResult FloatInputValidator::Validate(std::string_view text) const { + auto result = String::FromUtf8(text).ParseToFloat( + nullptr, StringToNumberFlags::kAllowLeadingSpaces & + StringToNumberFlags::kAllowTrailingSpaces); if (std::isnan(result)) { - return InputValidateResult{false, u"Invalid number."}; + return InputValidateResult{false, "Invalid number."}; } if (min && result < *min) { - return InputValidateResult{false, u"Value is less than minimum."}; + return InputValidateResult{false, "Value is less than minimum."}; } if (max && result > *max) { - return InputValidateResult{false, u"Value is greater than maximum."}; + return InputValidateResult{false, "Value is greater than maximum."}; } - return InputValidateResult{true, u"Good number"}; + return InputValidateResult{true, "Good number"}; } FloatInput::FloatInput() { @@ -67,7 +67,7 @@ FloatInput::FloatInput() { ChangeEvent()->AddHandler([this](const InputChangeEventArgs& args) { if (args.valid) { - value_ = args.text.ParseToFloat( + value_ = String::FromUtf8(args.text).ParseToFloat( nullptr, StringToNumberFlags::kAllowLeadingSpaces & StringToNumberFlags::kAllowTrailingSpaces); } @@ -78,7 +78,7 @@ FloatInput::~FloatInput() {} float FloatInput::GetValue() const { return value_; } -void FloatInput::SetValue(float value) { SetText(ToString(value)); } +void FloatInput::SetValue(float value) { SetText(std::to_string(value)); } std::optional<float> FloatInput::GetMin() const { return validator_.min; } diff --git a/src/ui/components/Menu.cpp b/src/ui/components/Menu.cpp index 2da38990..59bcf8ec 100644 --- a/src/ui/components/Menu.cpp +++ b/src/ui/components/Menu.cpp @@ -14,17 +14,17 @@ namespace cru::ui::components { MenuItem::MenuItem() { container_.SetChild(&text_); container_.GetStyleRuleSet()->SetParent( - ThemeManager::GetInstance()->GetResourceStyleRuleSet(u"menuitem.style")); + ThemeManager::GetInstance()->GetResourceStyleRuleSet("menuitem.style")); container_.ClickEvent()->AddHandler([this](const helper::ClickEventArgs&) { if (this->on_click_) this->on_click_(); }); } -MenuItem::MenuItem(String text) : MenuItem() { SetText(std::move(text)); } +MenuItem::MenuItem(std::string text) : MenuItem() { SetText(std::move(text)); } MenuItem::~MenuItem() {} -void MenuItem::SetText(String text) { text_.SetText(std::move(text)); } +void MenuItem::SetText(std::string text) { text_.SetText(std::move(text)); } Menu::Menu() { container_.SetFlexDirection(controls::FlexDirection::Vertical); @@ -65,7 +65,7 @@ void Menu::ClearItems() { container_.ClearChildren(); } -void Menu::AddTextItemAt(String text, Index index, +void Menu::AddTextItemAt(std::string text, Index index, std::function<void()> on_click) { MenuItem* item = new MenuItem(std::move(text)); item->SetOnClick([this, index, on_click = std::move(on_click)] { diff --git a/src/ui/components/PopupButton.cpp b/src/ui/components/PopupButton.cpp index 41e0ad6c..5ea41d78 100644 --- a/src/ui/components/PopupButton.cpp +++ b/src/ui/components/PopupButton.cpp @@ -14,7 +14,7 @@ PopupMenuTextButton::PopupMenuTextButton() : popup_menu_(&button_) { PopupMenuTextButton::~PopupMenuTextButton() {} -void PopupMenuTextButton::SetMenuItems(std::vector<String> items) { +void PopupMenuTextButton::SetMenuItems(std::vector<std::string> items) { popup_menu_.GetMenu()->ClearItems(); for (Index i = 0; i < items.size(); i++) { popup_menu_.GetMenu()->AddTextItem( @@ -31,7 +31,7 @@ PopupMenuIconButton::PopupMenuIconButton() : popup_menu_(&button_) { PopupMenuIconButton::~PopupMenuIconButton() {} -void PopupMenuIconButton::SetMenuItems(std::vector<String> items) { +void PopupMenuIconButton::SetMenuItems(std::vector<std::string> items) { popup_menu_.GetMenu()->ClearItems(); for (Index i = 0; i < items.size(); i++) { popup_menu_.GetMenu()->AddTextItem( diff --git a/src/ui/components/Select.cpp b/src/ui/components/Select.cpp index 90b49d30..5dbb727c 100644 --- a/src/ui/components/Select.cpp +++ b/src/ui/components/Select.cpp @@ -15,7 +15,7 @@ Select::Select() { Select::~Select() {} -void Select::SetItems(std::vector<String> items) { +void Select::SetItems(std::vector<std::string> items) { items_ = items; popup_menu_.GetMenu()->ClearItems(); for (Index i = 0; i < items.size(); i++) { diff --git a/src/ui/controls/Button.cpp b/src/ui/controls/Button.cpp index d7d157c5..a44a7074 100644 --- a/src/ui/controls/Button.cpp +++ b/src/ui/controls/Button.cpp @@ -1,9 +1,5 @@ #include "cru/ui/controls/Button.h" -#include "../Helper.h" -#include "cru/platform/graphics/Brush.h" -#include "cru/platform/gui/Cursor.h" -#include "cru/platform/gui/UiApplication.h" #include "cru/ui/ThemeManager.h" #include "cru/ui/helper/ClickDetector.h" #include "cru/ui/render/BorderRenderObject.h" @@ -12,7 +8,7 @@ namespace cru::ui::controls { Button::Button() : click_detector_(this) { GetContainerRenderObject()->SetBorderEnabled(true); auto default_button_style = - ThemeManager::GetInstance()->GetResourceStyleRuleSet(u"button.style"); + ThemeManager::GetInstance()->GetResourceStyleRuleSet("button.style"); GetStyleRuleSet()->SetParent(std::move(default_button_style)); } diff --git a/src/ui/controls/CheckBox.cpp b/src/ui/controls/CheckBox.cpp index a28c4633..778a7b4f 100644 --- a/src/ui/controls/CheckBox.cpp +++ b/src/ui/controls/CheckBox.cpp @@ -11,7 +11,7 @@ CheckBox::CheckBox() container_render_object_->SetBorderEnabled(true); auto default_checkbox_style = - ThemeManager::GetInstance()->GetResourceStyleRuleSet(u"checkbox.style"); + ThemeManager::GetInstance()->GetResourceStyleRuleSet("checkbox.style"); GetStyleRuleSet()->SetParent(std::move(default_checkbox_style)); click_detector_.ClickEvent()->AddHandler( diff --git a/src/ui/controls/IconButton.cpp b/src/ui/controls/IconButton.cpp index 01ecabdd..059a7784 100644 --- a/src/ui/controls/IconButton.cpp +++ b/src/ui/controls/IconButton.cpp @@ -17,10 +17,10 @@ IconButton::IconButton() container_render_object_->SetBorderEnabled(true); GetStyleRuleSet()->SetParent( ThemeManager::GetInstance()->GetResourceStyleRuleSet( - u"icon-button.style")); + "icon-button.style")); } -IconButton::IconButton(StringView icon_svg_path_data_string, +IconButton::IconButton(std::string_view icon_svg_path_data_string, const Rect& view_port) : IconButton() { SetIconWithSvgPathDataString(icon_svg_path_data_string, view_port); @@ -33,18 +33,18 @@ void IconButton::SetIconFillColor(const Color& color) { } void IconButton::SetIconWithSvgPathDataString( - StringView icon_svg_path_data_string, const Rect& view_port) { + std::string_view icon_svg_path_data_string, const Rect& view_port) { SetIconGeometry(platform::graphics::CreateGeometryFromSvgPathData( GetGraphicsFactory(), icon_svg_path_data_string), view_port); } void IconButton::SetIconWithSvgPathDataStringResourceKey( - StringView icon_svg_path_data_string_resource_key, const Rect& view_port) { - SetIconWithSvgPathDataString( - ThemeManager::GetInstance()->GetResourceString( - icon_svg_path_data_string_resource_key.ToString()), - view_port); + std::string_view icon_svg_path_data_string_resource_key, + const Rect& view_port) { + SetIconWithSvgPathDataString(ThemeManager::GetInstance()->GetResourceString( + icon_svg_path_data_string_resource_key), + view_port); } } // namespace cru::ui::controls diff --git a/src/ui/controls/TextBlock.cpp b/src/ui/controls/TextBlock.cpp index 0dad4f5d..790c534b 100644 --- a/src/ui/controls/TextBlock.cpp +++ b/src/ui/controls/TextBlock.cpp @@ -15,10 +15,10 @@ TextBlock::TextBlock() { const auto theme_manager = ThemeManager::GetInstance(); text_render_object_ = std::make_unique<TextRenderObject>( - theme_manager->GetResourceBrush(u"text.brush"), - theme_manager->GetResourceFont(u"text.font"), - theme_manager->GetResourceBrush(u"text.selection.brush"), - theme_manager->GetResourceBrush(u"text.caret.brush")); + theme_manager->GetResourceBrush("text.brush"), + theme_manager->GetResourceFont("text.font"), + theme_manager->GetResourceBrush("text.selection.brush"), + theme_manager->GetResourceBrush("text.caret.brush")); text_render_object_->SetAttachedControl(this); @@ -34,9 +34,11 @@ render::RenderObject* TextBlock::GetRenderObject() const { return text_render_object_.get(); } -String TextBlock::GetText() const { return service_->GetText(); } +std::string TextBlock::GetText() const { return service_->GetText(); } -void TextBlock::SetText(String text) { service_->SetText(std::move(text)); } +void TextBlock::SetText(std::string text) { + service_->SetText(std::move(text)); +} bool TextBlock::IsSelectable() const { return service_->IsEnabled(); } diff --git a/src/ui/controls/TextBox.cpp b/src/ui/controls/TextBox.cpp index 87672b4f..70695a01 100644 --- a/src/ui/controls/TextBox.cpp +++ b/src/ui/controls/TextBox.cpp @@ -18,10 +18,10 @@ TextBox::TextBox() auto theme_manager = ThemeManager::GetInstance(); text_render_object_ = std::make_unique<TextRenderObject>( - theme_manager->GetResourceBrush(u"text.brush"), - theme_manager->GetResourceFont(u"text.font"), - theme_manager->GetResourceBrush(u"text.selection.brush"), - theme_manager->GetResourceBrush(u"text.caret.brush")); + theme_manager->GetResourceBrush("text.brush"), + theme_manager->GetResourceFont("text.font"), + theme_manager->GetResourceBrush("text.selection.brush"), + theme_manager->GetResourceBrush("text.caret.brush")); text_render_object_->SetEditMode(true); border_render_object_->SetChild(scroll_render_object_.get()); @@ -40,7 +40,7 @@ TextBox::TextBox() border_render_object_->SetBorderEnabled(true); GetStyleRuleSet()->SetParent( - theme_manager->GetResourceStyleRuleSet(u"textbox.style")); + theme_manager->GetResourceStyleRuleSet("textbox.style")); } TextBox::~TextBox() {} diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp index 690aa95d..bb723e3f 100644 --- a/src/ui/controls/TextHostControlService.cpp +++ b/src/ui/controls/TextHostControlService.cpp @@ -1,8 +1,8 @@ #include "cru/ui/controls/TextHostControlService.h" +#include <cru/platform/gui/Input.h> #include "../Helper.h" #include "cru/base/Base.h" -#include "cru/base/String.h" #include "cru/base/StringUtil.h" #include "cru/base/log/Logger.h" #include "cru/platform/graphics/Font.h" @@ -10,7 +10,6 @@ #include "cru/platform/gui/Clipboard.h" #include "cru/platform/gui/Cursor.h" #include "cru/platform/gui/InputMethod.h" -#include "cru/platform/gui/Keyboard.h" #include "cru/platform/gui/UiApplication.h" #include "cru/platform/gui/Window.h" #include "cru/ui/Base.h" @@ -27,42 +26,42 @@ namespace cru::ui::controls { TextControlMovePattern TextControlMovePattern::kLeft( - u"Left", helper::ShortcutKeyBind(platform::gui::KeyCode::Left), - [](TextHostControlService* service, StringView text, + "Left", helper::ShortcutKeyBind(platform::gui::KeyCode::Left), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - Utf16PreviousCodePoint(text, current_position, ¤t_position); + Utf8PreviousCodePoint(text, current_position, ¤t_position); return current_position; }); TextControlMovePattern TextControlMovePattern::kRight( - u"Right", helper::ShortcutKeyBind(platform::gui::KeyCode::Right), - [](TextHostControlService* service, StringView text, + "Right", helper::ShortcutKeyBind(platform::gui::KeyCode::Right), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - Utf16NextCodePoint(text, current_position, ¤t_position); + Utf8NextCodePoint(text, current_position, ¤t_position); return current_position; }); TextControlMovePattern TextControlMovePattern::kCtrlLeft( - u"Ctrl+Left(Previous Word)", + "Ctrl+Left(Previous Word)", helper::ShortcutKeyBind(platform::gui::KeyCode::Left, - platform::gui::KeyModifiers::ctrl), - [](TextHostControlService* service, StringView text, + platform::gui::KeyModifiers::Ctrl), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - return Utf16PreviousWord(text, current_position); + return Utf8PreviousWord(text, current_position); }); TextControlMovePattern TextControlMovePattern::kCtrlRight( - u"Ctrl+Right(Next Word)", + "Ctrl+Right(Next Word)", helper::ShortcutKeyBind(platform::gui::KeyCode::Right, - platform::gui::KeyModifiers::ctrl), - [](TextHostControlService* service, StringView text, + platform::gui::KeyModifiers::Ctrl), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - return Utf16NextWord(text, current_position); + return Utf8NextWord(text, current_position); }); TextControlMovePattern TextControlMovePattern::kUp( - u"Up", helper::ShortcutKeyBind(platform::gui::KeyCode::Up), - [](TextHostControlService* service, StringView text, + "Up", helper::ShortcutKeyBind(platform::gui::KeyCode::Up), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(text) auto text_render_object = service->GetTextRenderObject(); @@ -72,8 +71,8 @@ TextControlMovePattern TextControlMovePattern::kUp( return result.trailing ? result.position + 1 : result.position; }); TextControlMovePattern TextControlMovePattern::kDown( - u"Down", helper::ShortcutKeyBind(platform::gui::KeyCode::Down), - [](TextHostControlService* service, StringView text, + "Down", helper::ShortcutKeyBind(platform::gui::KeyCode::Down), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(text) auto text_render_object = service->GetTextRenderObject(); @@ -83,26 +82,26 @@ TextControlMovePattern TextControlMovePattern::kDown( return result.trailing ? result.position + 1 : result.position; }); TextControlMovePattern TextControlMovePattern::kHome( - u"Home(Line Begin)", helper::ShortcutKeyBind(platform::gui::KeyCode::Home), - [](TextHostControlService* service, StringView text, + "Home(Line Begin)", helper::ShortcutKeyBind(platform::gui::KeyCode::Home), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - return Utf16BackwardUntil(text, current_position, - [](CodePoint c) { return c == u'\n'; }); + return Utf8BackwardUntil(text, current_position, + [](CodePoint c) { return c == u'\n'; }); }); TextControlMovePattern TextControlMovePattern::kEnd( - u"End(Line End)", helper::ShortcutKeyBind(platform::gui::KeyCode::End), - [](TextHostControlService* service, StringView text, + "End(Line End)", helper::ShortcutKeyBind(platform::gui::KeyCode::End), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) - return Utf16ForwardUntil(text, current_position, - [](CodePoint c) { return c == u'\n'; }); + return Utf8ForwardUntil(text, current_position, + [](CodePoint c) { return c == u'\n'; }); }); TextControlMovePattern TextControlMovePattern::kCtrlHome( - u"Ctrl+Home(Document Begin)", + "Ctrl+Home(Document Begin)", helper::ShortcutKeyBind(platform::gui::KeyCode::Home, - platform::gui::KeyModifiers::ctrl), - [](TextHostControlService* service, StringView text, + platform::gui::KeyModifiers::Ctrl), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) CRU_UNUSED(text) @@ -110,10 +109,10 @@ TextControlMovePattern TextControlMovePattern::kCtrlHome( return 0; }); TextControlMovePattern TextControlMovePattern::kCtrlEnd( - u"Ctrl+End(Document End)", + "Ctrl+End(Document End)", helper::ShortcutKeyBind(platform::gui::KeyCode::End, - platform::gui::KeyModifiers::ctrl), - [](TextHostControlService* service, StringView text, + platform::gui::KeyModifiers::Ctrl), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) CRU_UNUSED(text) @@ -121,8 +120,8 @@ TextControlMovePattern TextControlMovePattern::kCtrlEnd( return text.size(); }); TextControlMovePattern TextControlMovePattern::kPageUp( - u"PageUp", helper::ShortcutKeyBind(platform::gui::KeyCode::PageUp), - [](TextHostControlService* service, StringView text, + "PageUp", helper::ShortcutKeyBind(platform::gui::KeyCode::PageUp), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) CRU_UNUSED(text) @@ -130,8 +129,8 @@ TextControlMovePattern TextControlMovePattern::kPageUp( return current_position; }); TextControlMovePattern TextControlMovePattern::kPageDown( - u"PageDown", helper::ShortcutKeyBind(platform::gui::KeyCode::PageDown), - [](TextHostControlService* service, StringView text, + "PageDown", helper::ShortcutKeyBind(platform::gui::KeyCode::PageDown), + [](TextHostControlService* service, std::string_view text, Index current_position) { CRU_UNUSED(service) CRU_UNUSED(text) @@ -214,7 +213,7 @@ void TextHostControlService::SetMultiLine(bool multi_line) { } } -void TextHostControlService::SetText(String text, bool stop_composition) { +void TextHostControlService::SetText(std::string text, bool stop_composition) { this->text_ = std::move(text); CoerceSelection(); if (stop_composition) { @@ -224,13 +223,14 @@ void TextHostControlService::SetText(String text, bool stop_composition) { text_change_event_.Raise(nullptr); } -void TextHostControlService::InsertText(Index position, StringView text, +void TextHostControlService::InsertText(Index position, std::string_view text, bool stop_composition) { - if (!Utf16IsValidInsertPosition(this->text_, position)) { + if (!Utf8IsValidInsertPosition(this->text_, position)) { CRU_LOG_TAG_ERROR("Invalid text insert position."); return; } - this->text_.insert(this->text_.cbegin() + position, text); + this->text_.insert(this->text_.cbegin() + position, text.cbegin(), + text.cend()); if (stop_composition) { CancelComposition(); } @@ -239,26 +239,26 @@ void TextHostControlService::InsertText(Index position, StringView text, } void TextHostControlService::DeleteChar(Index position, bool stop_composition) { - if (!Utf16IsValidInsertPosition(this->text_, position)) { + if (!Utf8IsValidInsertPosition(this->text_, position)) { CRU_LOG_TAG_ERROR("Invalid text delete position."); return; } if (position == static_cast<Index>(this->text_.size())) return; Index next; - Utf16NextCodePoint(this->text_, position, &next); + Utf8NextCodePoint(this->text_, position, &next); this->DeleteText(TextRange::FromTwoSides(position, next), stop_composition); } // Return the position of deleted character. Index TextHostControlService::DeleteCharPrevious(Index position, bool stop_composition) { - if (!Utf16IsValidInsertPosition(this->text_, position)) { + if (!Utf8IsValidInsertPosition(this->text_, position)) { CRU_LOG_TAG_ERROR("Invalid text delete position."); return 0; } if (position == 0) return 0; Index previous; - Utf16PreviousCodePoint(this->text_, position, &previous); + Utf8PreviousCodePoint(this->text_, position, &previous); this->DeleteText(TextRange::FromTwoSides(previous, position), stop_composition); return previous; @@ -268,11 +268,11 @@ void TextHostControlService::DeleteText(TextRange range, bool stop_composition) { if (range.count == 0) return; range = range.Normalize(); - if (!Utf16IsValidInsertPosition(this->text_, range.GetStart())) { + if (!Utf8IsValidInsertPosition(this->text_, range.GetStart())) { CRU_LOG_TAG_ERROR("Invalid text delete start position."); return; } - if (!Utf16IsValidInsertPosition(this->text_, range.GetStart())) { + if (!Utf8IsValidInsertPosition(this->text_, range.GetStart())) { CRU_LOG_TAG_ERROR("Invalid text delete end position."); return; } @@ -352,7 +352,7 @@ render::ScrollRenderObject* TextHostControlService::GetScrollRenderObject() { return this->text_host_control_->GetScrollRenderObject(); } -StringView TextHostControlService::GetSelectedText() { +std::string_view TextHostControlService::GetSelectedText() { auto selection = this->GetSelection().Normalize(); return GetTextView().substr(selection.position, selection.count); } @@ -372,7 +372,7 @@ void TextHostControlService::SetSelection(TextRange selection, } void TextHostControlService::SelectAll() { - this->SetSelection(TextRange{0, this->text_.size()}); + this->SetSelection(TextRange{0, static_cast<Index>(this->text_.size())}); } void TextHostControlService::ChangeSelectionEnd(Index new_end) { @@ -389,7 +389,7 @@ void TextHostControlService::AbortSelection() { SetSelection(GetCaretPosition()); } -void TextHostControlService::ReplaceSelectedText(StringView text) { +void TextHostControlService::ReplaceSelectedText(std::string_view text) { DeleteSelectedText(); InsertText(GetSelection().GetStart(), text); SetSelection(GetSelection().GetStart() + text.size()); @@ -402,14 +402,14 @@ void TextHostControlService::DeleteSelectedText() { void TextHostControlService::Cut() { Copy(); - ReplaceSelectedText(StringView{}); + ReplaceSelectedText(std::string_view{}); } void TextHostControlService::Copy() { auto selected_text = GetSelectedText(); if (selected_text.size() == 0) return; auto clipboard = GetUiApplication()->GetClipboard(); - clipboard->SetText(selected_text.ToString()); + clipboard->SetText(std::string(selected_text)); } void TextHostControlService::Paste() { @@ -442,7 +442,8 @@ void TextHostControlService::SyncTextRenderObject() { if (composition_info) { const auto caret_position = GetCaretPosition(); auto text = this->text_; - text.insert(text.cbegin() + caret_position, composition_info->text); + text.insert(text.cbegin() + caret_position, composition_info->text.cbegin(), + composition_info->text.cend()); text_render_object->SetText(text); text_render_object->SetCaretPosition(caret_position + composition_info->selection.GetEnd()); @@ -477,7 +478,7 @@ void TextHostControlService::MouseDownHandler( events::MouseButtonEventArgs& args) { if (IsEnabled()) { this->control_->SetFocus(); - if (args.GetButton() == mouse_buttons::left && + if (args.GetButton() == MouseButtons::Left && !this->mouse_move_selecting_) { if (!this->control_->CaptureMouse()) return; this->mouse_move_selecting_ = true; @@ -487,7 +488,7 @@ void TextHostControlService::MouseDownHandler( const auto position = result.position + (result.trailing ? 1 : 0); SetSelection(position); args.SetHandled(true); - } else if (args.GetButton() == mouse_buttons::right) { + } else if (args.GetButton() == MouseButtons::Right) { // TODO: Finish context menu logic here. const Point p = args.GetPointToContent(GetTextRenderObject()); @@ -536,7 +537,7 @@ void TextHostControlService::MouseDownHandler( void TextHostControlService::MouseUpHandler( events::MouseButtonEventArgs& args) { - if (args.GetButton() == mouse_buttons::left && mouse_move_selecting_) { + if (args.GetButton() == MouseButtons::Left && mouse_move_selecting_) { this->control_->ReleaseMouse(); this->mouse_move_selecting_ = false; args.SetHandled(); @@ -573,12 +574,13 @@ void TextHostControlService::GainFocusHandler( input_method_context_event_guard_ += input_method_context->CompositionEndEvent()->AddHandler(sync); input_method_context_event_guard_ += - input_method_context->TextEvent()->AddHandler([this](StringView text) { - if (!multi_line_ && text == u"\n") { - return; - } - this->ReplaceSelectedText(text); - }); + input_method_context->TextEvent()->AddHandler( + [this](std::string_view text) { + if (!multi_line_ && text == "\n") { + return; + } + this->ReplaceSelectedText(text); + }); host::WindowHost* window_host = control_->GetWindowHost(); if (window_host) @@ -606,7 +608,7 @@ void TextHostControlService::SetUpShortcuts() { using platform::gui::KeyModifiers; using platform::gui::kKeyModifierCommand; - shortcut_hub_.RegisterShortcut(u"Select All", + shortcut_hub_.RegisterShortcut("Select All", {KeyCode::A, kKeyModifierCommand}, [this] { if (IsEnabled()) { this->SelectAll(); @@ -615,7 +617,7 @@ void TextHostControlService::SetUpShortcuts() { return false; }); - shortcut_hub_.RegisterShortcut(u"Cut", {KeyCode::X, kKeyModifierCommand}, + shortcut_hub_.RegisterShortcut("Cut", {KeyCode::X, kKeyModifierCommand}, [this] { if (IsEnabled() && IsEditable()) { this->Cut(); @@ -624,7 +626,7 @@ void TextHostControlService::SetUpShortcuts() { return false; }); - shortcut_hub_.RegisterShortcut(u"Copy", {KeyCode::C, kKeyModifierCommand}, + shortcut_hub_.RegisterShortcut("Copy", {KeyCode::C, kKeyModifierCommand}, [this] { if (IsEnabled()) { this->Copy(); @@ -633,7 +635,7 @@ void TextHostControlService::SetUpShortcuts() { return false; }); - shortcut_hub_.RegisterShortcut(u"Paste", {KeyCode::V, kKeyModifierCommand}, + shortcut_hub_.RegisterShortcut("Paste", {KeyCode::V, kKeyModifierCommand}, [this] { if (IsEnabled() && IsEditable()) { this->Paste(); @@ -642,7 +644,7 @@ void TextHostControlService::SetUpShortcuts() { return false; }); - shortcut_hub_.RegisterShortcut(u"Backspace", KeyCode::Backspace, [this] { + shortcut_hub_.RegisterShortcut("Backspace", KeyCode::Backspace, [this] { if (!IsEnabled()) return false; if (!IsEditable()) return false; const auto selection = GetSelection(); @@ -654,7 +656,7 @@ void TextHostControlService::SetUpShortcuts() { return true; }); - shortcut_hub_.RegisterShortcut(u"Delete", KeyCode::Delete, [this] { + shortcut_hub_.RegisterShortcut("Delete", KeyCode::Delete, [this] { if (!IsEnabled()) return false; if (!IsEditable()) return false; const auto selection = GetSelection(); @@ -669,7 +671,7 @@ void TextHostControlService::SetUpShortcuts() { for (const auto& pattern : TextControlMovePattern::kDefaultPatterns) { auto name = pattern.GetName(); shortcut_hub_.RegisterShortcut( - u"Move " + name, pattern.GetKeyBind(), [this, &pattern] { + "Move " + name, pattern.GetKeyBind(), [this, &pattern] { auto text = this->GetTextView(); auto caret = this->GetCaretPosition(); auto new_position = pattern.Move(this, text, caret); @@ -678,8 +680,8 @@ void TextHostControlService::SetUpShortcuts() { }); shortcut_hub_.RegisterShortcut( - u"Move And Select " + name, - pattern.GetKeyBind().AddModifier(platform::gui::KeyModifiers::shift), + "Move And Select " + name, + pattern.GetKeyBind().AddModifier(platform::gui::KeyModifiers::Shift), [this, &pattern] { auto text = this->GetTextView(); auto caret = this->GetCaretPosition(); @@ -695,16 +697,16 @@ void TextHostControlService::OpenContextMenu(const Point& position, context_menu_ = MakeDeleteLaterPtr<components::PopupMenu>(); auto menu = context_menu_->GetMenu(); if (items & ContextMenuItem::kSelectAll) { - menu->AddTextItem(u"Select All", [this] { this->SelectAll(); }); + menu->AddTextItem("Select All", [this] { this->SelectAll(); }); } if (items & ContextMenuItem::kCopy) { - menu->AddTextItem(u"Copy", [this] { this->Copy(); }); + menu->AddTextItem("Copy", [this] { this->Copy(); }); } if (items & ContextMenuItem::kCut) { - menu->AddTextItem(u"Cut", [this] { this->Cut(); }); + menu->AddTextItem("Cut", [this] { this->Cut(); }); } if (items & ContextMenuItem::kPaste) { - menu->AddTextItem(u"Paste", [this] { this->Paste(); }); + menu->AddTextItem("Paste", [this] { this->Paste(); }); } context_menu_->SetPosition(position); context_menu_->Show(); diff --git a/src/ui/helper/ShortcutHub.cpp b/src/ui/helper/ShortcutHub.cpp index 80e70fe1..fd23802e 100644 --- a/src/ui/helper/ShortcutHub.cpp +++ b/src/ui/helper/ShortcutHub.cpp @@ -89,18 +89,17 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { if constexpr (debug_flags::shortcut) { if (shortcut_list.empty()) { - CRU_LOG_TAG_DEBUG("No shortcut for key bind {}.", - key_bind.ToString().ToUtf8()); + CRU_LOG_TAG_DEBUG("No shortcut for key bind {}.", key_bind.ToString()); } CRU_LOG_TAG_DEBUG("Begin to handle shortcut for key bind {}.", - key_bind.ToString().ToUtf8()); + key_bind.ToString()); } for (const auto& shortcut : shortcut_list) { auto is_handled = shortcut.handler(); if (is_handled) { if constexpr (debug_flags::shortcut) { - CRU_LOG_TAG_DEBUG("Handle {} handled it.", shortcut.name.ToUtf8()); + CRU_LOG_TAG_DEBUG("Handle {} handled it.", shortcut.name); } handled = true; @@ -109,8 +108,7 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { break; } else { if constexpr (debug_flags::shortcut) { - CRU_LOG_TAG_DEBUG("Handle {} didn't handle it.", - shortcut.name.ToUtf8()); + CRU_LOG_TAG_DEBUG("Handle {} didn't handle it.", shortcut.name); } } } @@ -118,7 +116,7 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { if constexpr (debug_flags::shortcut) { if (!shortcut_list.empty()) { CRU_LOG_TAG_DEBUG("End handling shortcut for key bind {}.", - key_bind.ToString().ToUtf8()); + key_bind.ToString()); } } @@ -126,7 +124,7 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { if constexpr (debug_flags::shortcut) { CRU_LOG_TAG_DEBUG( "Raise fallback event for unhandled shortcut of key bind {}.", - key_bind.ToString().ToUtf8()); + key_bind.ToString()); } fallback_event_.Raise(event); } diff --git a/src/ui/mapper/ColorMapper.cpp b/src/ui/mapper/ColorMapper.cpp index dcf3a522..82e9dfbc 100644 --- a/src/ui/mapper/ColorMapper.cpp +++ b/src/ui/mapper/ColorMapper.cpp @@ -1,5 +1,7 @@ #include "cru/ui/mapper/ColorMapper.h" +#include <cru/base/String.h> + namespace cru::ui::mapper { bool ColorMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) { return cru::string::CaseInsensitiveCompare(node->GetTag(), "Color") == 0; diff --git a/src/ui/mapper/FontMapper.cpp b/src/ui/mapper/FontMapper.cpp index bb3550ea..1f749513 100644 --- a/src/ui/mapper/FontMapper.cpp +++ b/src/ui/mapper/FontMapper.cpp @@ -1,5 +1,6 @@ #include "cru/ui/mapper/FontMapper.h" #include "../Helper.h" +#include "cru/base/String.h" #include "cru/platform/graphics/Factory.h" namespace cru::ui::mapper { @@ -16,7 +17,6 @@ std::shared_ptr<platform::graphics::IFont> FontMapper::DoMapFromXml( auto font_size = font_size_attr ? String::FromUtf8(*font_size_attr).ParseToFloat() : 24.0f; - return GetGraphicsFactory()->CreateFont(String::FromUtf8(font_family), - font_size); + return GetGraphicsFactory()->CreateFont(font_family, font_size); } } // namespace cru::ui::mapper diff --git a/src/ui/mapper/Mapper.cpp b/src/ui/mapper/Mapper.cpp index ca6cf0b3..47e783c9 100644 --- a/src/ui/mapper/Mapper.cpp +++ b/src/ui/mapper/Mapper.cpp @@ -9,8 +9,7 @@ MapperBase::MapperBase(std::type_index type_index) bool MapperBase::XmlElementIsOfThisType(xml::XmlElementNode* node) { for (const auto& tag : allowed_tags_) { - if (cru::string::CaseInsensitiveCompare(node->GetTag(), tag.ToUtf8()) == - 0) { + if (cru::string::CaseInsensitiveCompare(node->GetTag(), tag) == 0) { return true; } } diff --git a/src/ui/mapper/PointMapper.cpp b/src/ui/mapper/PointMapper.cpp index 16731544..12f000ef 100644 --- a/src/ui/mapper/PointMapper.cpp +++ b/src/ui/mapper/PointMapper.cpp @@ -1,5 +1,7 @@ #include "cru/ui/mapper/PointMapper.h" +#include <cru/base/String.h> + namespace cru::ui::mapper { bool PointMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) { return cru::string::CaseInsensitiveCompare(node->GetTag(), "Point") == 0; diff --git a/src/ui/mapper/SizeMapper.cpp b/src/ui/mapper/SizeMapper.cpp index f976bfe4..de8a0ded 100644 --- a/src/ui/mapper/SizeMapper.cpp +++ b/src/ui/mapper/SizeMapper.cpp @@ -1,5 +1,7 @@ #include "cru/ui/mapper/SizeMapper.h" +#include <cru/base/String.h> + namespace cru::ui::mapper { bool SizeMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) { return cru::string::CaseInsensitiveCompare(node->GetTag(), "Size") == 0; diff --git a/src/ui/mapper/StringMapper.cpp b/src/ui/mapper/StringMapper.cpp index 6e224d3f..5914da17 100644 --- a/src/ui/mapper/StringMapper.cpp +++ b/src/ui/mapper/StringMapper.cpp @@ -1,8 +1,9 @@ #include "cru/ui/mapper/StringMapper.h" #include "cru/xml/XmlNode.h" +#include "cru/base/String.h" namespace cru::ui::mapper { -StringMapper::StringMapper() { SetAllowedTags({u"String"}); } +StringMapper::StringMapper() { SetAllowedTags({"String"}); } StringMapper::~StringMapper() {} diff --git a/src/ui/mapper/ThicknessMapper.cpp b/src/ui/mapper/ThicknessMapper.cpp index 61c3641c..96f016a7 100644 --- a/src/ui/mapper/ThicknessMapper.cpp +++ b/src/ui/mapper/ThicknessMapper.cpp @@ -1,5 +1,6 @@ #include "cru/ui/mapper/ThicknessMapper.h" #include "cru/xml/XmlNode.h" +#include "cru/base/String.h" namespace cru::ui::mapper { bool ThicknessMapper::XmlElementIsOfThisType(xml::XmlElementNode* node) { diff --git a/src/ui/mapper/style/ContentBrushStylerMapper.cpp b/src/ui/mapper/style/ContentBrushStylerMapper.cpp index b3571374..027622fe 100644 --- a/src/ui/mapper/style/ContentBrushStylerMapper.cpp +++ b/src/ui/mapper/style/ContentBrushStylerMapper.cpp @@ -7,7 +7,7 @@ namespace cru::ui::mapper::style { ContentBrushStylerMapper::ContentBrushStylerMapper() { - SetAllowedTags({u"ContentBrushStyler"}); + SetAllowedTags({"ContentBrushStyler"}); } ContentBrushStylerMapper::~ContentBrushStylerMapper() {} diff --git a/src/ui/mapper/style/FontStylerMapper.cpp b/src/ui/mapper/style/FontStylerMapper.cpp index 3b1817ac..1555c071 100644 --- a/src/ui/mapper/style/FontStylerMapper.cpp +++ b/src/ui/mapper/style/FontStylerMapper.cpp @@ -3,7 +3,7 @@ #include "cru/ui/mapper/MapperRegistry.h" namespace cru::ui::mapper::style { -FontStylerMapper::FontStylerMapper() { SetAllowedTags({u"FontStyler"}); } +FontStylerMapper::FontStylerMapper() { SetAllowedTags({"FontStyler"}); } FontStylerMapper::~FontStylerMapper() {} diff --git a/src/ui/mapper/style/MarginStylerMapper.cpp b/src/ui/mapper/style/MarginStylerMapper.cpp index 0968b53e..ffbdcd75 100644 --- a/src/ui/mapper/style/MarginStylerMapper.cpp +++ b/src/ui/mapper/style/MarginStylerMapper.cpp @@ -4,7 +4,7 @@ #include "cru/ui/style/Styler.h" namespace cru::ui::mapper::style { -MarginStylerMapper::MarginStylerMapper() { SetAllowedTags({u"MarginStyler"}); } +MarginStylerMapper::MarginStylerMapper() { SetAllowedTags({"MarginStyler"}); } MarginStylerMapper::~MarginStylerMapper() {} diff --git a/src/ui/mapper/style/PaddingStylerMapper.cpp b/src/ui/mapper/style/PaddingStylerMapper.cpp index 0f0f87d7..faa86082 100644 --- a/src/ui/mapper/style/PaddingStylerMapper.cpp +++ b/src/ui/mapper/style/PaddingStylerMapper.cpp @@ -5,7 +5,7 @@ namespace cru::ui::mapper::style { PaddingStylerMapper::PaddingStylerMapper() { - SetAllowedTags({u"PaddingStyler"}); + SetAllowedTags({"PaddingStyler"}); } PaddingStylerMapper::~PaddingStylerMapper() {} diff --git a/src/ui/render/BorderRenderObject.cpp b/src/ui/render/BorderRenderObject.cpp index 03fdff24..957cf9bb 100644 --- a/src/ui/render/BorderRenderObject.cpp +++ b/src/ui/render/BorderRenderObject.cpp @@ -83,12 +83,10 @@ void BorderRenderObject::Draw(platform::graphics::IPainter* painter) { if constexpr (debug_flags::draw) { CRU_LOG_TAG_DEBUG( "BorderRenderObject draw, background: {}, foreground: {}.", - background_brush_ == nullptr - ? "NONE" - : background_brush_->GetDebugString().ToUtf8(), - foreground_brush_ == nullptr - ? "NONE" - : foreground_brush_->GetDebugString().ToUtf8()); + background_brush_ == nullptr ? "NONE" + : background_brush_->GetDebugString(), + foreground_brush_ == nullptr ? "NONE" + : foreground_brush_->GetDebugString()); } if (background_brush_ != nullptr) diff --git a/src/ui/render/ScrollBar.cpp b/src/ui/render/ScrollBar.cpp index af2851cd..f4f9496e 100644 --- a/src/ui/render/ScrollBar.cpp +++ b/src/ui/render/ScrollBar.cpp @@ -9,6 +9,7 @@ #include "cru/platform/graphics/util/Painter.h" #include "cru/platform/gui/Base.h" #include "cru/platform/gui/Cursor.h" +#include "cru/platform/gui/Input.h" #include "cru/ui/Base.h" #include "cru/ui/ThemeManager.h" #include "cru/ui/events/UiEvents.h" @@ -38,39 +39,39 @@ constexpr std::array<ScrollBarAreaKind, 5> kScrollBarAreaKindList{ ScrollBarAreaKind::UpSlot, ScrollBarAreaKind::DownSlot, ScrollBarAreaKind::Thumb}; -String GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage, +std::string GenerateScrollBarThemeColorKey(ScrollBarBrushUsageKind usage, ScrollBarBrushStateKind state) { - String result = u"scrollbar."; + std::string result = "scrollbar."; switch (usage) { case ScrollBarBrushUsageKind::Arrow: - result.append(u"arrow"); + result.append("arrow"); break; case ScrollBarBrushUsageKind::ArrowBackground: - result.append(u"arrow-background"); + result.append("arrow-background"); break; case ScrollBarBrushUsageKind::Slot: - result.append(u"slot"); + result.append("slot"); break; case ScrollBarBrushUsageKind::Thumb: - result.append(u"thumb"); + result.append("thumb"); break; } - result.push_back(u'.'); + result.push_back('.'); switch (state) { case ScrollBarBrushStateKind::Normal: - result.append(u"normal"); + result.append("normal"); break; case ScrollBarBrushStateKind::Hover: - result.append(u"hover"); + result.append("hover"); break; case ScrollBarBrushStateKind::Press: - result.append(u"press"); + result.append("press"); break; case ScrollBarBrushStateKind::Disable: - result.append(u"disable"); + result.append("disable"); break; } - result.append(u".color"); + result.append(".color"); return result; } @@ -123,7 +124,7 @@ void ScrollBar::InstallHandlers(controls::Control* control) { event_guard_ += control->MouseDownEvent()->Tunnel()->PrependShortCircuitHandler( [control, this](events::MouseButtonEventArgs& event) { - if (event.GetButton() == mouse_buttons::left && IsEnabled() && + if (event.GetButton() == MouseButtons::Left && IsEnabled() && IsExpanded()) { auto hit_test_result = ExpandedHitTest(event.GetPoint(render_object_)); @@ -182,7 +183,7 @@ void ScrollBar::InstallHandlers(controls::Control* control) { render_object_->InvalidatePaint(); } - if (event.GetButton() == mouse_buttons::left && + if (event.GetButton() == MouseButtons::Left && move_thumb_start_) { move_thumb_start_ = std::nullopt; @@ -264,7 +265,7 @@ std::shared_ptr<platform::graphics::IBrush> ScrollBar::GetCollapsedThumbBrush() { return collapsed_thumb_brush_ ? collapsed_thumb_brush_ : ThemeManager::GetInstance()->GetResourceBrush( - u"scrollbar.collapse-thumb.color"); + "scrollbar.collapse-thumb.color"); } void ScrollBar::SetCollapsedThumbBrush( diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp index 346b4957..18020032 100644 --- a/src/ui/render/TextRenderObject.cpp +++ b/src/ui/render/TextRenderObject.cpp @@ -28,14 +28,16 @@ TextRenderObject::TextRenderObject( caret_brush.swap(caret_brush_); const auto graph_factory = GetGraphicsFactory(); - text_layout_ = graph_factory->CreateTextLayout(font_, u""); + text_layout_ = graph_factory->CreateTextLayout(font_, ""); } TextRenderObject::~TextRenderObject() = default; -String TextRenderObject::GetText() const { return text_layout_->GetText(); } +std::string TextRenderObject::GetText() const { + return text_layout_->GetText(); +} -void TextRenderObject::SetText(String new_text) { +void TextRenderObject::SetText(std::string new_text) { text_layout_->SetText(std::move(new_text)); InvalidateLayout(); } @@ -181,8 +183,7 @@ void TextRenderObject::Draw(platform::graphics::IPainter* painter) { "Begin to paint, total_offset: {}, size: {}, text_layout: " "{}, brush: {}.", this->GetTotalOffset(), this->GetDesiredSize(), - this->text_layout_->GetDebugString().ToUtf8(), - this->brush_->GetDebugString().ToUtf8()); + this->text_layout_->GetDebugString(), this->brush_->GetDebugString()); } if (this->selection_range_.has_value()) { |