CSelectionBase.h 4.3 KB

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