CSelectionBase.h 3.9 KB

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