aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/text_control.cpp')
-rw-r--r--src/ui/controls/text_control.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp
index 9a799916..6412eec9 100644
--- a/src/ui/controls/text_control.cpp
+++ b/src/ui/controls/text_control.cpp
@@ -56,14 +56,6 @@ namespace cru::ui::controls
SetClipContent(true);
- size_changed_event.AddHandler([this](events::SizeChangedEventArgs& args)
- {
- const auto content = GetRect(RectRange::Content);
- ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
- ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
- InvalidateDraw();
- });
-
draw_content_event.AddHandler([this](events::DrawEventArgs& args)
{
const auto device_context = args.GetDeviceContext();
@@ -196,6 +188,13 @@ namespace cru::ui::controls
}
+ void TextControl::OnRectChange(const Rect& old_rect, const Rect& new_rect)
+ {
+ const auto content = GetRect(RectRange::Content);
+ ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
+ ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
+ }
+
void TextControl::OnTextChangedCore(const String& old_text, const String& new_text)
{
RecreateTextLayout();