2 #include "CurvePaletteBaseEvents.hpp"
3 #include "CurvePaletteBaseStates.hpp"
5 #include <Curve/Point/CurvePointModel.hpp>
6 #include <Curve/Point/CurvePointView.hpp>
7 #include <Curve/Segment/CurveSegmentModel.hpp>
8 #include <Curve/Segment/CurveSegmentView.hpp>
17 template <
typename Event>
24 template <
typename Element_T,
typename Modifier_T>
33 void onTransition(QEvent* ev)
override
35 auto qev = safe_cast<CurveEvent<Element_T, Modifier_T>*>(ev);
36 this->state().currentPoint = qev->point;
45 auto& model = safe_cast<const PointView*>(ev->item)->model();
46 this->state().clickedPointId = {model.previous(), model.following()};
50 this->state().clickedSegmentId
51 = safe_cast<const SegmentView*>(ev->item)->model().id();
57 auto& model = safe_cast<const PointView*>(ev->item)->model();
58 this->state().hoveredPointId = {model.previous(), model.following()};
62 this->state().hoveredSegmentId
63 = safe_cast<const SegmentView*>(ev->item)->model().id();
69 auto& model = safe_cast<const PointView*>(ev->item)->model();
70 this->state().hoveredPointId = {model.previous(), model.following()};
74 this->state().hoveredSegmentId
75 = safe_cast<const SegmentView*>(ev->item)->model().id();
106 bool eventTest(QEvent* e)
override
109 static const constexpr QEvent::Type types[]
110 = {QEvent::Type(QEvent::User + ClickOnNothing_Event::user_type),
111 QEvent::Type(QEvent::User + ClickOnPoint_Event::user_type),
112 QEvent::Type(QEvent::User + ClickOnSegment_Event::user_type)};
114 return find(begin(types), end(types), e->type()) != end(types);
117 void onTransition(QEvent* e)
override
119 auto qev = safe_cast<score::PositionedEvent<Curve::Point>*>(e);
121 this->state().currentPoint = qev->point;
131 bool eventTest(QEvent* e)
override
134 static const constexpr QEvent::Type types[]
135 = {QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
136 QEvent::Type(QEvent::User + MoveOnPoint_Event::user_type),
137 QEvent::Type(QEvent::User + MoveOnSegment_Event::user_type)};
139 return find(begin(types), end(types), e->type()) != end(types);
142 void onTransition(QEvent* e)
override
144 auto qev = safe_cast<score::PositionedEvent<Curve::Point>*>(e);
146 this->state().currentPoint = qev->point;
153 bool eventTest(QEvent* e)
override
156 static const constexpr QEvent::Type types[]
157 = {QEvent::Type(QEvent::User + ReleaseOnNothing_Event::user_type),
158 QEvent::Type(QEvent::User + ReleaseOnPoint_Event::user_type),
159 QEvent::Type(QEvent::User + ReleaseOnSegment_Event::user_type)};
161 return find(begin(types), end(types), e->type()) != end(types);
164 void onTransition(QEvent* e)
override { }
Definition: CurvePaletteBaseTransitions.hpp:101
Definition: CurvePaletteBaseTransitions.hpp:19
Definition: CurvePaletteBaseTransitions.hpp:126
Definition: CurvePaletteBaseTransitions.hpp:27
Definition: CurvePaletteBaseTransitions.hpp:151
Definition: StateMachineUtils.hpp:76
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: CurvePaletteBaseEvents.hpp:29