rodecomp/Source/UI/Window/UIMiniBtnWnd.cpp
ragnarok-clanker 780c281aa2 Maintenance: Name window messaging constants: literal window ids (LookupWindow/EnsureWindow/CloseWindow/... -> WindowId), UIWindowMgr
Batch #14937 by ragnarok-clanker: no function's compiled code changes; checked with 251 compiled unit(s), including every includer of Source/Client/Mode/ModeMessage.h, Source/Contents/Actors/ActorEnums.h, Source/Network/Packets/PartyJoinPacket.h, Source/UI/Window/UIEnums.h, Source/UI/Window/WindowId.h.
2026-11-08 13:56:42 +00:00

68 lines
1.8 KiB
C++

#include "UI/Window/UIMiniBtnWnd.h"
#include "UI/Window/UIEnums.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowManagerWindows.h"
// OFFSET: 0x0092CE50
// FUNCTION: fn_12666
void UIMiniBtnWnd::Paint() {
if (this->geometry.id < 0) {
return;
}
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window && window->geometry.visible != 0) {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->m_activeImage.c_str())));
this->DrawBitmap(0, 0, bitmap, false);
} else {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->m_inactiveImage.c_str())));
this->DrawBitmap(0, 0, bitmap, false);
}
}
// OFFSET: 0x00930CD0
// FUNCTION: fn_12694
void UIMiniBtnWnd::OnLBtnDown(int, int) {
bool visible;
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window) {
visible = window->geometry.visible == 0;
} else {
window = g_windowMgr.EnsureWindow(this->m_windowId);
visible = true;
}
if (window) {
window->Show(visible);
window->SendMsg(this, UM_COMMAND, ID_APPLY, visible, 0, 0);
}
this->Invalidate();
}
// OFFSET: 0x00941120
// FUNCTION: fn_12789
void UIMiniBtnWnd::Toggle() {
bool visible;
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window) {
visible = window->geometry.visible == 0;
} else {
window = g_windowMgr.EnsureWindow(this->m_windowId);
visible = true;
}
if (window) {
window->Show(visible);
window->SendMsg(this, UM_COMMAND, ID_APPLY, visible, 0, 0);
}
this->Invalidate();
}
// OFFSET: 0x009114F0
// FUNCTION: fn_12516
UIMiniBtnWnd::UIMiniBtnWnd() : UIFrameWnd(0), m_windowId(-1) {
}