TriggerView.hpp
1 #pragma once
2 #include <Scenario/Document/ScenarioDocument/ScenarioDocumentViewConstants.hpp>
3 
4 #include <score/widgets/MimeData.hpp>
5 
6 #include <QGraphicsItem>
7 #include <QMimeData>
8 
9 #include <score_plugin_scenario_export.h>
10 
11 #include <verdigris>
12 class QGraphicsSceneMouseEvent;
13 class QPainter;
14 class QStyleOptionGraphicsItem;
15 class QWidget;
16 namespace Scenario
17 {
18 class SCORE_PLUGIN_SCENARIO_EXPORT TriggerView final
19  : public QObject
20  , public QGraphicsItem
21 {
22  W_OBJECT(TriggerView)
23  Q_INTERFACES(QGraphicsItem)
24 
25 public:
26  TriggerView(QGraphicsItem* parent);
27  static const constexpr int Type = ItemType::Trigger;
28  int type() const final override { return Type; }
29 
30  void setSelected(bool b) noexcept;
31  void onWaitStart();
32  void onWaitEnd();
33  void nextFrame();
34 
35 public:
36  void pressed(QPointF arg_1) W_SIGNAL(pressed, arg_1);
37 
38  void dropReceived(const QPointF& pos, const QMimeData& arg_2)
39  W_SIGNAL(dropReceived, pos, arg_2);
40 
41  QRectF boundingRect() const override;
42 
43 private:
44  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
45  override;
46  bool contains(const QPointF& point) const override;
47 
48  void dropEvent(QGraphicsSceneDragDropEvent* event) override;
49  void mousePressEvent(QGraphicsSceneMouseEvent*) override;
50  void mouseMoveEvent(QGraphicsSceneMouseEvent*) override;
51  void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
52 
53  void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
54  void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
55 
56  const QPixmap& currentPixmap() const noexcept;
57 
58  int m_currentFrame{};
59  int m_frameDirection{};
60 
61  bool m_selected : 1;
62  bool m_hovered : 1;
63  bool m_waiting : 1;
64 };
65 }
Definition: TriggerView.hpp:21
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14