diff --git a/Source/UI/Edit/UIEditBoxEx.cpp b/Source/UI/Edit/UIEditBoxEx.cpp index 032c907a..932b833c 100644 --- a/Source/UI/Edit/UIEditBoxEx.cpp +++ b/Source/UI/Edit/UIEditBoxEx.cpp @@ -38,3 +38,104 @@ void CUIEditCtrlEx::Paint() { } // OFFSET: 0x009E4F90 + +// OFFSET: 0x009E5A60 +// FUNCTION: fn_14447 +void CUIEditCtrlEx::ResetDragState() { + this->unknown_01D4 = -1; + this->unknown_01D8 = 0; + this->unknown_01DC = 0; +} + +// OFFSET: 0x009E5A80 +// FUNCTION: fn_14448 +void CUIEditBoxEx::Resize(int width, int height) { + UIWindow::Resize(width, height); + this->edit->Resize(width - this->editRight - this->editLeft, height - this->editBottom - this->editTop); + this->edit->Move(this->editLeft, this->editTop); +} + +// OFFSET: 0x009E5AE0 +// FUNCTION: fn_14449 +int CUIEditBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message == 0 && this->onSubmit) { + this->onSubmit(); + } + return UIWindow::SendMsg(sender, message, a, b, c, d); +} + +// OFFSET: 0x009E6090 +// FUNCTION: fn_14451 +void CUIEditBoxEx::SetAlignment(int value) { + CUIEditCtrlEx* edit = this->edit; + edit->alignment = value; + edit->Invalidate(); +} + +// OFFSET: 0x009E60D0 +// FUNCTION: fn_14452 +void CUIEditBoxEx::SetBackgroundColor(std::uint32_t color) { + this->backgroundColor = color; + this->Invalidate(); +} + +// OFFSET: 0x009E6320 +// FUNCTION: fn_14454 +void CUIEditBoxEx::SetTextColor(std::uint32_t color) { + CUIEditCtrlEx* edit = this->edit; + edit->normalColor = color; + edit->textColor = color; + edit->selectedAll = 1; +} + +// OFFSET: 0x009E6370 +// FUNCTION: fn_14455 +void CUIEditBoxEx::SetHighlight(int value) { + CUIEditCtrlEx* edit = this->edit; + edit->unknown_018C = value; + edit->unknown_0190 = 1; + edit->Invalidate(); +} + +// OFFSET: 0x009E63C0 +// FUNCTION: fn_14456 +void CUIEditBoxEx::SetBorderColor(std::uint32_t color) { + this->borderColor = color; + this->Invalidate(); +} + +// OFFSET: 0x009E63E0 +// FUNCTION: fn_14457 +void CUIEditBoxEx::SetBorderWidth(int width) { + this->borderWidth = width; + this->Invalidate(); +} + +// OFFSET: 0x009E6430 +// FUNCTION: fn_14458 +void CUIEditBoxEx::SetMaximum(int value) { + this->edit->maximum = value; + this->edit->SetText(this->edit->Text()); +} + +// OFFSET: 0x009E6470 +// FUNCTION: fn_14459 +void CUIEditBoxEx::SetEditBounds(int left, int top, int right, int bottom) { + this->editLeft = left; + this->editTop = top; + this->editRight = right; + this->editBottom = bottom; + this->Resize(this->geometry.width, this->geometry.height); +} + +// OFFSET: 0x009E64B0 +// FUNCTION: fn_14460 +void CUIEditBoxEx::SetMask(char value) { + this->edit->mask = value; +} + +// OFFSET: 0x009E64D0 +// FUNCTION: fn_14461 +void CUIEditBoxEx::SetText(const std::string& text) { + this->edit->SetText(text.c_str()); +} diff --git a/Source/UI/Edit/UIEditBoxEx.h b/Source/UI/Edit/UIEditBoxEx.h index 2893e9f0..539b6e65 100644 --- a/Source/UI/Edit/UIEditBoxEx.h +++ b/Source/UI/Edit/UIEditBoxEx.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -25,6 +26,7 @@ public: virtual void UpdateScrollBar(); void RefreshPlaceholder(); + void ResetDragState(); int LeadingBytesFitting(const std::string& text, int width); int TrailingOffsetFitting(const std::string& text, int width); @@ -33,7 +35,7 @@ public: /* 0190 */ unsigned char unknown_0190; /* 0194 */ std::string placeholder; /* 01AC */ std::uint32_t placeholderColor; - /* 01B0 */ int unknown_01B0; + /* 01B0 */ int alignment; /* 01B4 */ int unknown_01B4; /* 01B8 */ int verticalPadding; /* 01BC */ std::vector lines; @@ -53,18 +55,34 @@ public: class CUIEditBoxEx : public CUIControl { public: + void Resize(int width, int height) override; bool Slot05() override; void Paint() override; + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; void ResetSelection(); void SetCursor(std::size_t position); int Length(); + void SetAlignment(int value); + void SetBackgroundColor(std::uint32_t color); + void SetTextColor(std::uint32_t color); + void SetHighlight(int value); + void SetBorderColor(std::uint32_t color); + void SetBorderWidth(int width); + void SetMaximum(int value); + void SetEditBounds(int left, int top, int right, int bottom); + void SetMask(char value); + void SetText(const std::string& text); /* 0080 */ std::uint32_t backgroundColor; /* 0084 */ std::uint32_t borderColor; /* 0088 */ int borderWidth; - /* 008C */ int unknown_008C[4]; + /* 008C */ int editLeft; + /* 0090 */ int editTop; + /* 0094 */ int editRight; + /* 0098 */ int editBottom; /* 009C */ CUIEditCtrlEx* edit; + /* 00A0 */ std::function onSubmit; }; #endif