Loading...
Searching...
No Matches
ScenarioPaletteBaseStates.hpp
1#pragma once
2#include <Scenario/Document/Interval/Slot.hpp>
3#include <Scenario/Palette/ScenarioPoint.hpp>
4
5#include <score/model/path/Path.hpp>
6#include <score/statemachine/StateMachineUtils.hpp>
7
8#include <QPointF>
9#include <QState>
10
11namespace Scenario
12{
13class EventModel;
14class TimeSyncModel;
15class IntervalModel;
16class StateModel;
17// OPTIMIZEME this when we have all the tools
18template <typename Scenario_T>
19class StateBase : public QState
20{
21public:
22 StateBase(const Scenario_T& scenar, QState* parent)
23 : QState{parent}
24 , m_scenario{const_cast<Scenario_T&>(scenar)}
25 {
26 }
27
28 void clear()
29 {
30 clickedEvent = std::nullopt;
31 clickedTimeSync = std::nullopt;
32 clickedInterval = std::nullopt;
33 clickedState = std::nullopt;
34
35 hoveredEvent = std::nullopt;
36 hoveredTimeSync = std::nullopt;
37 hoveredInterval = std::nullopt;
38 hoveredState = std::nullopt;
39
40 currentPoint = Scenario::Point();
41 }
42
43 OptionalId<StateModel> clickedState;
44 OptionalId<EventModel> clickedEvent;
45 OptionalId<TimeSyncModel> clickedTimeSync;
46 OptionalId<IntervalModel> clickedInterval;
47
48 OptionalId<StateModel> hoveredState;
49 OptionalId<EventModel> hoveredEvent;
50 OptionalId<TimeSyncModel> hoveredTimeSync;
51 OptionalId<IntervalModel> hoveredInterval;
52
53 Scenario::Point currentPoint{};
54
55protected:
56 Scenario_T& m_scenario;
57};
58
59class SCORE_PLUGIN_SCENARIO_EXPORT SlotState : public QState
60{
61public:
62 SlotState(QState* parent)
63 : QState{parent}
64 {
65 }
66 ~SlotState() override;
67
68 SlotPath currentSlot;
69
70 QPointF m_originalPoint;
71 double m_originalHeight{};
72};
73}
Definition ScenarioPaletteBaseStates.hpp:60
Definition ScenarioPaletteBaseStates.hpp:20
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition ScenarioPoint.hpp:13
Definition Slot.hpp:54