StateTransitions.hpp
1 #pragma once
2 #include <Scenario/Palette/ScenarioPaletteBaseTransitions.hpp>
3 #include <Scenario/Process/ScenarioInterface.hpp>
4 namespace Scenario
5 {
6 template <typename Scenario_T>
7 class Transition_T<Scenario_T, ClickOnState> final
8  : public MatchedTransition<Scenario_T, ClickOnState_Event>
9 {
10 public:
12 
13 protected:
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 
24 template <typename Scenario_T>
26 
27 template <typename Scenario_T>
29  : public MatchedTransition<Scenario_T, ClickOnState_Event>
30 {
31 public:
33 
34 protected:
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 
55 template <typename Scenario_T>
56 class Transition_T<Scenario_T, MoveOnState> final
57  : public MatchedTransition<Scenario_T, MoveOnState_Event>
58 {
59 public:
61 
62 protected:
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 
72 template <typename Scenario_T>
74 
75 template <typename Scenario_T>
76 class Transition_T<Scenario_T, ReleaseOnState> final
77  : public MatchedTransition<Scenario_T, ReleaseOnState_Event>
78 {
79 public:
81 
82 protected:
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 
92 template <typename Scenario_T>
94 }
Definition: StateTransitions.hpp:30
Definition: ScenarioPaletteBaseTransitions.hpp:15
Definition: StateTransitions.hpp:9
Definition: StateTransitions.hpp:58
Definition: StateTransitions.hpp:78
Definition: ScenarioPaletteBaseTransitions.hpp:23
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ScenarioPaletteBaseEvents.hpp:53