From 2fd37d41bb804a06acc8e2d341d5ce5d8370184b Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 11 Feb 2022 17:46:20 +0800 Subject: ... --- include/cru/ui/controls/TextBox.h | 8 ++++++++ include/cru/ui/controls/TextHostControlService.h | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h index 94a1ac0c..3e041880 100644 --- a/include/cru/ui/controls/TextBox.h +++ b/include/cru/ui/controls/TextBox.h @@ -32,6 +32,14 @@ class CRU_UI_API TextBox : public NoChildControl, void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override; + String GetText() const { return service_->GetText(); } + StringView GetTextView() const { return service_->GetTextView(); } + void SetText(String text) { service_->SetText(std::move(text)); } + + IEvent* TextChangeEvent() { + return service_->TextChangeEvent(); + } + private: std::unique_ptr border_render_object_; std::unique_ptr scroll_render_object_; diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h index 0d4a20cf..74da1e19 100644 --- a/include/cru/ui/controls/TextHostControlService.h +++ b/include/cru/ui/controls/TextHostControlService.h @@ -147,6 +147,8 @@ class CRU_UI_API TextHostControlService : public Object { void Copy(); void Paste(); + IEvent* TextChangeEvent() { return &text_change_event_; } + gsl::not_null GetTextRenderObject(); render::ScrollRenderObject* GetScrollRenderObject(); @@ -192,6 +194,8 @@ class CRU_UI_API TextHostControlService : public Object { gsl::not_null control_; gsl::not_null text_host_control_; + Event text_change_event_; + EventRevokerListGuard event_guard_; EventRevokerListGuard input_method_context_event_guard_; -- cgit v1.2.3