CArtifactsOfHeroBackpack.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * CArtifactsOfHeroBackpack.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "CArtifactsOfHeroBase.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct ArtifactLocation;
  14. VCMI_LIB_NAMESPACE_END
  15. class CListBoxWithCallback;
  16. class CArtifactsOfHeroBackpack : public CArtifactsOfHeroBase
  17. {
  18. public:
  19. CArtifactsOfHeroBackpack();
  20. CArtifactsOfHeroBackpack(const Point & position);
  21. void swapArtifacts(const ArtifactLocation & srcLoc, const ArtifactLocation & dstLoc);
  22. void pickUpArtifact(CHeroArtPlace & artPlace);
  23. void scrollBackpack(int offset) override;
  24. void updateBackpackSlots() override;
  25. size_t getActiveSlotRowsNum();
  26. size_t getSlotsNum();
  27. protected:
  28. std::shared_ptr<CListBoxWithCallback> backpackListBox;
  29. std::vector<std::shared_ptr<CPicture>> backpackSlotsBackgrounds;
  30. const size_t slots_columns_max = 8;
  31. const size_t slots_rows_max = 8;
  32. const int slotSizeWithMargin = 46;
  33. const int sliderPosOffsetX = 5;
  34. void initAOHbackpack(size_t slots, bool slider);
  35. };
  36. class CArtifactsOfHeroQuickBackpack : public CArtifactsOfHeroBackpack
  37. {
  38. public:
  39. CArtifactsOfHeroQuickBackpack(const Point & position, const ArtifactPosition filterBySlot);
  40. void setHero(const CGHeroInstance * hero);
  41. ArtifactPosition getFilterSlot();
  42. private:
  43. ArtifactPosition filterBySlot;
  44. };