aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_control.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/text_control.h')
-rw-r--r--src/ui/controls/text_control.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/controls/text_control.h b/src/ui/controls/text_control.h
index ca23ec95..a24766dc 100644
--- a/src/ui/controls/text_control.h
+++ b/src/ui/controls/text_control.h
@@ -51,8 +51,6 @@ namespace cru::ui::controls
return is_selectable_;
}
- void SetSelectable(bool is_selectable);
-
std::optional<TextRange> GetSelectedRange() const
{
return selected_range_;
@@ -60,6 +58,14 @@ namespace cru::ui::controls
void SetSelectedRange(std::optional<TextRange> text_range);
+ void ClearSelection()
+ {
+ SetSelectedRange(std::nullopt);
+ }
+
+ protected:
+ void SetSelectable(bool is_selectable);
+
protected:
void OnSizeChangedCore(events::SizeChangedEventArgs& args) override final;
void OnDraw(ID2D1DeviceContext* device_context) override;
@@ -68,10 +74,11 @@ namespace cru::ui::controls
void OnMouseMoveCore(events::MouseEventArgs& args) override final;
void OnMouseUpCore(events::MouseButtonEventArgs& args) override final;
- void OnLoseFocusCore(events::FocusChangeEventArgs& args) override final;
+ void OnLoseFocusCore(events::FocusChangeEventArgs& args) override;
Size OnMeasure(const Size& available_size) override final;
+ virtual void RequestChangeCaretPosition(unsigned position);
private:
void OnTextChangedCore(const String& old_text, const String& new_text);
@@ -84,8 +91,10 @@ namespace cru::ui::controls
Microsoft::WRL::ComPtr<ID2D1Brush> brush_;
Microsoft::WRL::ComPtr<ID2D1Brush> selection_brush_;
Microsoft::WRL::ComPtr<IDWriteTextFormat> text_format_;
+ protected:
Microsoft::WRL::ComPtr<IDWriteTextLayout> text_layout_;
+ private:
Vector<TextLayoutHandlerPtr> text_layout_handlers_;
bool is_selectable_ = false;