CAdvMapPanel.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * AdventureMapClasses.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 "ObjectLists.h"
  12. #include "../../lib/FunctionList.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CArmedInstance;
  15. class CGGarrison;
  16. class CGObjectInstance;
  17. class CGHeroInstance;
  18. class CGTownInstance;
  19. struct Component;
  20. struct InfoAboutArmy;
  21. struct InfoAboutHero;
  22. struct InfoAboutTown;
  23. VCMI_LIB_NAMESPACE_END
  24. class CAnimation;
  25. class CAnimImage;
  26. class CShowableAnim;
  27. class CFilledTexture;
  28. class CButton;
  29. class CComponent;
  30. class CHeroTooltip;
  31. class CTownTooltip;
  32. class CTextBox;
  33. class IImage;
  34. /// simple panel that contains other displayable elements; used to separate groups of controls
  35. class CAdvMapPanel : public CIntObject
  36. {
  37. std::vector<std::shared_ptr<CButton>> colorableButtons;
  38. std::vector<std::shared_ptr<CIntObject>> otherObjects;
  39. /// the surface passed to this obj will be freed in dtor
  40. std::shared_ptr<IImage> background;
  41. public:
  42. CAdvMapPanel(std::shared_ptr<IImage> bg, Point position);
  43. void addChildToPanel(std::shared_ptr<CIntObject> obj, ui8 actions = 0);
  44. void addChildColorableButton(std::shared_ptr<CButton> button);
  45. /// recolors all buttons to given player color
  46. void setPlayerColor(const PlayerColor & clr);
  47. void showAll(SDL_Surface * to) override;
  48. };
  49. /// specialized version of CAdvMapPanel that handles recolorable def-based pictures for world view info panel
  50. class CAdvMapWorldViewPanel : public CAdvMapPanel
  51. {
  52. /// data that allows reconstruction of panel info icons
  53. std::vector<std::pair<int, Point>> iconsData;
  54. /// ptrs to child-pictures constructed from iconsData
  55. std::vector<std::shared_ptr<CAnimImage>> currentIcons;
  56. /// surface drawn below world view panel on higher resolutions (won't be needed when world view panel is configured for extraResolutions mod)
  57. std::shared_ptr<CFilledTexture> backgroundFiller;
  58. std::shared_ptr<CAnimation> icons;
  59. public:
  60. CAdvMapWorldViewPanel(std::shared_ptr<CAnimation> _icons, std::shared_ptr<IImage> bg, Point position, int spaceBottom, const PlayerColor &color);
  61. virtual ~CAdvMapWorldViewPanel();
  62. void addChildIcon(std::pair<int, Point> data, int indexOffset);
  63. /// recreates all pictures from given def to recolor them according to current player color
  64. void recolorIcons(const PlayerColor & color, int indexOffset);
  65. };