-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstackable.h
139 lines (88 loc) · 2.82 KB
/
stackable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef QTPRINTDOCUMENT_STACKABLE_H
#define QTPRINTDOCUMENT_STACKABLE_H
#include "base.h"
#include "document.h"
#include <QObject>
#include <QDebug>
#include <QDate>
#include <QMarginsF>
#include <QFileDialog>
namespace Qpd {
class Document;
class Stackable {
itemSize sizeContent;
itemSize sizeBoundaries;
itemSize sizeChilds;
qreal delayedWidth = 0;
protected:
QList<Stackable *> cells;
uint longestRowCells() const;
uint rowCount() const;
bool delayedCustomWidth = false;
public:
Document *root;
itemPosition pos;
Position position;
Align align;
Options options;
bool blindMode = false;
bool customWidth = false;
bool calcDone = false;
QString textData;
QRect textRect;
Type type;
QString mark;
explicit Stackable(
Document *root,
QString const &tdata = "",
Position tpos = Position::LEFT,
Options toptions = Options(),
Type ttype = Type::NONE
);
Stackable(
Document *root,
Align talign,
Options toptions = Options()
);
virtual ~Stackable() = default;
virtual void draw(bool last) = 0;
virtual void draw() = 0;
virtual void calcPosition(qreal width) = 0;
virtual void calcPosition() = 0;
bool fitH() const;
bool fitW() const;
qreal getContentWidth() const;
qreal getContentHeight() const;
qreal getBoxWidth() const;
qreal getBoxHeight() const;
qreal getBoundWidth() const;
qreal getBoundHeight() const;
qreal getWidth() const;
qreal getHeight() const;
qreal getChildsWidth() const;
qreal getChildsHeight() const;
int getMarginsVertical() const;
int getMarginsHorizontal() const;
uint getPaddingsVertical() const;
uint getPaddingsHorizontal() const;
uint getBordersVertical() const;
uint getBordersHorizontal() const;
void setBoxWidth(qreal width, bool silent = false);
void setBoxHeight(qreal height, bool silent = false);
void setBoundWidth(qreal width);
void setBoundHeight(qreal width);
void setContentWidth(qreal width);
void setContentHeight(qreal height);
void setChildsWidth(qreal width);
void setChildsHeight(qreal height);
void setBlindMode(bool bl);
void setPosition(Position tpos);
void newPage();
void setDelayedWidth(qreal width);
void updateDelayedWidth();
void resetDelayedWidth();
void forceChildRecalc();
QList<Stackable *> *getStack() { return &cells; }
};
}
#endif //QTPRINTDOCUMENT_STACKABLE_H