diff options
Diffstat (limited to 'include/cru')
-rw-r--r-- | include/cru/platform/graphics/Base.h | 2 | ||||
-rw-r--r-- | include/cru/ui/Base.h | 5 | ||||
-rw-r--r-- | include/cru/ui/controls/TextBox.h | 8 | ||||
-rw-r--r-- | include/cru/ui/controls/TextHostControlService.h | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/include/cru/platform/graphics/Base.h b/include/cru/platform/graphics/Base.h index a134fb33..3bb9b7b4 100644 --- a/include/cru/platform/graphics/Base.h +++ b/include/cru/platform/graphics/Base.h @@ -4,8 +4,6 @@ #include "../Matrix.h" #include "../Resource.h" -#include <memory> - #ifdef CRU_PLATFORM_WINDOWS #ifdef CRU_PLATFORM_GRAPHICS_EXPORT_API #define CRU_PLATFORM_GRAPHICS_API __declspec(dllexport) diff --git a/include/cru/ui/Base.h b/include/cru/ui/Base.h index 4316fbbb..5e62d785 100644 --- a/include/cru/ui/Base.h +++ b/include/cru/ui/Base.h @@ -3,11 +3,6 @@ #include "cru/platform/graphics/Base.h" #include "cru/platform/gui/Base.h" -#include <functional> -#include <memory> -#include <optional> -#include <vector> - #ifdef CRU_PLATFORM_WINDOWS #ifdef CRU_UI_EXPORT_API #define CRU_UI_API __declspec(dllexport) 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<std::nullptr_t>* TextChangeEvent() { + return service_->TextChangeEvent(); + } + private: std::unique_ptr<render::BorderRenderObject> border_render_object_; std::unique_ptr<render::ScrollRenderObject> 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<std::nullptr_t>* TextChangeEvent() { return &text_change_event_; } + gsl::not_null<render::TextRenderObject*> GetTextRenderObject(); render::ScrollRenderObject* GetScrollRenderObject(); @@ -192,6 +194,8 @@ class CRU_UI_API TextHostControlService : public Object { gsl::not_null<Control*> control_; gsl::not_null<ITextHostControl*> text_host_control_; + Event<std::nullptr_t> text_change_event_; + EventRevokerListGuard event_guard_; EventRevokerListGuard input_method_context_event_guard_; |