EventTransitions.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, ClickOnEvent> final
8  : public MatchedTransition<Scenario_T, ClickOnEvent_Event>
9 {
10 public:
12 
13 protected:
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 
24 template <typename Scenario_T>
26  : public MatchedTransition<Scenario_T, ClickOnEvent_Event>
27 {
28 public:
30 
31 protected:
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 
52 template <typename Scenario_T>
54 
55 template <typename Scenario_T>
56 class Transition_T<Scenario_T, MoveOnEvent> final
57  : public MatchedTransition<Scenario_T, MoveOnEvent_Event>
58 {
59 public:
61 
62 protected:
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 };
71 template <typename Scenario_T>
73 
74 template <typename Scenario_T>
75 class Transition_T<Scenario_T, ReleaseOnEvent> final
76  : public MatchedTransition<Scenario_T, ReleaseOnEvent_Event>
77 {
78 public:
80 
81 protected:
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 };
90 template <typename Scenario_T>
92 }
Definition: EventTransitions.hpp:27
Definition: ScenarioPaletteBaseTransitions.hpp:15
Definition: EventTransitions.hpp:9
Definition: EventTransitions.hpp:58
Definition: EventTransitions.hpp:77
Definition: ScenarioPaletteBaseTransitions.hpp:23
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ScenarioPaletteBaseEvents.hpp:53