CSelectionBase.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * CSelectionBase.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 "../mainmenu/CMainMenu.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CMapInfo;
  14. struct StartInfo;
  15. struct PlayerInfo;
  16. VCMI_LIB_NAMESPACE_END
  17. class CButton;
  18. class CTextBox;
  19. class CTextInput;
  20. class CAnimImage;
  21. class CToggleGroup;
  22. class RandomMapTab;
  23. class OptionsTab;
  24. class TurnOptionsTab;
  25. class SelectionTab;
  26. class InfoCard;
  27. class CChatBox;
  28. class CLabel;
  29. class CFlagBox;
  30. class CLabelGroup;
  31. class TransparentFilledRectangle;
  32. class ISelectionScreenInfo
  33. {
  34. public:
  35. ESelectionScreen screenType;
  36. ISelectionScreenInfo(ESelectionScreen ScreenType = ESelectionScreen::unknown);
  37. virtual ~ISelectionScreenInfo();
  38. virtual const CMapInfo * getMapInfo() = 0;
  39. virtual const StartInfo * getStartInfo() = 0;
  40. virtual int getCurrentDifficulty();
  41. virtual PlayerInfo getPlayerInfo(PlayerColor color);
  42. };
  43. /// The actual map selection screen which consists of the options and selection tab
  44. class CSelectionBase : public CWindowObject, public ISelectionScreenInfo
  45. {
  46. public:
  47. std::shared_ptr<InfoCard> card;
  48. std::shared_ptr<CButton> buttonSelect;
  49. std::shared_ptr<CButton> buttonRMG;
  50. std::shared_ptr<CButton> buttonOptions;
  51. std::shared_ptr<CButton> buttonTurnOptions;
  52. std::shared_ptr<CButton> buttonStart;
  53. std::shared_ptr<CButton> buttonBack;
  54. std::shared_ptr<CButton> buttonSimturns;
  55. std::shared_ptr<SelectionTab> tabSel;
  56. std::shared_ptr<OptionsTab> tabOpt;
  57. std::shared_ptr<TurnOptionsTab> tabTurnOptions;
  58. std::shared_ptr<RandomMapTab> tabRand;
  59. std::shared_ptr<CIntObject> curTab;
  60. CSelectionBase(ESelectionScreen type);
  61. virtual void toggleTab(std::shared_ptr<CIntObject> tab);
  62. };
  63. class InfoCard : public CIntObject
  64. {
  65. std::shared_ptr<CPicture> playerListBg;
  66. std::shared_ptr<CPicture> background;
  67. std::shared_ptr<CAnimImage> iconsVictoryCondition;
  68. std::shared_ptr<CAnimImage> iconsLossCondition;
  69. std::shared_ptr<CAnimImage> iconsMapSizes;
  70. std::shared_ptr<CLabel> labelSaveDate;
  71. std::shared_ptr<CLabel> labelMapSize;
  72. std::shared_ptr<CLabel> labelScenarioName;
  73. std::shared_ptr<CLabel> labelScenarioDescription;
  74. std::shared_ptr<CLabel> labelVictoryCondition;
  75. std::shared_ptr<CLabel> labelLossCondition;
  76. std::shared_ptr<CLabel> labelMapDiff;
  77. std::shared_ptr<CLabel> labelPlayerDifficulty;
  78. std::shared_ptr<CLabel> labelRating;
  79. std::shared_ptr<CLabel> labelCampaignDescription;
  80. std::shared_ptr<CLabel> mapName;
  81. std::shared_ptr<CTextBox> mapDescription;
  82. std::shared_ptr<CLabel> labelDifficulty;
  83. std::shared_ptr<CLabel> labelDifficultyPercent;
  84. std::shared_ptr<CLabel> labelVictoryConditionText;
  85. std::shared_ptr<CLabel> labelLossConditionText;
  86. std::shared_ptr<CLabelGroup> labelGroupPlayersAssigned;
  87. std::shared_ptr<CLabelGroup> labelGroupPlayersUnassigned;
  88. public:
  89. bool showChat;
  90. std::shared_ptr<CChatBox> chat;
  91. std::shared_ptr<CFlagBox> flagbox;
  92. std::shared_ptr<CToggleGroup> iconDifficulty;
  93. InfoCard();
  94. void disableLabelRedraws();
  95. void changeSelection();
  96. void toggleChat();
  97. void setChat(bool activateChat);
  98. };
  99. class CChatBox : public CIntObject
  100. {
  101. public:
  102. std::shared_ptr<CTextBox> chatHistory;
  103. std::shared_ptr<CTextInput> inputBox;
  104. std::shared_ptr<TransparentFilledRectangle> inputBackground;
  105. CChatBox(const Rect & rect);
  106. void keyPressed(EShortcut key) override;
  107. bool captureThisKey(EShortcut key) override;
  108. void addNewMessage(const std::string & text);
  109. };
  110. class CFlagBox : public CIntObject
  111. {
  112. std::shared_ptr<CAnimation> iconsTeamFlags;
  113. std::shared_ptr<CLabel> labelAllies;
  114. std::shared_ptr<CLabel> labelEnemies;
  115. std::vector<std::shared_ptr<CAnimImage>> flagsAllies;
  116. std::vector<std::shared_ptr<CAnimImage>> flagsEnemies;
  117. public:
  118. CFlagBox(const Rect & rect);
  119. void recreate();
  120. void showPopupWindow(const Point & cursorPosition) override;
  121. void showTeamsPopup();
  122. class CFlagBoxTooltipBox : public CWindowObject
  123. {
  124. std::shared_ptr<CLabel> labelTeamAlignment;
  125. std::shared_ptr<CLabelGroup> labelGroupTeams;
  126. std::vector<std::shared_ptr<CAnimImage>> iconsFlags;
  127. public:
  128. CFlagBoxTooltipBox(std::shared_ptr<CAnimation> icons);
  129. };
  130. };
  131. extern ISelectionScreenInfo * SEL;