2023-07-06 21:14:12 +02:00
|
|
|
/*
|
|
|
|
* CArtifactsOfHeroBackpack.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CArtifactsOfHeroBase.h"
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
struct ArtifactLocation;
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2023-07-17 18:42:55 +02:00
|
|
|
class CListBoxWithCallback;
|
|
|
|
|
2023-07-06 21:14:12 +02:00
|
|
|
class CArtifactsOfHeroBackpack : public CArtifactsOfHeroBase
|
|
|
|
{
|
|
|
|
public:
|
2023-12-17 16:30:19 +02:00
|
|
|
CArtifactsOfHeroBackpack(size_t slotsColumnsMax, size_t slotsRowsMax);
|
2023-11-07 14:17:34 +02:00
|
|
|
CArtifactsOfHeroBackpack();
|
2024-03-07 16:52:50 +02:00
|
|
|
void onSliderMoved(int newVal);
|
2023-07-17 18:42:55 +02:00
|
|
|
void updateBackpackSlots() override;
|
2023-08-31 21:27:32 +02:00
|
|
|
size_t getActiveSlotRowsNum();
|
2023-11-07 14:17:34 +02:00
|
|
|
size_t getSlotsNum();
|
2023-07-06 21:14:12 +02:00
|
|
|
|
2023-11-07 14:17:34 +02:00
|
|
|
protected:
|
2023-07-17 18:42:55 +02:00
|
|
|
std::shared_ptr<CListBoxWithCallback> backpackListBox;
|
2023-08-20 18:57:53 +02:00
|
|
|
std::vector<std::shared_ptr<CPicture>> backpackSlotsBackgrounds;
|
2023-12-17 16:30:19 +02:00
|
|
|
size_t slotsColumnsMax;
|
|
|
|
size_t slotsRowsMax;
|
2023-08-31 21:27:32 +02:00
|
|
|
const int slotSizeWithMargin = 46;
|
2023-11-07 14:17:34 +02:00
|
|
|
const int sliderPosOffsetX = 5;
|
2024-03-05 17:59:56 +02:00
|
|
|
int backpackPos; // Position to display artifacts in heroes backpack
|
2023-11-07 14:17:34 +02:00
|
|
|
|
|
|
|
void initAOHbackpack(size_t slots, bool slider);
|
2023-12-17 16:30:19 +02:00
|
|
|
size_t calcRows(size_t slots);
|
2023-11-07 14:17:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CArtifactsOfHeroQuickBackpack : public CArtifactsOfHeroBackpack
|
|
|
|
{
|
|
|
|
public:
|
2023-12-17 16:30:19 +02:00
|
|
|
CArtifactsOfHeroQuickBackpack(const ArtifactPosition filterBySlot);
|
2023-11-07 14:17:34 +02:00
|
|
|
void setHero(const CGHeroInstance * hero);
|
|
|
|
ArtifactPosition getFilterSlot();
|
2023-12-17 16:30:19 +02:00
|
|
|
void selectSlotAt(const Point & position);
|
|
|
|
void swapSelected();
|
2023-11-07 14:17:34 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
ArtifactPosition filterBySlot;
|
2023-07-16 20:16:12 +02:00
|
|
|
};
|