score
Home
Classes
Namespaces
Files
HeaderDelegate.hpp
1
#pragma once
2
#include <Process/LayerPresenter.hpp>
3
#include <Process/Style/ScenarioStyle.hpp>
4
5
#include <ossia/detail/small_vector.hpp>
6
7
namespace
Dataflow
8
{
9
class
PortItem;
10
}
11
namespace
Process
12
{
13
class
SCORE_LIB_PROCESS_EXPORT
HeaderDelegate
14
:
public
QObject
15
,
public
Process::GraphicsShapeItem
16
{
17
public
:
18
HeaderDelegate
(
const
Process::ProcessModel
& m,
const
Process::Context
& doc)
19
: m_model{m}
20
, m_context{doc}
21
{
22
}
23
24
~
HeaderDelegate
()
override
;
25
26
virtual
void
updateText() = 0;
27
28
const
Process::ProcessModel
& m_model;
29
const
Process::Context
& m_context;
30
};
31
32
class
SCORE_LIB_PROCESS_EXPORT
DefaultHeaderDelegate
:
public
Process::HeaderDelegate
33
{
34
public
:
35
DefaultHeaderDelegate
(
const
Process::ProcessModel
& m,
const
Process::Context
& doc);
36
~
DefaultHeaderDelegate
()
override
;
37
38
void
updateText()
override
;
39
const
QPen&
40
textPen(
Process::Style
&,
const
Process::ProcessModel
& model)
const
noexcept;
41
42
void
updateBench(
double
d);
43
void
setSize(QSizeF sz)
final
override
;
44
void
on_zoomRatioChanged(ZoomRatio)
final
override
{ updateText(); }
45
46
protected
:
47
void
updatePorts();
48
void
paint(QPainter* painter,
const
QStyleOptionGraphicsItem* option, QWidget* widget)
49
override
;
50
51
QPixmap m_line, m_bench;
52
QGraphicsItem* m_ui{};
53
QGraphicsItem* m_record{};
54
QGraphicsItem* m_snapshot{};
55
ossia::small_vector<Dataflow::PortItem*, 3> m_inPorts;
56
double
m_portStartX{};
57
double
m_portEndX{};
58
bool
m_sel{};
59
60
QString m_lastText;
61
const
QPen* m_lastPen{};
62
};
63
64
class
SCORE_LIB_PROCESS_EXPORT
FooterDelegate
65
:
public
QObject
66
,
public
QGraphicsItem
67
{
68
public
:
69
FooterDelegate
(
const
Process::ProcessModel
& m,
const
Process::Context
& doc);
70
71
~
FooterDelegate
()
override
;
72
73
virtual
void
setSize(QSizeF sz) = 0;
74
QRectF boundingRect()
const
final
override
;
75
76
protected
:
77
const
Process::ProcessModel
& m_model;
78
const
Process::Context
& m_context;
79
QSizeF m_size{};
80
81
void
mousePressEvent(QGraphicsSceneMouseEvent* event)
override
;
82
void
mouseMoveEvent(QGraphicsSceneMouseEvent* event)
override
;
83
void
mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
override
;
84
85
int
type()
const override
;
86
};
87
88
class
SCORE_LIB_PROCESS_EXPORT
DefaultFooterDelegate
:
public
Process::FooterDelegate
89
{
90
public
:
91
DefaultFooterDelegate
(
const
Process::ProcessModel
& m,
const
Process::Context
& doc);
92
~
DefaultFooterDelegate
()
override
;
93
94
void
setSize(QSizeF sz)
final
override
;
95
96
protected
:
97
void
updatePorts();
98
void
paint(QPainter* painter,
const
QStyleOptionGraphicsItem* option, QWidget* widget)
99
override
;
100
101
ossia::small_vector<Dataflow::PortItem*, 3> m_outPorts;
102
double
m_portEndX{};
103
};
104
105
SCORE_LIB_PROCESS_EXPORT
106
QPixmap makeGlyphs(
const
QString& glyph,
const
QPen& pen);
107
}
Process::DefaultFooterDelegate
Definition:
HeaderDelegate.hpp:89
Process::DefaultHeaderDelegate
Definition:
HeaderDelegate.hpp:33
Process::FooterDelegate
Definition:
HeaderDelegate.hpp:67
Process::GraphicsShapeItem
Definition:
LayerPresenter.hpp:21
Process::HeaderDelegate
Definition:
HeaderDelegate.hpp:16
Process::ProcessModel
The Process class.
Definition:
score-lib-process/Process/Process.hpp:61
Process
Base classes and tools to implement processes and layers.
Definition:
JSONVisitor.hpp:1324
Process::Context
Definition:
ProcessContext.hpp:12
Process::Style
Definition:
ScenarioStyle.hpp:13