From 3b875091c445b7465b9bd044914318989a94d2ad Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 21 Nov 2025 21:43:42 +0800 Subject: Clean codes. Remove member function const. --- include/cru/ui/controls/TextBox.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'include/cru/ui/controls/TextBox.h') diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h index 4c6ef384..7b3ab323 100644 --- a/include/cru/ui/controls/TextBox.h +++ b/include/cru/ui/controls/TextBox.h @@ -1,5 +1,6 @@ #pragma once #include "../render/BorderRenderObject.h" +#include "../render/ScrollRenderObject.h" #include "../render/TextRenderObject.h" #include "Control.h" #include "IBorderControl.h" @@ -18,48 +19,43 @@ class CRU_UI_API TextBox : public Control, public virtual IContentBrushControl, public virtual IFontControl { public: - static constexpr std::string_view control_type = "TextBox"; + static constexpr auto kControlName = "TextBox"; TextBox(); - CRU_DELETE_COPY(TextBox) - CRU_DELETE_MOVE(TextBox) - ~TextBox() override; - std::string GetControlType() const final { return std::string(control_type); } - - render::RenderObject* GetRenderObject() const override; + render::RenderObject* GetRenderObject() override; render::TextRenderObject* GetTextRenderObject() override; render::ScrollRenderObject* GetScrollRenderObject() override; - bool GetMultiLine() const; + bool GetMultiLine(); void SetMultiLine(bool value); void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override; - std::string GetText() const { return service_->GetText(); } - std::string_view GetTextView() const { return service_->GetTextView(); } + std::string GetText() { return service_->GetText(); } + std::string_view GetTextView() { return service_->GetTextView(); } void SetText(std::string text) { service_->SetText(std::move(text)); } IEvent* TextChangeEvent() { return service_->TextChangeEvent(); } - std::shared_ptr GetFont() const override { + std::shared_ptr GetFont() override { return text_render_object_->GetFont(); } void SetFont(std::shared_ptr font) override { text_render_object_->SetFont(std::move(font)); } - std::shared_ptr GetTextBrush() const { + std::shared_ptr GetTextBrush() { return text_render_object_->GetBrush(); } void SetTextBrush(std::shared_ptr brush) { text_render_object_->SetBrush(std::move(brush)); } - std::shared_ptr GetContentBrush() const override { + std::shared_ptr GetContentBrush() override { return GetTextBrush(); } -- cgit v1.2.3