annotate include/gui/widgets/text.h @ 211:7cf53145de11

strings: use templates for ToInt, std::to_string -> Strings::ToUtf8String
author Paper <mrpapersonic@gmail.com>
date Sun, 07 Jan 2024 09:54:17 -0500
parents 8043152ef9d4
children b3549da699a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #ifndef __gui__ui_utils_h
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #define __gui__ui_utils_h
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
3
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
4 #include <QLineEdit>
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
5 #include <QPlainTextEdit>
69
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
6 #include <QSize>
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
7 #include <QString>
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
8 #include <QWidget>
69
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
9
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
10 class QFrame;
27a19dd6cba1 *: fix up some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
11 class QLabel;
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
12
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 namespace TextWidgets {
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 class Header : public QWidget {
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 Q_OBJECT
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
19 Header(const QString& title, QWidget* parent = nullptr);
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
20 void SetText(const QString& title);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 private:
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 QLabel* static_text_title;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 QFrame* static_text_line;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 class Paragraph : public QPlainTextEdit {
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 Q_OBJECT
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
31 Paragraph(const QString& text, QWidget* parent = nullptr);
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
32 void SetText(const QString& text);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 QSize minimumSizeHint() const override;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 QSize sizeHint() const override;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
37 class Line : public QLineEdit {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 Q_OBJECT
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
41 Line(QWidget* parent = nullptr);
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
42 Line(const QString& text, QWidget* parent = nullptr);
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
43 void SetText(const QString& text);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
44 };
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
45
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
46 class Title final : public Line {
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
47 Q_OBJECT
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
48
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
49 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
50 Title(const QString& title, QWidget* parent = nullptr);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
51 };
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
52
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
53 class Section final : public QWidget {
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
54 Q_OBJECT
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
55
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
56 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
57 Section(const QString& title, const QString& data, QWidget* parent = nullptr);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58 Header* GetHeader();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59 Paragraph* GetParagraph();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 private:
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 Header* header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 Paragraph* paragraph;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
66 class LabelledSection final : public QWidget {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 Q_OBJECT
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
70 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
71 Header* GetHeader();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72 Paragraph* GetLabels();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73 Paragraph* GetParagraph();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 private:
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76 Header* header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77 Paragraph* labels;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78 Paragraph* paragraph;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 };
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
81 class SelectableSection final : public QWidget {
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 Q_OBJECT
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
85 SelectableSection(const QString& title, const QString& data, QWidget* parent = nullptr);
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 Header* GetHeader();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87 Paragraph* GetParagraph();
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89 private:
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 Header* header;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91 Paragraph* paragraph;
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 };
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
93
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 83
diff changeset
94 class OneLineSection final : public QWidget {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
95 Q_OBJECT
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
96
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
97 public:
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 76
diff changeset
98 OneLineSection(const QString& title, const QString& data, QWidget* parent = nullptr);
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
99 Header* GetHeader();
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
100 Line* GetLine();
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
101
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
102 private:
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
103 Header* header;
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 69
diff changeset
104 Line* line;
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
105 };
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
106
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
107 } // namespace TextWidgets
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
108
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 #endif // __gui__ui_utils_h