/* * OptionsTab.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * * License: GNU General Public License v2.0 or later * Full text of license available in license.txt file, in main folder * */ #pragma once #include "../../lib/StartInfo.h" #include "../../lib/mapping/CMap.h" class CSlider; class CLabel; class CMultiLineLabel; class CFilledTexture; class CAnimImage; class CComponentBox; /// The options tab which is shown at the map selection phase. class OptionsTab : public CIntObject { std::shared_ptr background; std::shared_ptr labelTitle; std::shared_ptr labelSubTitle; std::shared_ptr labelPlayerNameAndHandicap; std::shared_ptr labelStartingTown; std::shared_ptr labelStartingHero; std::shared_ptr labelStartingBonus; std::shared_ptr labelPlayerTurnDuration; std::shared_ptr labelTurnDurationValue; ui8 humanPlayers; public: enum SelType { TOWN, HERO, BONUS }; struct CPlayerSettingsHelper { const PlayerSettings & settings; const SelType type; CPlayerSettingsHelper(const PlayerSettings & settings, SelType type) : settings(settings), type(type) {} /// visible image settings size_t getImageIndex(); std::string getImageName(); std::string getName(); /// name visible in options dialog std::string getTitle(); /// title in popup box std::string getSubtitle(); /// popup box subtitle std::string getDescription(); /// popup box description, not always present }; class CPlayerOptionTooltipBox : public CWindowObject, public CPlayerSettingsHelper { std::shared_ptr backgroundTexture; std::shared_ptr labelTitle; std::shared_ptr labelSubTitle; std::shared_ptr image; std::shared_ptr labelAssociatedCreatures; std::shared_ptr boxAssociatedCreatures; std::shared_ptr labelHeroSpeciality; std::shared_ptr imageSpeciality; std::shared_ptr labelSpecialityName; std::shared_ptr textBonusDescription; void genHeader(); void genTownWindow(); void genHeroWindow(); void genBonusWindow(); public: CPlayerOptionTooltipBox(CPlayerSettingsHelper & helper); }; /// Image with current town/hero/bonus struct SelectedBox : public CIntObject, public CPlayerSettingsHelper { std::shared_ptr image; std::shared_ptr subtitle; SelectedBox(Point position, PlayerSettings & settings, SelType type); void clickRight(tribool down, bool previousState) override; void update(); }; struct PlayerOptionsEntry : public CIntObject { PlayerInfo pi; PlayerSettings s; std::shared_ptr labelPlayerName; std::shared_ptr labelWhoCanPlay; std::shared_ptr background; std::shared_ptr buttonTownLeft; std::shared_ptr buttonTownRight; std::shared_ptr buttonHeroLeft; std::shared_ptr buttonHeroRight; std::shared_ptr buttonBonusLeft; std::shared_ptr buttonBonusRight; std::shared_ptr flag; std::shared_ptr town; std::shared_ptr hero; std::shared_ptr bonus; enum {HUMAN_OR_CPU, HUMAN, CPU} whoCanPlay; PlayerOptionsEntry(const PlayerSettings & S, const OptionsTab & parentTab); void hideUnavailableButtons(); private: const OptionsTab & parentTab; }; std::shared_ptr sliderTurnDuration; std::map> entries; OptionsTab(); void recreate(); void onSetPlayerClicked(const PlayerSettings & ps) const; };