Batch #14936 by ragnarok-clanker: no function's compiled code changes; checked with 158 compiled unit(s), including every includer of Source/Client/Mode/GameModeEnums.h, Source/Client/Mode/ModeMessage.h, Source/Contents/Actors/ActorEnums.h, Source/Contents/Actors/PetEnums.h, Source/Contents/Combat/CombatTypes.h, Source/Contents/Configuration/ServiceEnums.h, Source/Contents/Effects/EffectPrimId.h, Source/Contents/Hotkeys/InterfaceHotkey.h, Source/Contents/Items/ItemId.h, Source/Contents/Items/ItemType.h, Source/Network/Packets/ModeResultEnums.h, Source/Network/Packets/NoticeEnums.h, Source/Network/Packets/PacketId.h, Source/UI/Window/UIEnums.h, Source/UI/Window/WindowId.h.
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
#include "UI/Window/UIEnums.h"
|
|
#include "Resource/Bitmap/BitmapResource.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/TextureNames.h"
|
|
#include "UI/Window/UIBitmapTab.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
// OFFSET: 0x0085BBC0
|
|
// FUNCTION: fn_10797
|
|
void UIBitmapTab::Paint() {
|
|
int y = 0;
|
|
|
|
for (unsigned index = 0; index < this->tabs.size(); ++index) {
|
|
const std::string name = FormatOwnedString(this->tabs[index].name.c_str(), 'a' + (this->geometry.unknown_0030 == index));
|
|
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name.c_str())));
|
|
if (bitmap) {
|
|
this->DrawBitmap(0, y, bitmap, false);
|
|
y += bitmap->image.height;
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0085EA90
|
|
// FUNCTION: fn_10838
|
|
void UIBitmapTab::OnLBtnDown(int, int y) {
|
|
if (!this->parent) {
|
|
return;
|
|
}
|
|
|
|
int bottom = 0;
|
|
for (unsigned index = 0; index < this->tabs.size(); ++index) {
|
|
bottom += this->tabs[index].height;
|
|
if (y < bottom) {
|
|
if (this->geometry.unknown_0030 != index) {
|
|
this->geometry.unknown_0030 = index;
|
|
this->Invalidate();
|
|
this->parent->SendMsg(this, 22, this->geometry.unknown_0030, 0, 0, 0);
|
|
}
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00855190
|
|
// FUNCTION: fn_10752
|
|
void UIBitmapTab::DragAndDrop(int argument1, int argument2, std::intptr_t argument3) {
|
|
if (this->parent) {
|
|
this->parent->DragAndDrop(argument1, argument2, argument3);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00863300
|
|
// FUNCTION: fn_10908
|
|
int UIBitmapTab::SendMsg(UIWindow*, int message, std::intptr_t argument1, std::intptr_t, std::intptr_t, std::intptr_t) {
|
|
switch (message) {
|
|
case UM_SETSTATE:
|
|
this->geometry.unknown_0030 = argument1;
|
|
this->Invalidate();
|
|
break;
|
|
case UM_CLEAR_ITEM:
|
|
this->tabs.clear();
|
|
break;
|
|
case UM_SET_BITMAP:
|
|
if (argument1) {
|
|
const char* tabName = reinterpret_cast<const char*>(argument1);
|
|
const std::string name = FormatOwnedString(tabName, 'a');
|
|
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name.c_str())));
|
|
if (bitmap) {
|
|
this->tabs.push_back(BitmapTabEntry{bitmap->image.height, tabName});
|
|
}
|
|
}
|
|
break;
|
|
case UM_RESIZE:
|
|
if (!this->tabs.empty()) {
|
|
int width = 0;
|
|
int height = 0;
|
|
for (unsigned index = 0; index < this->tabs.size(); ++index) {
|
|
const std::string name = FormatOwnedString(this->tabs[index].name.c_str(), 'a');
|
|
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name.c_str())));
|
|
if (bitmap) {
|
|
width = bitmap->image.width;
|
|
height += bitmap->image.height;
|
|
}
|
|
}
|
|
|
|
this->Resize(width, height);
|
|
}
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|