Loading...
Searching...
No Matches
StateTransitions.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, ClickOnState> final
8 : public MatchedTransition<Scenario_T, ClickOnState_Event>
9{
10public:
11 using MatchedTransition<Scenario_T, ClickOnState_Event>::MatchedTransition;
12
13protected:
14 void onTransition(QEvent* ev) override
15 {
16 auto qev = static_cast<ClickOnState_Event*>(ev);
17 this->state().clear();
18
19 this->state().clickedState = qev->id;
20 this->state().currentPoint = qev->point;
21 }
22};
23
24template <typename Scenario_T>
26
27template <typename Scenario_T>
29 : public MatchedTransition<Scenario_T, ClickOnState_Event>
30{
31public:
32 using MatchedTransition<Scenario_T, ClickOnState_Event>::MatchedTransition;
33
34protected:
35 bool eventTest(QEvent* e) override
36 {
37 if(e->type() == QEvent::Type(QEvent::User + ClickOnState_Event::user_type))
38 {
39 auto qev = static_cast<ClickOnState_Event*>(e);
40 return qev->id == Scenario::endId<StateModel>();
41 }
42 return false;
43 }
44
45 void onTransition(QEvent* ev) override
46 {
47 auto qev = static_cast<ClickOnState_Event*>(ev);
48 this->state().clear();
49
50 this->state().clickedState = qev->id;
51 this->state().currentPoint = qev->point;
52 }
53};
54
55template <typename Scenario_T>
56class Transition_T<Scenario_T, MoveOnState> final
57 : public MatchedTransition<Scenario_T, MoveOnState_Event>
58{
59public:
60 using MatchedTransition<Scenario_T, MoveOnState_Event>::MatchedTransition;
61
62protected:
63 void onTransition(QEvent* ev) override
64 {
65 auto qev = static_cast<MoveOnState_Event*>(ev);
66
67 this->state().hoveredState = qev->id;
68 this->state().currentPoint = qev->point;
69 }
70};
71
72template <typename Scenario_T>
74
75template <typename Scenario_T>
76class Transition_T<Scenario_T, ReleaseOnState> final
77 : public MatchedTransition<Scenario_T, ReleaseOnState_Event>
78{
79public:
80 using MatchedTransition<Scenario_T, ReleaseOnState_Event>::MatchedTransition;
81
82protected:
83 void onTransition(QEvent* ev) override
84 {
85 auto qev = static_cast<ReleaseOnState_Event*>(ev);
86
87 this->state().hoveredState = qev->id;
88 this->state().currentPoint = qev->point;
89 }
90};
91
92template <typename Scenario_T>
94}
Definition StateTransitions.hpp:30
Definition ScenarioPaletteBaseTransitions.hpp:15
Definition StateTransitions.hpp:58
Definition ScenarioPaletteBaseTransitions.hpp:23
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition ScenarioPaletteBaseEvents.hpp:53