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 "../widgets/CWindowWithArtifacts.h"
  13. #include "CWindowObject.h"
  14. class CMarketWindow : public CStatusbarWindow, public CWindowWithArtifacts, public IGarrisonHolder
  15. {
  16. public:
  17. CMarketWindow(const IMarket * market, const CGHeroInstance * hero, const std::function<void()> & onWindowClosed, EMarketMode mode);
  18. void updateResource();
  19. void updateArtifacts();
  20. void updateGarrisons() override;
  21. void updateHero();
  22. void close() override;
  23. bool holdsGarrison(const CArmedInstance * army) override;
  24. void artifactRemoved(const ArtifactLocation & artLoc) override;
  25. void artifactMoved(const ArtifactLocation & srcLoc, const ArtifactLocation & destLoc, bool withRedraw) override;
  26. private:
  27. void createChangeModeButtons(EMarketMode currentMode, const IMarket * market, const CGHeroInstance * hero);
  28. void initWidgetInternals(const EMarketMode mode, const std::pair<std::string, std::string> & quitButtonHelpContainer);
  29. void createArtifactsBuying(const IMarket * market, const CGHeroInstance * hero);
  30. void createArtifactsSelling(const IMarket * market, const CGHeroInstance * hero);
  31. void createMarketResources(const IMarket * market, const CGHeroInstance * hero);
  32. void createFreelancersGuild(const IMarket * market, const CGHeroInstance * hero);
  33. void createTransferResources(const IMarket * market, const CGHeroInstance * hero);
  34. void createAltarArtifacts(const IMarket * market, const CGHeroInstance * hero);
  35. void createAltarCreatures(const IMarket * market, const CGHeroInstance * hero);
  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. };