TimeSyncTransitions.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, ClickOnTimeSync> final
8  : public MatchedTransition<Scenario_T, ClickOnTimeSync_Event>
9 {
10 public:
12 
13 protected:
14  void onTransition(QEvent* ev) override
15  {
16  auto qev = static_cast<ClickOnTimeSync_Event*>(ev);
17  this->state().clear();
18 
19  this->state().clickedTimeSync = qev->id;
20  this->state().currentPoint = qev->point;
21  }
22 };
23 template <typename Scenario_T>
25 
26 template <typename Scenario_T>
28  : public MatchedTransition<Scenario_T, ClickOnTimeSync_Event>
29 {
30 public:
32 
33 protected:
34  bool eventTest(QEvent* e) override
35  {
36  if(e->type() == QEvent::Type(QEvent::User + ClickOnTimeSync_Event::user_type))
37  {
38  auto qev = static_cast<ClickOnTimeSync_Event*>(e);
39  return qev->id == Scenario::endId<TimeSyncModel>();
40  }
41  return false;
42  }
43 
44  void onTransition(QEvent* ev) override
45  {
46  auto qev = static_cast<ClickOnTimeSync_Event*>(ev);
47  this->state().clear();
48 
49  this->state().clickedTimeSync = qev->id;
50  this->state().currentPoint = qev->point;
51  }
52 };
53 
54 template <typename Scenario_T>
55 class Transition_T<Scenario_T, MoveOnTimeSync> final
56  : public MatchedTransition<Scenario_T, MoveOnTimeSync_Event>
57 {
58 public:
60 
61 protected:
62  void onTransition(QEvent* ev) override
63  {
64  auto qev = static_cast<MoveOnTimeSync_Event*>(ev);
65 
66  this->state().hoveredTimeSync = qev->id;
67  this->state().currentPoint = qev->point;
68  }
69 };
70 template <typename Scenario_T>
72 
73 template <typename Scenario_T>
74 class Transition_T<Scenario_T, ReleaseOnTimeSync> final
75  : public MatchedTransition<Scenario_T, ReleaseOnTimeSync_Event>
76 {
77 public:
79 
80 protected:
81  void onTransition(QEvent* ev) override
82  {
83  auto qev = static_cast<ReleaseOnTimeSync_Event*>(ev);
84 
85  this->state().hoveredTimeSync = qev->id;
86  this->state().currentPoint = qev->point;
87  }
88 };
89 template <typename Scenario_T>
91 }
Definition: TimeSyncTransitions.hpp:29
Definition: ScenarioPaletteBaseTransitions.hpp:15
Definition: TimeSyncTransitions.hpp:9
Definition: TimeSyncTransitions.hpp:57
Definition: TimeSyncTransitions.hpp:76
Definition: ScenarioPaletteBaseTransitions.hpp:23
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ScenarioPaletteBaseEvents.hpp:53