Loading...
Searching...
No Matches
EventTransitions.hpp
1#pragma once
2#include <Scenario/Palette/ScenarioPaletteBaseTransitions.hpp>
3#include <Scenario/Process/ScenarioInterface.hpp>
4namespace Scenario
5{
6template <typename Scenario_T>
7class Transition_T<Scenario_T, ClickOnEvent> final
8 : public MatchedTransition<Scenario_T, ClickOnEvent_Event>
9{
10public:
11 using MatchedTransition<Scenario_T, ClickOnEvent_Event>::MatchedTransition;
12
13protected:
14 void onTransition(QEvent* ev) override
15 {
16 auto qev = static_cast<ClickOnEvent_Event*>(ev);
17 this->state().clear();
18
19 this->state().clickedEvent = qev->id;
20 this->state().currentPoint = qev->point;
21 }
22};
23
24template <typename Scenario_T>
26 : public MatchedTransition<Scenario_T, ClickOnEvent_Event>
27{
28public:
29 using MatchedTransition<Scenario_T, ClickOnEvent_Event>::MatchedTransition;
30
31protected:
32 bool eventTest(QEvent* e) override
33 {
34 if(e->type() == QEvent::Type(QEvent::User + ClickOnEvent_Event::user_type))
35 {
36 auto qev = static_cast<ClickOnEvent_Event*>(e);
37 return qev->id == Scenario::endId<EventModel>();
38 }
39 return false;
40 }
41
42 void onTransition(QEvent* ev) override
43 {
44 auto qev = static_cast<ClickOnEvent_Event*>(ev);
45 this->state().clear();
46
47 this->state().clickedEvent = qev->id;
48 this->state().currentPoint = qev->point;
49 }
50};
51
52template <typename Scenario_T>
54
55template <typename Scenario_T>
56class Transition_T<Scenario_T, MoveOnEvent> final
57 : public MatchedTransition<Scenario_T, MoveOnEvent_Event>
58{
59public:
60 using MatchedTransition<Scenario_T, MoveOnEvent_Event>::MatchedTransition;
61
62protected:
63 void onTransition(QEvent* ev) override
64 {
65 auto qev = static_cast<MoveOnEvent_Event*>(ev);
66
67 this->state().hoveredEvent = qev->id;
68 this->state().currentPoint = qev->point;
69 }
70};
71template <typename Scenario_T>
73
74template <typename Scenario_T>
75class Transition_T<Scenario_T, ReleaseOnEvent> final
76 : public MatchedTransition<Scenario_T, ReleaseOnEvent_Event>
77{
78public:
79 using MatchedTransition<Scenario_T, ReleaseOnEvent_Event>::MatchedTransition;
80
81protected:
82 void onTransition(QEvent* ev) override
83 {
84 auto qev = static_cast<ReleaseOnEvent_Event*>(ev);
85
86 this->state().hoveredEvent = qev->id;
87 this->state().currentPoint = qev->point;
88 }
89};
90template <typename Scenario_T>
92}
Definition EventTransitions.hpp:27
Definition ScenarioPaletteBaseTransitions.hpp:15
Definition EventTransitions.hpp:58
Definition ScenarioPaletteBaseTransitions.hpp:23
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition ScenarioPaletteBaseEvents.hpp:53