2 #include <Curve/Palette/CurvePaletteBaseTransitions.hpp>
3 #include <Curve/Palette/CurvePoint.hpp>
5 #include <score/statemachine/StateMachineTools.hpp>
6 #include <score/statemachine/StateMachineUtils.hpp>
16 template <
typename CommandObject>
20 using namespace Curve;
22 obj.setCurveState(
this);
24 auto mainState =
new QState{
this};
25 auto finalState =
new QFinalState{
this};
27 setInitialState(mainState);
29 auto pressed =
new QState{mainState};
30 pressed->setObjectName(
"Pressed");
31 auto moving =
new QState{mainState};
32 moving->setObjectName(
"Moving");
33 auto released =
new QFinalState{mainState};
34 released->setObjectName(
"Released");
37 mainState->setInitialState(pressed);
40 score::make_transition<MoveOnAnything_Transition>(pressed, moving, *
this);
41 score::make_transition<ReleaseOnAnything_Transition>(pressed, released);
43 score::make_transition<MoveOnAnything_Transition>(moving, moving, *
this);
44 score::make_transition<ReleaseOnAnything_Transition>(moving, released);
46 connect(pressed, &QAbstractState::entered,
this, [&]() { obj.press(); });
47 connect(moving, &QAbstractState::entered,
this, [&]() { obj.move(); });
48 connect(released, &QAbstractState::entered,
this, [&]() { obj.release(); });
51 mainState->addTransition(mainState, finishedState(), finalState);
53 auto cancelled =
new QState{
this};
54 score::make_transition<score::Cancel_Transition>(mainState, cancelled);
55 cancelled->addTransition(finalState);
57 connect(cancelled, &QAbstractState::entered,
this, [&]() { obj.cancel(); });
Definition: OngoingState.hpp:14
Definition: CurvePaletteBaseStates.hpp:20
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12