diff options
Diffstat (limited to 'src/ui/render')
-rw-r--r-- | src/ui/render/BorderRenderObject.cpp | 10 | ||||
-rw-r--r-- | src/ui/render/ScrollBar.cpp | 31 | ||||
-rw-r--r-- | src/ui/render/TextRenderObject.cpp | 11 |
3 files changed, 26 insertions, 26 deletions
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()) { |