/* * CAdventureMapWidget.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 "../gui/InterfaceObjectConfigurable.h" class CHeroList; class CTownList; class CMinimap; class MapView; class CInfoBar; class IImage; class AdventureMapShortcuts; enum class EAdventureState; /// Internal class of AdventureMapInterface that contains actual UI elements class AdventureMapWidget : public InterfaceObjectConfigurable { int mapLevel; /// temporary stack of sizes of currently building widgets std::vector subwidgetSizes; /// list of images on which player-colored palette will be applied std::vector playerColoredImages; /// Widgets that require access from adventure map std::shared_ptr heroList; std::shared_ptr townList; std::shared_ptr minimap; std::shared_ptr mapView; std::shared_ptr infoBar; std::shared_ptr shortcuts; Rect readTargetArea(const JsonNode & source); Rect readSourceArea(const JsonNode & source, const JsonNode & sourceCommon); Rect readArea(const JsonNode & source, const Rect & boundingBox); std::shared_ptr buildInfobox(const JsonNode & input); std::shared_ptr buildMapImage(const JsonNode & input); std::shared_ptr buildMapButton(const JsonNode & input); std::shared_ptr buildMapContainer(const JsonNode & input); std::shared_ptr buildMapGameArea(const JsonNode & input); std::shared_ptr buildMapHeroList(const JsonNode & input); std::shared_ptr buildMapIcon(const JsonNode & input); std::shared_ptr buildMapTownList(const JsonNode & input); std::shared_ptr buildMinimap(const JsonNode & input); std::shared_ptr buildResourceDateBar(const JsonNode & input); std::shared_ptr buildStatusBar(const JsonNode & input); std::shared_ptr buildTexturePlayerColored(const JsonNode &); void setPlayerChildren(CIntObject * widget, const PlayerColor & player); void updateActiveStateChildden(CIntObject * widget); public: explicit AdventureMapWidget( std::shared_ptr shortcuts ); std::shared_ptr getHeroList(); std::shared_ptr getTownList(); std::shared_ptr getMinimap(); std::shared_ptr getMapView(); std::shared_ptr getInfoBar(); void setPlayerColor(const PlayerColor & player); void onMapViewMoved(const Rect & visibleArea, int mapLevel); void updateActiveState(); }; /// Small helper class that provides ownership for shared_ptr's of child elements class CAdventureMapContainerWidget : public CIntObject { friend class AdventureMapWidget; std::vector> ownedChildren; std::string disableCondition; }; class CAdventureMapOverlayWidget : public CAdventureMapContainerWidget { public: void show(Canvas & to) override; }; /// Small helper class that provides player-colorable icon using animation file class CAdventureMapIcon : public CIntObject { std::shared_ptr image; size_t index; size_t iconsPerPlayer; public: CAdventureMapIcon(const Point & position, const AnimationPath & image, size_t index, size_t iconsPerPlayer); void setPlayerColor(const PlayerColor & player); };