UnitActionPanel.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * UnitActionPanel.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 "../gui/CIntObject.h"
  12. #include "../../lib/battle/PossiblePlayerBattleAction.h"
  13. #include "../../lib/filesystem/ResourcePath.h"
  14. class CFilledTexture;
  15. class TransparentFilledRectangle;
  16. class CToggleButton;
  17. class CLabel;
  18. class BattleInterface;
  19. class UnitActionPanel : public CIntObject
  20. {
  21. private:
  22. std::shared_ptr<CFilledTexture> background;
  23. std::shared_ptr<TransparentFilledRectangle> rect;
  24. std::vector<std::shared_ptr<CToggleButton>> buttons;
  25. BattleInterface & owner;
  26. void testAndAddAction(const std::vector<PossiblePlayerBattleAction> & allActions, const std::vector<PossiblePlayerBattleAction::Actions> & actionFilter, const ImagePath & iconPath, const std::string & descriptionTextID );
  27. void testAndAddSpell(const std::vector<PossiblePlayerBattleAction> & allActions, const SpellID & spellFilter );
  28. void restoreAllActions();
  29. void setActions(int buttonIndex, const std::vector<PossiblePlayerBattleAction> & newActions);
  30. public:
  31. static constexpr int ACTION_SLOTS = 12;
  32. UnitActionPanel(BattleInterface & owner);
  33. void setPossibleActions(const std::vector<PossiblePlayerBattleAction> & actions);
  34. std::vector<std::tuple<SpellID, bool>> getSpells() const;
  35. void show(Canvas & to) override;
  36. };