diff --git a/Source/UI/Text/UIStaticText_LF.h b/Source/UI/Text/UIStaticText_LF.h index 64ce2bb2..03ab766b 100644 --- a/Source/UI/Text/UIStaticText_LF.h +++ b/Source/UI/Text/UIStaticText_LF.h @@ -7,11 +7,24 @@ class UIStaticText_LF : public UIWindow { public: + // INLINED + UIStaticText_LF(UIWindowContext& windows, unsigned char cached) + : UIWindow(windows, cached), m_lineSpacing(0), m_align(0), m_fontFamily(0), m_fontHeight(12), m_textColor(0), m_bold(0) {} + void Paint() override; void Slot25(int x, int y) override; void Slot31(int x, int y) override; void Slot35(int delta) override; void SetText(std::string text); + +protected: + /* 007C */ std::string m_text; + /* 0094 */ int m_lineSpacing; + /* 0098 */ int m_align; + /* 009C */ int m_fontFamily; + /* 00A0 */ int m_fontHeight; + /* 00A4 */ std::uint32_t m_textColor; + /* 00A8 */ unsigned char m_bold; }; #endif diff --git a/Source/UI/Window/UINoteWnd.cpp b/Source/UI/Window/UINoteWnd.cpp index 580ebb95..0d71d863 100644 --- a/Source/UI/Window/UINoteWnd.cpp +++ b/Source/UI/Window/UINoteWnd.cpp @@ -2,6 +2,8 @@ #include "Contents/MessageTable.h" #include "UI/Buttons/UIBasicButton.h" #include "UI/Lists/UIScrollBar.h" +#include "UI/Text/UIStaticText_LF.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowBorder.h" // OFFSET: 0x0094C2D0 @@ -66,3 +68,28 @@ void UINoteWnd_Scroll::Slot35(int delta) { UINoteWnd::UINoteWnd(UIWindowContext& windows, UIFrameContext& frames, UIButtonContext& controls) : UIFrameWnd(windows, frames, 0), m_scroll(nullptr), m_controls(&controls) { } + +// OFFSET: 0x00950840 +// FUNCTION: fn_12944 +int UINoteWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { + if (message == 6) { + if (argument1 == 201) { + g_windowMgr.CloseWindow(this->geometry.id); + } + } else if (message == 0x22) { + UINoteWnd_Scroll* scroll = this->m_scroll; + const std::string text = LookupMessage(static_cast(argument1)); + UIStaticText_LF* label = new UIStaticText_LF(*this->m_context, 0); + scroll->m_text = label; + label->SetSize(scroll->geometry.width - 13, 12); + label->Move(0, 0); + label->SetText(text); + scroll->AddScrollChild(label); + scroll->horizontalBar->Show(0); + scroll->scrollBar->Show(0); + scroll->Invalidate(); + this->Invalidate(); + } + + return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); +} diff --git a/Source/UI/Window/UINoteWnd.h b/Source/UI/Window/UINoteWnd.h index 1f7fddee..8b2bca62 100644 --- a/Source/UI/Window/UINoteWnd.h +++ b/Source/UI/Window/UINoteWnd.h @@ -5,11 +5,12 @@ #include "UI/Window/UIFrameWnd.h" struct UIButtonContext; +class UIStaticText_LF; class UINoteWnd_Scroll : public UIScrollWnd { public: // INLINED - UINoteWnd_Scroll(UIWindowContext& windows, int width, int height) : UIScrollWnd(windows, width, height, 0), unknown_00B0(0) { + UINoteWnd_Scroll(UIWindowContext& windows, int width, int height) : UIScrollWnd(windows, width, height, 0), m_text(nullptr) { this->SetSize(width, height); } void Paint() override; @@ -17,7 +18,7 @@ public: void Slot31(int x, int y) override; void Slot35(int delta) override; - /* 00B0 */ int unknown_00B0; + /* 00B0 */ UIStaticText_LF* m_text; }; class UINoteWnd : public UIFrameWnd { @@ -25,6 +26,7 @@ public: UINoteWnd(UIWindowContext& windows, UIFrameContext& frames, UIButtonContext& controls); void Slot15(int width, int height) override; void Paint() override; + int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; protected: /* 00B4 */ UINoteWnd_Scroll* m_scroll;