TemporalIntervalHeader.hpp
1 #pragma once
2 #include <Scenario/Document/Interval/IntervalHeader.hpp>
3 
4 #include <score/graphics/GraphicWidgets.hpp>
5 #include <score/graphics/ItemBounder.hpp>
6 #include <score/widgets/MimeData.hpp>
7 
8 #include <ossia/detail/optional.hpp>
9 
10 #include <QRect>
11 #include <qnamespace.h>
12 
13 #include <verdigris>
14 
15 class QGraphicsSceneMouseEvent;
16 class QPainter;
17 class QStyleOptionGraphicsItem;
18 class QWidget;
19 
20 namespace Scenario
21 {
22 class TemporalIntervalPresenter;
23 
25 {
26  W_OBJECT(TemporalIntervalHeader)
27 public:
29 
30  QRectF boundingRect() const override;
31  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
32  override;
33  void updateButtons();
34  void updateOverlay();
35  void setSelected(bool b);
36  void setExecuting(bool b);
37  void setLabel(const QString& label);
38 
39 public:
40  void doubleClicked() W_SIGNAL(doubleClicked);
41 
42  void intervalHoverEnter() W_SIGNAL(intervalHoverEnter);
43  void intervalHoverLeave() W_SIGNAL(intervalHoverLeave);
44  void dropReceived(const QPointF& pos, const QMimeData& arg_2)
45  W_SIGNAL(dropReceived, pos, arg_2);
46 
47 protected:
48  void hoverEnterEvent(QGraphicsSceneHoverEvent* h) override;
49  void hoverLeaveEvent(QGraphicsSceneHoverEvent* h) override;
50  void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
51  void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) override;
52  void dropEvent(QGraphicsSceneDragDropEvent* event) override;
53 
54  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
55 
56 private:
57  void updateShape() noexcept;
58  void setState(IntervalHeader::State s) override;
59  void on_textChanged() override;
60  bool contains(const QPointF& point) const override;
61  QPainterPath shape() const override;
62 
63  score::ItemBounder m_bounder{};
64 
65  QRectF m_textRectCache;
66  QPixmap m_line;
67  QPolygonF m_poly;
68 
73  score::QGraphicsSlider* m_speed{};
74  TemporalIntervalPresenter& m_presenter;
75 
76  bool m_selected : 1;
77  bool m_hovered : 1;
78  bool m_overlay : 1;
79  bool m_executing : 1;
80 };
81 }
Definition: IntervalHeader.hpp:14
Definition: TemporalIntervalHeader.hpp:25
void updateOverlay()
Definition: TemporalIntervalHeader.cpp:149
Definition: TemporalIntervalPresenter.hpp:25
Definition: ItemBounder.hpp:10
Definition: QGraphicsPixmapButton.hpp:17
Definition: QGraphicsPixmapToggle.hpp:18
Definition: QGraphicsSelectablePixmapToggle.hpp:20
Definition: QGraphicsSlider.hpp:17
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14