Batch #16351 by ragnarok-clanker: no function's compiled code changes; checked with 784 compiled unit(s), including every includer of Source/Archive/GPak.h, Source/Client/Browser/BrowserCommandTarget.h, Source/Client/Browser/BrowserDocumentUI.h, Source/Client/Browser/BrowserInPlace.h, Source/Client/Browser/WebBrowser.h, Source/Client/Input/Language.h, Source/Client/Input/LanguageTC.h, Source/Client/Input/Mouse.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Client/Stove/StovePCSDK.h, Source/Contents/AchievementMgr.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GndRiser.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/MousePointer.h, Source/Contents/Actors/Npc.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObjectState.h, Source/Contents/Actors/Skill.h, Source/Contents/AdventureGuideMgr.h, Source/Contents/CashEmotionMgr.h, Source/Contents/ClanInfo.h, Source/Contents/Configuration/GameSettingsMgr.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/AcidifiedThrow.h, Source/Contents/Effects/ArrowEffect.h, Source/Contents/Effects/AxeBoomerang.h, Source/Contents/Effects/BlastForge.h, Source/Contents/Effects/CharacterParticleBundle.h, Source/Contents/Effects/DummyEffectLauncher.h, Source/Contents/Effects/EZ2STREffectEx.h, Source/Contents/Effects/Effect.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/EffectEmitter.h, Source/Contents/Effects/EffectPrimitiveState.h, Source/Contents/Effects/EffectTypes.h, Source/Contents/Effects/ElectricEffect.h, Source/Contents/Effects/EmitterEffect.h, Source/Contents/Effects/FortuneKissEffect.h, Source/Contents/Effects/MagicFloorEffect.h, Source/Contents/Effects/MandraAttackEffect.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/MsgEffect.h, Source/Contents/Effects/Particle.h, Source/Contents/Effects/RagEffectState.h, Source/Contents/Effects/RichManKim.h, Source/Contents/Effects/SpriteParticle.h, Source/Contents/Effects/StarEffect.h, Source/Contents/Effects/WhirlwindEffect.h, Source/Contents/EnchantMgr.h, Source/Contents/FlyingShipRouteInfo.h, Source/Contents/Ground/GroundSpatial.h, Source/Contents/GuildInfo.h, Source/Contents/Hotkeys/InterfaceHotkey.h, Source/Contents/Items/ItemInfo.h, Source/Contents/Items/RuneSystem.h, Source/Contents/MapSkyMgr.h, Source/Contents/Models/ModelActor.h, Source/Contents/Movies/BinkMovie.h, Source/Contents/NavigationManager.h, Source/Contents/Party/PartyBookingMgr.h, Source/Contents/PetEvolutionMgr.h, Source/Contents/RenewQuestMgr.h, Source/Contents/RodexMailStore.h, Source/Contents/Schedule/Schedule.h, Source/Contents/Schedule/ShutDownSchedule.h, Source/Contents/SignBoard/SignBoard.h, Source/Contents/Skills/PlayerSkillBundle.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/Store/MCStoreInfoBackupAsyncWork.h, Source/Contents/UserData/AccountLinkedUserDataLoadAsyncWork.h, Source/Contents/UserData/NormalItemSlots.h, Source/Contents/WorldView/WorldViewData.h, Source/Network/Connection/Connection.h, Source/Render/DX7/DeviceOwnerDX7.h, Source/Render/DX7/DirectDrawEnumeration.h, Source/Render/DX9/DeviceOwnerDX9.h, Source/Render/Primitives/LightmappedPrimitive.h, Source/Render/Primitives/RenderPrimitive.h, Source/Render/Renderer.h, Source/Render/RendererDX7.h, Source/Render/Text/EmbedFont.h, Source/Render/Text/TextContext.h, Source/Render/Textures/Texture.h, Source/Resource/BinkRuntime.h, Source/Resource/GifResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Models/ModelMesh.h, Source/Resource/ResourceMgr.h, Source/Resource/World/GroundResource.h, Source/Resource/World/WorldResource.h, Source/Security/NProtectGameGuardMgr.h, Source/Security/ReassemblyPacketMgr.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UIBmpTextButton2.h, Source/UI/Buttons/UIDescriptRace.h, Source/UI/Buttons/UIItemTagButton.h, Source/UI/Buttons/UITVTextButton.h, Source/UI/Buttons/UITextureButton.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Chat/UISubChatHisWnd.h, Source/UI/Dialogs/UILoadingWnd.h, Source/UI/Dialogs/UIMiniMapWnd.h, Source/UI/Dialogs/UIPasswordWnd.h, Source/UI/Dialogs/UIRestartWnd.h, Source/UI/Dialogs/UISayDialogWnd.h, Source/UI/Edit/UIEditCtrl.h, Source/UI/Enchant/EnchantUI.h, Source/UI/GameSettings/GameSettingsUI.h, Source/UI/Guild/UIGuildWnd.h, Source/UI/Item/UIItemStoreFindWnd.h, Source/UI/Item/UIItemStoreSubWnd.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Items/UIEquipWnd.h, Source/UI/Items/UIExchangeWnd.h, Source/UI/Items/UIItemCollectionWnd.h, Source/UI/Items/UIItemRepairWnd.h, Source/UI/Items/UISwapEquipmentWnd.h, Source/UI/Lists/TableBox.h, Source/UI/Lists/UIListBox.h, Source/UI/Lists/UIListBoxEx.h, Source/UI/Lists/UIListBoxID.h, Source/UI/Lists/UIListBoxTemplate.h, Source/UI/Lists/UITabControl.h, Source/UI/Lists/UITreeView.h, Source/UI/Lists/UIVScrollBar.h, Source/UI/Navigation/UINavigationV4Wnd.h, Source/UI/Navigation/UIPrivateAirplaneWnd.h, Source/UI/Party/UIAdvenPartyBoardWnd.h, Source/UI/Party/UIRequestJoinPartyWnd.h, Source/UI/ProbabilityTable/UIProbabilityTable.h, Source/UI/Quest/UIRenewQuestWnd.h, Source/UI/Rodex/UIRodexComposeWnd.h, Source/UI/RuneSystem/UIRuneSystemWindows.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Shop/UIMerchantItemMyShopWnd.h, Source/UI/Shop/UIMerchantShopMakeWnd.h, Source/UI/Shop/UIMerchantShopTitle.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/Text/TextMarkup.h, Source/UI/Text/UIString.h, Source/UI/Text/UITextViewer.h, Source/UI/Text/UITransBalloonText.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UIMacroDetectorWnd.h, Source/UI/UIMacroUserInfoWnd.h, Source/UI/Window/UIAccountLimitedToolWnd.h, Source/UI/Window/UIBalloonOpenBtn.h, Source/UI/Window/UIBasicInfoWnd.h, Source/UI/Window/UIBattleMsgOptionWnd.h, Source/UI/Window/UICollectionSystemWnd.h, Source/UI/Window/UIControl.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UIJobListWnd.h, Source/UI/Window/UILoginWnd.h, Source/UI/Window/UIMakeCharWnd.h, Source/UI/Window/UIMerInfoWnd.h, Source/UI/Window/UIMessageBox.h, Source/UI/Window/UIMonsterDisplayWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UINoticeWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIRoMapWnd.h, Source/UI/Window/UISecondCostumeWnd.h, Source/UI/Window/UISeekPartyListWnd.h, Source/UI/Window/UISeekPartyMBWnd.h, Source/UI/Window/UISeekPartyWnd.h, Source/UI/Window/UISerachStoreInfoWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/WindowId.h, Source/Utility/Async/NAsyncWork.h, Source/Utility/Async/NRecycleObjectPoolMgr.h, Source/Utility/JsonCppLoader.h, Source/Utility/Lexicon/LexiconSerializer.h, Source/Utility/NFileLog.h, Source/Utility/Threading/NThread.h.
535 lines
14 KiB
C++
535 lines
14 KiB
C++
#ifndef RAGNAROK_SOURCE_UI_LISTS_UILISTBOXTEMPLATE_H
|
|
#define RAGNAROK_SOURCE_UI_LISTS_UILISTBOXTEMPLATE_H
|
|
|
|
#include "UI/Lists/UIVScrollBar.h"
|
|
#include "UI/Window/UIControl.h"
|
|
|
|
#include <algorithm>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <list>
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class CUIListItem : public CUIControl {
|
|
public:
|
|
__declspec(noinline) CUIListItem();
|
|
~CUIListItem() override;
|
|
|
|
void OnLBtnDown(int x, int y) override;
|
|
void OnMouseMove(int x, int y) override;
|
|
void OnLBtnUp(int x, int y) override;
|
|
void OnMouseEnter() override;
|
|
void Paint() override;
|
|
virtual void SetSelected(bool selected);
|
|
virtual void SetHighlighted(bool highlighted);
|
|
virtual void SetFrozen(bool frozen);
|
|
__declspec(noinline) void SetImageResources(CBitmapRes* normal, CBitmapRes* hover, CBitmapRes* pressed, CBitmapRes* disabled);
|
|
|
|
/* 0080 */ std::map<int, CBitmapRes*> images;
|
|
/* 0088 */ int selected;
|
|
/* 008C */ CBitmapRes* disabledImage;
|
|
/* 0090 */ unsigned char frozen;
|
|
/* 0094 */ int index;
|
|
/* 0098 */ std::function<void(CUIListItem*)> onHover;
|
|
/* 00C0 */ std::function<void(CUIListItem*)> onPress;
|
|
};
|
|
|
|
class CUIStaticText;
|
|
class CSprRes;
|
|
class CActRes;
|
|
|
|
template <class T> class CUIListBox;
|
|
|
|
namespace AdventureGuide {
|
|
class CUIPage;
|
|
|
|
class CUISubTab : public CUIListItem {
|
|
public:
|
|
CUISubTab();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
|
|
/* 00E8 */ CUIStaticText* labelText;
|
|
/* 00EC */ CUIStaticImage* stampImage;
|
|
/* 00F0 */ int id;
|
|
/* 00F4 */ unsigned int questId;
|
|
};
|
|
|
|
class CUITab : public CUIListItem {
|
|
public:
|
|
CUITab();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
void SetSelected(bool selected) override;
|
|
|
|
void OnSelectSubTab(CUISubTab* subTab);
|
|
CUIListBox<CUISubTab>* CreateSubTabList();
|
|
|
|
/* 00E8 */ CUIStaticText* labelText;
|
|
/* 00EC */ CUIListBox<CUISubTab>* subTabs;
|
|
/* 00F0 */ std::string title;
|
|
/* 0108 */ int type;
|
|
/* 010C */ CUIPage* page;
|
|
/* 0110 */ int collapsedHeight;
|
|
};
|
|
|
|
class CUIItemInfo : public CUIListItem {
|
|
public:
|
|
CUIItemInfo();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
void OnRBtnDown(int x, int y) override;
|
|
|
|
void SetDescription(int type, const std::vector<const char*>& description);
|
|
|
|
union {
|
|
/* 00E8 */ unsigned char headerControls[0x08];
|
|
struct {
|
|
/* 00E8 */ CUIStaticImage* image;
|
|
/* 00EC */ CUIStaticText* nameText;
|
|
};
|
|
};
|
|
/* 00F0 */ CUIStaticText* descriptionViewer;
|
|
/* 00F4 */ CUIStaticText* optionsViewer;
|
|
/* 00F8 */ CUIStaticText* sourcesViewer;
|
|
/* 00FC */ int itemId;
|
|
/* 0100 */ int type;
|
|
/* 0104 */ int location;
|
|
/* 0108 */ std::string description;
|
|
};
|
|
|
|
class CUIMonsterInfo : public CUIListItem {
|
|
public:
|
|
CUIMonsterInfo();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
void Paint() override;
|
|
void SetMonster(const std::string& title);
|
|
|
|
/* 00E8 */ CUIStaticText* nameText;
|
|
/* 00EC */ CUIStaticText* detailsViewer;
|
|
/* 00F0 */ CUIStaticText* valuesViewer;
|
|
/* 00F4 */ CSprRes* sprite;
|
|
/* 00F8 */ CActRes* action;
|
|
};
|
|
|
|
class CUIQuestInfo : public CUIListItem {
|
|
public:
|
|
CUIQuestInfo();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
void SetTitle(int id);
|
|
void SetTip(int id);
|
|
void SetStatusLines(bool first, bool second, bool third);
|
|
void SetViewerLines(const std::vector<std::string>& lines);
|
|
|
|
/* 00E8 */ UIWindow* stampImage;
|
|
/* 00EC */ CUIStaticText* titleViewer;
|
|
/* 00F0 */ CUIStaticText* linesViewer;
|
|
/* 00F4 */ CUIStaticText* statusViewer;
|
|
/* 00F8 */ std::string title;
|
|
/* 0110 */ int questId;
|
|
};
|
|
|
|
class CUITabInfo : public CUIListItem {
|
|
public:
|
|
CUITabInfo();
|
|
void OnCreate(int width, int height) override;
|
|
void OnInit() override;
|
|
|
|
/* 00E8 */ CUIStaticText* titleText;
|
|
/* 00EC */ CUIStaticText* descriptionText;
|
|
};
|
|
class CItemData {
|
|
public:
|
|
/* 0000 */ int id;
|
|
/* 0004 */ std::uint8_t first;
|
|
/* 0005 */ std::uint8_t second;
|
|
/* 0006 */ std::uint8_t third;
|
|
/* 0008 */ int categoryId;
|
|
/* 000C */ int categoryIndex;
|
|
/* 0010 */ std::string text;
|
|
/* 0028 */ std::vector<std::string> values;
|
|
/* 0034 */ int type;
|
|
};
|
|
|
|
class CMonsterData {
|
|
public:
|
|
/* 0000 */ std::string name;
|
|
/* 0018 */ std::vector<std::string> values;
|
|
};
|
|
class CQuestInfo {
|
|
public:
|
|
/* 0000 */ int id;
|
|
/* 0004 */ std::uint8_t categoryType;
|
|
/* 0008 */ int categoryId;
|
|
/* 000C */ int categoryIndex;
|
|
/* 0010 */ int questId;
|
|
/* 0014 */ std::string title;
|
|
/* 002C */ std::string text;
|
|
/* 0044 */ std::vector<std::string> rewards;
|
|
/* 0050 */ int type;
|
|
};
|
|
}
|
|
|
|
namespace Guide_Intro {
|
|
struct Contents {
|
|
Contents(const std::string& first, const std::string& second) : first(first), second(second) {
|
|
}
|
|
|
|
/* 0000 */ std::string first;
|
|
/* 0018 */ std::string second;
|
|
};
|
|
}
|
|
|
|
template <class T> class CUIListBox : public CUIControl {
|
|
public:
|
|
// INLINED
|
|
explicit CUIListBox()
|
|
: CUIControl(), scrollBar(nullptr), itemWidth(0), rowHeight(0), itemX(0), itemY(0), selected(nullptr), locked(0) {
|
|
}
|
|
~CUIListBox() override;
|
|
|
|
void OnCreate(int width, int height) override;
|
|
// OFFSET: 0x009D23B0
|
|
// FUNCTION: fn_14011
|
|
// OFFSET: 0x009D23C0
|
|
// FUNCTION: fn_14012
|
|
void Paint() override {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x009D2410
|
|
// FUNCTION: fn_14017
|
|
// OFFSET: 0x009D2450
|
|
// FUNCTION: fn_14018
|
|
void OnWheel(int value) override {
|
|
if (!this->scrollBar->dragging && this->scrollBar->total > this->scrollBar->visible) {
|
|
this->scrollBar->OnWheel(value);
|
|
} else if (this->parent) {
|
|
this->parent->OnWheel(value);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009D3FD0
|
|
// FUNCTION: fn_14037
|
|
// OFFSET: 0x009D4040
|
|
// FUNCTION: fn_14038
|
|
void Resize(int width, int height) override {
|
|
UIWindow::Resize(width, height);
|
|
this->scrollBar->Resize(this->scrollBar->geometry.width, height);
|
|
int total = 0;
|
|
for (T* item : this->items) {
|
|
total += item->geometry.height;
|
|
}
|
|
this->scrollBar->SetTotal(total);
|
|
this->scrollBar->SetVisible(this->geometry.height);
|
|
this->scrollBar->SetPosition(this->scrollBar->position);
|
|
}
|
|
|
|
// OFFSET: 0x009DD9A0
|
|
// FUNCTION: fn_14345
|
|
// OFFSET: 0x009DD9F0
|
|
// FUNCTION: fn_14346
|
|
void UpdateScrollBar() {
|
|
int total = 0;
|
|
for (T* item : this->items) {
|
|
total += item->geometry.height;
|
|
}
|
|
this->scrollBar->SetTotal(total);
|
|
this->scrollBar->SetVisible(this->geometry.height);
|
|
this->scrollBar->SetPosition(this->scrollBar->position);
|
|
}
|
|
|
|
void LoadSkin(bool resolveSkin) override;
|
|
|
|
void SelectItem(CUIListItem* item);
|
|
T* CreateItem();
|
|
|
|
// INLINED
|
|
void SetOnSelect(std::function<void(T*)> handler) {
|
|
this->onSelect = handler;
|
|
}
|
|
|
|
// INLINED
|
|
void SetImages(const std::string& normal, const std::string& hover, const std::string& pressed, const std::string& disabled) {
|
|
this->imageNames[0] = normal;
|
|
this->imageNames[1] = hover;
|
|
this->imageNames[2] = pressed;
|
|
this->disabledName = disabled;
|
|
this->LoadSkin(0);
|
|
this->Invalidate();
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarButtonImages(const std::string& up, const std::string& down) {
|
|
this->scrollBar->SetButtonImages(up, down);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarThumbImages(const std::string& top, const std::string& middle, const std::string& bottom) {
|
|
this->scrollBar->SetThumbImages(top, middle, bottom);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarThumbImage(const std::string& name) {
|
|
this->scrollBar->SetThumbImage(name);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarBackground(const std::string& name) {
|
|
this->scrollBar->SetBackground(name);
|
|
}
|
|
|
|
CResPtr<CBitmapRes>& NormalImage() {
|
|
return this->normalImage;
|
|
}
|
|
|
|
/* 0080 */ CResPtr<CBitmapRes> normalImage;
|
|
/* 0084 */ CResPtr<CBitmapRes> hoverImage;
|
|
/* 0088 */ CResPtr<CBitmapRes> pressedImage;
|
|
/* 008C */ CResPtr<CBitmapRes> disabledImage;
|
|
/* 0090 */ std::map<int, std::string> imageNames;
|
|
/* 0098 */ std::string disabledName;
|
|
/* 00B0 */ CUIVScrollBar* scrollBar;
|
|
/* 00B4 */ int itemWidth;
|
|
/* 00B8 */ int rowHeight;
|
|
/* 00BC */ int itemX;
|
|
/* 00C0 */ int itemY;
|
|
/* 00C4 */ std::list<T*> items;
|
|
/* 00CC */ T* selected;
|
|
/* 00D0 */ unsigned char locked;
|
|
/* 00D1 */ unsigned char padding_00D1[0x07];
|
|
/* 00D8 */ std::function<void(T*)> onSelect;
|
|
};
|
|
|
|
template <class T, class D> class CUIListBoxEx : public CUIControl {
|
|
public:
|
|
CUIListBoxEx();
|
|
~CUIListBoxEx() override;
|
|
void OnCreate(int width, int height) override;
|
|
// OFFSET: 0x00A01E70
|
|
// FUNCTION: fn_14832
|
|
// OFFSET: 0x00A01E80
|
|
// FUNCTION: fn_14833
|
|
// OFFSET: 0x00A0CE60
|
|
// FUNCTION: fn_15037
|
|
// OFFSET: 0x00A63890
|
|
// FUNCTION: fn_16437
|
|
void Paint() override {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x00A01E90
|
|
// FUNCTION: fn_14834
|
|
// OFFSET: 0x00A01ED0
|
|
// FUNCTION: fn_14835
|
|
// OFFSET: 0x00A0CE70
|
|
// FUNCTION: fn_15038
|
|
// OFFSET: 0x00A638A0
|
|
// FUNCTION: fn_16438
|
|
void OnWheel(int value) override {
|
|
if (!this->scrollBar->dragging && this->scrollBar->total > this->scrollBar->visible) {
|
|
this->scrollBar->OnWheel(value);
|
|
} else if (this->parent) {
|
|
this->parent->OnWheel(value);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009F9890
|
|
// FUNCTION: fn_14810
|
|
// OFFSET: 0x009F98F0
|
|
// FUNCTION: fn_14811
|
|
// OFFSET: 0x00A08DE0
|
|
// FUNCTION: fn_15032
|
|
void ClearItems() {
|
|
for (T* item : this->items) {
|
|
this->RemoveChild(item, 1);
|
|
}
|
|
this->items.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
}
|
|
bool RebindIndex(int index);
|
|
void SelectItem(CUIListItem* item);
|
|
bool SelectIndex(int index);
|
|
void AddNewItem() {
|
|
}
|
|
__declspec(noinline) T* CreateItem();
|
|
void Resize(int width, int height) override {
|
|
UIWindow::Resize(width, height);
|
|
}
|
|
void LoadSkin(bool resolveSkin) override;
|
|
|
|
// OFFSET: 0x00A04B30
|
|
// FUNCTION: fn_14963
|
|
int AddData(const D& value, bool refresh) {
|
|
this->data.push_back(value);
|
|
if (refresh) {
|
|
this->UpdateScrollBar();
|
|
}
|
|
return this->data.size() - 1;
|
|
}
|
|
|
|
// OFFSET: 0x00A051E0
|
|
// FUNCTION: fn_14971
|
|
// OFFSET: 0x00A662D0
|
|
// FUNCTION: fn_16614
|
|
void ClearData() {
|
|
this->data.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
this->UpdateScrollBar();
|
|
}
|
|
|
|
// OFFSET: 0x00A15450
|
|
// FUNCTION: fn_15196
|
|
void SetOnSelect(std::function<void(T*, const D&)> handler) {
|
|
this->onSelect = handler;
|
|
}
|
|
|
|
// OFFSET: 0x00A154C0
|
|
// FUNCTION: fn_15197
|
|
void SetBinder(std::function<void(T*, const D&)> handler) {
|
|
this->binder = handler;
|
|
}
|
|
|
|
// OFFSET: 0x00A15AA0
|
|
// FUNCTION: fn_15201
|
|
void SetImages(const std::string& normal, const std::string& hover, const std::string& pressed, const std::string& disabled) {
|
|
this->imageNames[0] = normal;
|
|
this->imageNames[1] = hover;
|
|
this->imageNames[2] = pressed;
|
|
this->disabledName = disabled;
|
|
this->LoadSkin(0);
|
|
this->Invalidate();
|
|
}
|
|
|
|
// OFFSET: 0x009DD950
|
|
// FUNCTION: fn_14344
|
|
// OFFSET: 0x00A06300
|
|
// FUNCTION: fn_15001
|
|
// OFFSET: 0x00A4E360
|
|
// FUNCTION: fn_16205
|
|
void UpdateScrollBar() {
|
|
this->scrollBar->SetTotal(this->data.size() * this->rowHeight + this->itemY);
|
|
this->scrollBar->SetVisible(this->geometry.height);
|
|
this->scrollBar->SetPosition(this->scrollBar->position);
|
|
this->rebind = 1;
|
|
}
|
|
|
|
// OFFSET: 0x009D43D0
|
|
// FUNCTION: fn_14043
|
|
// OFFSET: 0x009D45D0
|
|
// FUNCTION: fn_14044
|
|
// OFFSET: 0x009D47D0
|
|
// FUNCTION: fn_14045
|
|
// OFFSET: 0x009D49D0
|
|
// FUNCTION: fn_14046
|
|
// OFFSET: 0x00A027C0
|
|
// FUNCTION: fn_14843
|
|
// OFFSET: 0x00A029C0
|
|
// FUNCTION: fn_14844
|
|
void 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<int>(row)) {
|
|
if (row - first < static_cast<unsigned int>(this->items.size())) {
|
|
std::rotate(this->items.begin(), this->items.begin() + (row - first), this->items.end());
|
|
}
|
|
} else if (first > static_cast<int>(row)) {
|
|
if (first - row < static_cast<unsigned int>(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;
|
|
}
|
|
T* item = *it;
|
|
if (item) {
|
|
if (this->rebind || row != static_cast<unsigned int>(item->index)) {
|
|
item->index = row;
|
|
if (this->binder) {
|
|
auto node = this->data.begin();
|
|
std::advance(node, static_cast<int>(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);
|
|
}
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarButtonImages(const std::string& up, const std::string& down) {
|
|
this->scrollBar->SetButtonImages(up, down);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarThumbImages(const std::string& top, const std::string& middle, const std::string& bottom) {
|
|
this->scrollBar->SetThumbImages(top, middle, bottom);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarThumbImage(const std::string& name) {
|
|
this->scrollBar->SetThumbImage(name);
|
|
}
|
|
|
|
// INLINED
|
|
void SetScrollBarBackground(const std::string& name) {
|
|
this->scrollBar->SetBackground(name);
|
|
}
|
|
|
|
CResPtr<CBitmapRes>& NormalImage() {
|
|
return this->normalImage;
|
|
}
|
|
|
|
/* 0080 */ CResPtr<CBitmapRes> normalImage;
|
|
/* 0084 */ CResPtr<CBitmapRes> hoverImage;
|
|
/* 0088 */ CResPtr<CBitmapRes> pressedImage;
|
|
/* 008C */ CResPtr<CBitmapRes> disabledImage;
|
|
/* 0090 */ std::map<int, std::string> imageNames;
|
|
/* 0098 */ std::string disabledName;
|
|
/* 00B0 */ CUIVScrollBar* scrollBar;
|
|
/* 00B4 */ int itemWidth;
|
|
/* 00B8 */ int rowHeight;
|
|
/* 00BC */ int itemX;
|
|
/* 00C0 */ int itemY;
|
|
/* 00C4 */ unsigned char layoutFlag;
|
|
/* 00C5 */ unsigned char padding_00C5[0x03];
|
|
/* 00C8 */ std::vector<T*> items;
|
|
/* 00D4 */ std::list<D> data;
|
|
/* 00DC */ unsigned int selected;
|
|
/* 00E0 */ unsigned char selectionFlag;
|
|
/* 00E1 */ unsigned char rebind;
|
|
/* 00E2 */ unsigned char padding_00E2[0x06];
|
|
/* 00E8 */ std::function<void(T*, const D&)> onSelect;
|
|
/* 0110 */ std::function<void(T*, const D&)> binder;
|
|
};
|
|
|
|
#endif
|