aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/TextBox.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-21 21:43:42 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-21 21:43:42 +0800
commit3b875091c445b7465b9bd044914318989a94d2ad (patch)
treea358aebb488ec1ddc86bf87b8038bacd5d7515cb /include/cru/ui/controls/TextBox.h
parent3cda35dbcbbe1e3854b880169c0efa0fc7a79264 (diff)
downloadcru-3b875091c445b7465b9bd044914318989a94d2ad.tar.gz
cru-3b875091c445b7465b9bd044914318989a94d2ad.tar.bz2
cru-3b875091c445b7465b9bd044914318989a94d2ad.zip
Clean codes. Remove member function const.
Diffstat (limited to 'include/cru/ui/controls/TextBox.h')
-rw-r--r--include/cru/ui/controls/TextBox.h22
1 files changed, 9 insertions, 13 deletions
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<std::nullptr_t>* TextChangeEvent() {
return service_->TextChangeEvent();
}
- std::shared_ptr<platform::graphics::IFont> GetFont() const override {
+ std::shared_ptr<platform::graphics::IFont> GetFont() override {
return text_render_object_->GetFont();
}
void SetFont(std::shared_ptr<platform::graphics::IFont> font) override {
text_render_object_->SetFont(std::move(font));
}
- std::shared_ptr<platform::graphics::IBrush> GetTextBrush() const {
+ std::shared_ptr<platform::graphics::IBrush> GetTextBrush() {
return text_render_object_->GetBrush();
}
void SetTextBrush(std::shared_ptr<platform::graphics::IBrush> brush) {
text_render_object_->SetBrush(std::move(brush));
}
- std::shared_ptr<platform::graphics::IBrush> GetContentBrush() const override {
+ std::shared_ptr<platform::graphics::IBrush> GetContentBrush() override {
return GetTextBrush();
}