CMarketWindow.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 : public CStatusbarWindow, public CWindowWithArtifacts, public IGarrisonHolder
  14. {
  15. public:
  16. CMarketWindow(const IMarket * market, const CGHeroInstance * hero, const std::function<void()> & onWindowClosed, EMarketMode mode);
  17. void updateResource();
  18. void updateArtifacts();
  19. void updateGarrisons() override;
  20. void updateHero();
  21. void update() override;
  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. void createArtifactsBuying(const IMarket * market, const CGHeroInstance * hero);
  28. void createArtifactsSelling(const IMarket * market, const CGHeroInstance * hero);
  29. void createMarketResources(const IMarket * market, const CGHeroInstance * hero);
  30. void createFreelancersGuild(const IMarket * market, const CGHeroInstance * hero);
  31. void createTransferResources(const IMarket * market, const CGHeroInstance * hero);
  32. void createAltarArtifacts(const IMarket * market, const CGHeroInstance * hero);
  33. void createAltarCreatures(const IMarket * market, const CGHeroInstance * hero);
  34. const int buttonHeightWithMargin = 32 + 3;
  35. std::vector<std::shared_ptr<CButton>> changeModeButtons;
  36. std::shared_ptr<CButton> quitButton;
  37. std::function<void()> windowClosedCallback;
  38. const Point quitButtonPos = Point(516, 520);
  39. std::shared_ptr<CMarketBase> marketWidget;
  40. // This is workaround for bug in H3 files where this slot for ragdoll on this screen is missing
  41. std::shared_ptr<CPicture> artSlotBack;
  42. };