CMarketWindow.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * CMarketWindow.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/markets/CMarketBase.h"
  12. #include "CWindowWithArtifacts.h"
  13. class CMarketWindow final : public CStatusbarWindow, public CWindowWithArtifacts, public IGarrisonHolder, public IMarketHolder
  14. {
  15. public:
  16. CMarketWindow(const IMarket * market, const CGHeroInstance * hero, const std::function<void()> & onWindowClosed, EMarketMode mode);
  17. void updateResources() override;
  18. void updateArtifacts() override;
  19. void updateGarrisons() override;
  20. void updateExperience() override;
  21. void update();
  22. void close() override;
  23. bool holdsGarrison(const CArmedInstance * army) override;
  24. private:
  25. void createChangeModeButtons(EMarketMode currentMode, const IMarket * market, const CGHeroInstance * hero);
  26. void initWidgetInternals(const EMarketMode mode, const std::pair<std::string, std::string> & quitButtonHelpContainer);
  27. std::string getMarketTitle(const ObjectInstanceID marketId, const EMarketMode mode) const;
  28. void createArtifactsBuying(const IMarket * market, const CGHeroInstance * hero);
  29. void createArtifactsSelling(const IMarket * market, const CGHeroInstance * hero);
  30. void createMarketResources(const IMarket * market, const CGHeroInstance * hero);
  31. void createFreelancersGuild(const IMarket * market, const CGHeroInstance * hero);
  32. void createTransferResources(const IMarket * market, const CGHeroInstance * hero);
  33. void createAltarArtifacts(const IMarket * market, const CGHeroInstance * hero);
  34. void createAltarCreatures(const IMarket * market, const CGHeroInstance * hero);
  35. ImagePath getImagePathBasedOnResources(std::string name);
  36. const int buttonHeightWithMargin = 32 + 3;
  37. std::vector<std::shared_ptr<CButton>> changeModeButtons;
  38. std::shared_ptr<CButton> quitButton;
  39. std::function<void()> windowClosedCallback;
  40. const Point quitButtonPos = Point(516, 520);
  41. std::shared_ptr<CMarketBase> marketWidget;
  42. // This is workaround for bug in H3 files where this slot for ragdoll on this screen is missing
  43. std::shared_ptr<CPicture> artSlotBack;
  44. };