ShishGL  1.0
A simple modular cross-platform graphics library
Draggable.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_UI_DRAGGABLE_HPP
3 #define SHISHGL_UI_DRAGGABLE_HPP
4 /*============================================================================*/
5 #include "Clickable.hpp"
6 #include "Vector2.hpp"
7 /*============================================================================*/
8 namespace Sh {
9 
10  class Draggable : public Holdable {
11  public:
12 
13  explicit Draggable(UIWindow* target);
14 
15  [[nodiscard]]
16  const Vector2<double>& dragPoint() const;
17 
18  bool onMouseButton(MouseButtonEvent& event) override;
19 
20  bool onMouseMove(MouseEvent& event) override;
21 
22  virtual void onDrag(const Vector2<double>&) {}
23 
24  protected:
25 
26  void drag(const Vector2<double>& delta);
27 
29  };
30 
31 }
32 /*============================================================================*/
33 #endif //SHISHGL_UI_DRAGGABLE_HPP
34 /*============================================================================*/
Sh::Draggable::onMouseMove
bool onMouseMove(MouseEvent &event) override
Definition: Draggable.cpp:32
Sh::MouseEvent
Definition: MouseEvent.hpp:12
Sh::Draggable::onMouseButton
bool onMouseButton(MouseButtonEvent &event) override
Definition: Draggable.cpp:18
Vector2.hpp
Sh::Draggable::Draggable
Draggable(UIWindow *target)
Definition: Draggable.cpp:7
Sh::Draggable
Definition: Draggable.hpp:10
Sh::Draggable::dragPoint
const Vector2< double > & dragPoint() const
Definition: Draggable.cpp:12
Sh::Vector2< double >
Sh::Behavior::target
SomeWindow * target() const
Definition: Behavior.hpp:17
Sh::UIWindow
Definition: UIWindow.hpp:16
Sh::Draggable::drag_point
Vector2< double > drag_point
Definition: Draggable.hpp:28
Sh::Draggable::drag
void drag(const Vector2< double > &delta)
Definition: Draggable.cpp:43
Clickable.hpp
Sh
Definition: CoreApplication.hpp:10
Sh::Holdable
Definition: Clickable.hpp:26
Sh::Draggable::onDrag
virtual void onDrag(const Vector2< double > &)
Definition: Draggable.hpp:22
Sh::MouseButtonEvent
Definition: MouseEvent.hpp:38