MapViewActions.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 isSwiping;
  19. Point swipeInitialViewPos;
  20. Point swipeInitialRealPos;
  21. MapView & owner;
  22. std::shared_ptr<MapViewModel> model;
  23. std::shared_ptr<IMapRendererContext> context;
  24. void handleHover(const Point & cursorPosition);
  25. void handleSwipeMove(const Point & cursorPosition);
  26. bool handleSwipeStateChange(bool btnPressed);
  27. bool swipeEnabled() const;
  28. public:
  29. MapViewActions(MapView & owner, const std::shared_ptr<MapViewModel> & model);
  30. void setContext(const std::shared_ptr<IMapRendererContext> & context);
  31. void clickLeft(tribool down, bool previousState) override;
  32. void clickRight(tribool down, bool previousState) override;
  33. void clickMiddle(tribool down, bool previousState) override;
  34. void hover(bool on) override;
  35. void mouseMoved(const Point & cursorPosition) override;
  36. };