diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index c6146e19..934de5b0 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -5,6 +5,8 @@ #include "UI/Window/UIWindowMgr.h" #include "UI/Buttons/UIItemTagButton.h" #include "UI/Buttons/UITextButton.h" +#include "UI/Lists/UIImgMenu.h" +#include "UI/Lists/UITabControl.h" #include "UI/Lists/UITreeView.h" #include "UI/UIStaticItem.h" @@ -276,3 +278,36 @@ void UIINT64BarGraph::Slot28(int, int) { this->m_controls->services.Tooltip(text, screenX, screenY, -1, false, true); } + +// OFFSET: 0x00891A10 + +// OFFSET: 0x00891F20 +// FUNCTION: fn_11460 +void UITabControl::Slot28(int x, int y) { + int index = this->TabAt(x, y); + + if (index == -1) { + return; + } + + const std::string& tooltip = this->tooltips[index]; + + if (tooltip.empty() || this->labels[index] == tooltip) { + return; + } + + int screenX = 0; + + for (int i = 0; i < index; ++i) { + screenX = (screenX - 1 + this->widths[i]); + } + + int screenY = -20; + + for (const UIWindow* window = this; window; window = window->parent) { + screenX = (screenX + window->geometry.x); + screenY = (screenY + window->geometry.y); + } + + this->m_controls->services.Tooltip(this->tooltips[index].c_str(), screenX, screenY, -1, false, true); +} diff --git a/Source/UI/Lists/UIImgMenu.h b/Source/UI/Lists/UIImgMenu.h index ef2b5ed8..1527851b 100644 --- a/Source/UI/Lists/UIImgMenu.h +++ b/Source/UI/Lists/UIImgMenu.h @@ -6,11 +6,13 @@ class UIImgMenu : public UIWindow { public: int ItemAt(int x, int y); + void Slot28(int x, int y) override; /* 0080 */ int count; /* 0084 */ int itemWidth; /* 0088 */ int itemHeight; /* 008C */ int horizontal; + /* 007C */ int hovered; }; #endif diff --git a/Source/UI/Lists/UITabControl.h b/Source/UI/Lists/UITabControl.h index 919e4cd9..c7f773bc 100644 --- a/Source/UI/Lists/UITabControl.h +++ b/Source/UI/Lists/UITabControl.h @@ -6,16 +6,24 @@ #include #include +struct UIButtonContext; + class UITabControl : public UIWindow { public: int TabCount(); int TabAt(int x, int y); + void Slot28(int x, int y) override; /* 0080 */ int layout; /* 0084 */ unsigned char unknown_0084[0x30]; /* 00B4 */ std::vector labels; /* 00C0 */ unsigned char unknown_00C0[0xC]; /* 00CC */ std::vector widths; + /* 00D8 */ unsigned char unknown_00D8[0x4]; + /* 00DC */ std::vector tooltips; + +private: + UIButtonContext* m_controls; }; #endif