CMarketWindow.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. const int buttonHeightWithMargin = 32 + 3;
  36. std::vector<std::shared_ptr<CButton>> changeModeButtons;
  37. std::shared_ptr<CButton> quitButton;
  38. std::function<void()> windowClosedCallback;
  39. const Point quitButtonPos = Point(516, 520);
  40. std::shared_ptr<CMarketBase> marketWidget;
  41. // This is workaround for bug in H3 files where this slot for ragdoll on this screen is missing
  42. std::shared_ptr<CPicture> artSlotBack;
  43. };