CWindowWithArtifacts.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * CWindowWithArtifacts.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 "../widgets/CArtifactsOfHeroMain.h"
  12. #include "../widgets/CArtifactsOfHeroKingdom.h"
  13. #include "../widgets/CArtifactsOfHeroAltar.h"
  14. #include "../widgets/CArtifactsOfHeroMarket.h"
  15. #include "../widgets/CArtifactsOfHeroBackpack.h"
  16. #include "CWindowObject.h"
  17. class CWindowWithArtifacts : virtual public CWindowObject, public IArtifactsHolder
  18. {
  19. public:
  20. using CArtifactsOfHeroPtr = std::shared_ptr<CArtifactsOfHeroBase>;
  21. std::vector<CArtifactsOfHeroPtr> artSets;
  22. explicit CWindowWithArtifacts(const std::vector<CArtifactsOfHeroPtr> * artSets = nullptr);
  23. void addSet(const std::shared_ptr<CArtifactsOfHeroBase> & newArtSet);
  24. const CGHeroInstance * getHeroPickedArtifact() const;
  25. const CArtifactInstance * getPickedArtifact() const;
  26. void clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot,
  27. bool allowExchange, bool altarTrading, bool closeWindow, const Point & cursorPosition);
  28. void swapArtifactAndClose(const CArtifactsOfHeroBase & artsInst, const ArtifactPosition & slot, const ArtifactLocation & dstLoc);
  29. void showArtifactPopup(const CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition) const;
  30. void showQuickBackpackWindow(const CGHeroInstance * hero, const ArtifactPosition & slot, const Point & cursorPosition) const;
  31. void activate() override;
  32. void deactivate() override;
  33. void enableKeyboardShortcuts() const;
  34. void updateArtifacts() override;
  35. protected:
  36. void markPossibleSlots() const;
  37. bool checkSpecialArts(const CArtifactInstance & artInst, const CGHeroInstance & hero, bool isTrade) const;
  38. void setCursorAnimation(const CArtifactInstance & artInst) const;
  39. void putPickedArtifact(const CGHeroInstance & curHero, const ArtifactPosition & targetSlot) const;
  40. void onClickPressedCommonArtifact(const CGHeroInstance & curHero, const ArtifactPosition & slot, bool closeWindow);
  41. };