#include "UI/Exchange/UIExchangeUI.h" #include "Resource/ResourceMgr.h" #include "Resource/SkinPalette.h" #include #include #include template void CUIListBoxEx::SetOnSelect(std::function); template void CUIListBoxEx::SetBinder(std::function); template void CUIListBoxEx::SetImages(const std::string&, const std::string&, const std::string&, const std::string&); // OFFSET: 0x00A15150 // FUNCTION: fn_15193 template <> void CUIListBoxEx::Paint() { this->ClearSurface(0xFFFF00FF); } // OFFSET: 0x00A15160 // FUNCTION: fn_15194 template <> void CUIListBoxEx::Slot35(int value) { if (!this->scrollBar->dragging && this->scrollBar->total > this->scrollBar->visible) { this->scrollBar->Slot35(value); } else if (this->parent) { this->parent->Slot35(value); } } // OFFSET: 0x00A157C0 // FUNCTION: fn_15200 template <> void CUIListBoxEx::OnScroll(int position) { auto it = this->items.begin(); if (it == this->items.end()) { return; } if (this->data.size() == 0) { for (; it != this->items.end(); ++it) { (*it)->index = -1; (*it)->Show(0); } return; } const int first = (*it)->index; unsigned int row = position / this->rowHeight; if (first != -1) { if (first < static_cast(row)) { if (row - first < static_cast(this->items.size())) { std::rotate(this->items.begin(), this->items.begin() + (row - first), this->items.end()); } } else if (first > static_cast(row)) { if (first - row < static_cast(this->items.size())) { std::rotate(this->items.begin(), this->items.end() - (first - row), this->items.end()); } } } it = this->items.begin(); for (int y = this->itemY - position % this->rowHeight; y < this->geometry.height; y += this->rowHeight, ++it, ++row) { if (it == this->items.end() || row >= this->data.size()) { break; } ExchangeUI::CUIItem* item = *it; if (item) { if (this->rebind || row != static_cast(item->index)) { item->index = row; if (this->binder) { auto node = this->data.begin(); std::advance(node, static_cast(row)); this->binder(item, *node); } } item->SetSelected(row == this->selected); item->Move(this->itemX, y); item->Show(1); } } for (; it != this->items.end(); ++it) { (*it)->index = -1; (*it)->Show(0); } } // OFFSET: 0x00A171A0 // FUNCTION: fn_15286 template <> int CUIListBoxEx::AddData(const ExchangeUI::CItemData& value, bool refresh) { this->data.push_back(value); if (refresh) { this->UpdateScrollBar(); } return this->data.size() - 1; } // OFFSET: 0x00A17530 // FUNCTION: fn_15289 void CUIExchangeUI::OnCheckChanged(bool) { } // OFFSET: 0x00A17540 // FUNCTION: fn_15290 template <> void CUIListBoxEx::ClearData() { this->data.clear(); this->selected = static_cast(-1); this->UpdateScrollBar(); } // OFFSET: 0x00A17670 // FUNCTION: fn_15292 void CUIExchangeUI::OnEditSubmit() { } // OFFSET: 0x00A17680 // FUNCTION: fn_15293 void CUIExchangeUI::OnSelectFirstListItem(ExchangeUI::CUIItem*, const ExchangeUI::CItemData&) { } // OFFSET: 0x00A176A0 // FUNCTION: fn_15295 void CUIExchangeUI::OnSelectSecondListItem(ExchangeUI::CUIItem*, const ExchangeUI::CItemData&) { } // OFFSET: 0x00A176C0 // FUNCTION: fn_15297 void ExchangeUI::CUIItem::Paint() { if (this->frozen) { unsigned red = 0; unsigned green = 0; unsigned blue = 0; SkinPaletteChannels(ResourceMgr::Instance(), 10, 6, red, green, blue); this->ClearSurface(RGB(red, green, blue)); } else { this->ClearSurface(0xFFFFFFFF); } }