1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
vcmi/client/widgets/CArtifactsOfHeroBackpack.h

58 lines
1.5 KiB
C++
Raw Normal View History

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();
2023-07-06 21:14:12 +02:00
void swapArtifacts(const ArtifactLocation & srcLoc, const ArtifactLocation & dstLoc);
void pickUpArtifact(CArtPlace & artPlace);
2023-07-17 18:42:55 +02:00
void scrollBackpack(int offset) override;
void updateBackpackSlots() override;
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;
const int slotSizeWithMargin = 46;
2023-11-07 14:17:34 +02:00
const int sliderPosOffsetX = 5;
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
};