StateView.hpp
1 #pragma once
2 #include <Scenario/Document/Event/ExecutionStatus.hpp>
3 #include <Scenario/Document/ScenarioDocument/ScenarioDocumentViewConstants.hpp>
4 
5 #include <score/model/ColorInterpolator.hpp>
6 
7 #include <QGraphicsItem>
8 #include <QRect>
9 
10 #include <score_plugin_scenario_export.h>
11 
12 #include <verdigris>
13 
14 class QGraphicsSceneDragDropEvent;
15 class QGraphicsSceneMouseEvent;
16 class QMimeData;
17 class QPainter;
18 class QStyleOptionGraphicsItem;
19 class QWidget;
20 
21 namespace Scenario
22 {
23 struct StateOverlays;
24 class StatePresenter;
25 
26 class SCORE_PLUGIN_SCENARIO_EXPORT StateView final
27  : public QObject
28  , public QGraphicsItem
29 {
30  W_OBJECT(StateView)
31  Q_INTERFACES(QGraphicsItem)
32 public:
33  static const constexpr qreal fullRadius = 6.;
34  static const constexpr qreal pointRadius = 3.5;
35  static const constexpr qreal notDilated = 1.;
36  static const constexpr qreal dilated = 1.5;
37 
38  StateView(StatePresenter& presenter, QGraphicsItem* parent = nullptr);
39  virtual ~StateView();
40 
41  static const constexpr int Type = ItemType::State;
42  int type() const final override { return Type; }
43 
44  StatePresenter& presenter() const { return m_presenter; }
45 
46  QRectF boundingRect() const override;
47 
48  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
49  override;
50 
51  void setContainMessage(bool);
52  void setContainProcess(bool);
53  void setSelected(bool arg);
54  void setStatus(ExecutionStatus);
55  void disableOverlay();
56 
57 public:
58  void dropReceived(const QMimeData& arg_1)
59  E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, dropReceived, arg_1)
60  void startCreateMode() E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, startCreateMode)
61  void startCreateGraphalMode()
62  E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, startCreateGraphalMode)
63  void startCreateSequence() E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, startCreateSequence)
64 
65 protected:
66  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
67  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
68  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
69  void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
70  void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
71  void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
72  void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) override;
73  void dropEvent(QGraphicsSceneDragDropEvent* event) override;
74 
75 private:
76  void setDilatation(bool);
77  void updateOverlay();
78  StatePresenter& m_presenter;
79  StateOverlays* m_overlays{};
80  ExecutionStatusProperty m_status{};
81  score::ColorBang m_execPing;
82 
83  bool m_dilated : 1;
84  bool m_containMessage : 1;
85  bool m_containProcess : 1;
86  bool m_selected : 1;
87  bool m_hovered : 1;
88  bool m_hasOverlay : 1;
89  bool m_moving : 1;
90 };
91 }
Definition: StatePresenter.hpp:23
Definition: StateView.hpp:29
Definition: ColorInterpolator.hpp:9
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ExecutionStatus.hpp:33
Definition: StateMenuOverlay.hpp:211