CSelectionBase.h 4.1 KB

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