diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 3ab193240..3088309b8 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -808,6 +808,20 @@ void UITextButton::ResizeToText() { UIWindow::Resize(width + 2, this->m_height + 2); } +// OFFSET: 0x00897230 +// FUNCTION: fn_11525 +void UITextButton::ResizeToTextClipped(int width, int height) { + if (std::strcmp(this->label.c_str(), "") == 0) { + return; + } + + this->ResizeToText(); + if (this->geometry.width > width) { + this->m_text = this->ClipTextToWidth(this->label.c_str(), width, this->m_family, this->m_height, this->m_outline); + UIWindow::Resize(width, height); + } +} + // OFFSET: 0x00897A50 // FUNCTION: fn_11539 void UITabControl::FitToTabs() { diff --git a/Source/UI/Buttons/UITextButton.h b/Source/UI/Buttons/UITextButton.h index edb24cd4a..af4ed4b2a 100644 --- a/Source/UI/Buttons/UITextButton.h +++ b/Source/UI/Buttons/UITextButton.h @@ -35,6 +35,7 @@ public: void Slot35(int value) override; void Configure(const char* text, std::uint32_t color, int family, int height, unsigned char outline, unsigned char underline); void ResizeToText(); + void ResizeToTextClipped(int width, int height); void CenterIn(int width, int height); const std::string& GetLine(std::size_t index) const; int GetLinesCount() const;