MapViewActions.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * MapViewActions.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 "../../lib/int3.h"
  12. #include "../gui/CIntObject.h"
  13. class IMapRendererContext;
  14. class MapViewModel;
  15. class MapView;
  16. class MapViewActions : public CIntObject
  17. {
  18. bool swipeEnabled;
  19. bool isSwiping;
  20. Point swipeInitialViewPos;
  21. Point swipeInitialRealPos;
  22. int3 curHoveredTile;
  23. MapView & owner;
  24. std::shared_ptr<MapViewModel> model;
  25. std::shared_ptr<IMapRendererContext> context;
  26. void handleHover(const Point & cursorPosition);
  27. void handleSwipeMove(const Point & cursorPosition);
  28. bool handleSwipeStateChange(bool btnPressed);
  29. public:
  30. MapViewActions(MapView & owner, const std::shared_ptr<MapViewModel> & model);
  31. void setContext(const std::shared_ptr<IMapRendererContext> & context);
  32. void activate() override;
  33. void deactivate() override;
  34. void clickLeft(tribool down, bool previousState) override;
  35. void clickRight(tribool down, bool previousState) override;
  36. void clickMiddle(tribool down, bool previousState) override;
  37. void hover(bool on) override;
  38. void mouseMoved(const Point & cursorPosition) override;
  39. };