StackQueue.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * StackQueue.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. VCMI_LIB_NAMESPACE_BEGIN
  13. namespace battle
  14. {
  15. class Unit;
  16. }
  17. VCMI_LIB_NAMESPACE_END
  18. class CLabel;
  19. class TransparentFilledRectangle;
  20. class CAnimImage;
  21. class CFilledTexture;
  22. class BattleInterface;
  23. /// Shows the stack queue
  24. class StackQueue : public CIntObject
  25. {
  26. class StackBox : public CIntObject
  27. {
  28. StackQueue * owner;
  29. std::optional<uint32_t> boundUnitID;
  30. std::shared_ptr<CPicture> background;
  31. std::shared_ptr<CAnimImage> icon;
  32. std::shared_ptr<CLabel> amount;
  33. std::shared_ptr<CPicture> waitIcon;
  34. std::shared_ptr<CPicture> defendIcon;
  35. std::shared_ptr<CLabel> round;
  36. std::shared_ptr<TransparentFilledRectangle> roundRect;
  37. void show(Canvas & to) override;
  38. void showAll(Canvas & to) override;
  39. void showPopupWindow(const Point & cursorPosition) override;
  40. bool isBoundUnitHighlighted() const;
  41. public:
  42. StackBox(StackQueue * owner);
  43. void setUnit(const battle::Unit * unit, size_t turn = 0, std::optional<ui32> currentTurn = std::nullopt);
  44. std::optional<uint32_t> getBoundUnitID() const;
  45. };
  46. static const int QUEUE_SIZE_BIG = 10;
  47. std::shared_ptr<CFilledTexture> background;
  48. std::vector<std::shared_ptr<StackBox>> stackBoxes;
  49. BattleInterface & owner;
  50. int32_t getSiegeShooterIconID() const;
  51. public:
  52. const bool embedded;
  53. StackQueue(bool Embedded, BattleInterface & owner);
  54. void update();
  55. std::optional<uint32_t> getHoveredUnitIdIfAny() const;
  56. void show(Canvas & to) override;
  57. };