Mercurial > minori
annotate include/gui/widgets/text.h @ 260:dd211ff68b36
pages/seasons: add initial functionality
the menu doesn't work yet, but it's a good start
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 03 Apr 2024 19:48:38 -0400 |
parents | 862d0d8619f6 |
children | 3ec7804abf17 |
rev | line source |
---|---|
46 | 1 #ifndef __gui__ui_utils_h |
2 #define __gui__ui_utils_h | |
64 | 3 |
76 | 4 #include <QLineEdit> |
5 #include <QPlainTextEdit> | |
69 | 6 #include <QSize> |
76 | 7 #include <QString> |
8 #include <QWidget> | |
69 | 9 |
10 class QFrame; | |
253 | 11 |
12 #include <QLabel> | |
64 | 13 |
46 | 14 namespace TextWidgets { |
15 | |
16 class Header : public QWidget { | |
258 | 17 Q_OBJECT |
46 | 18 |
258 | 19 public: |
20 Header(const QString& title, QWidget* parent = nullptr); | |
21 void SetText(const QString& title); | |
46 | 22 |
258 | 23 private: |
24 QLabel* static_text_title; | |
25 QFrame* static_text_line; | |
46 | 26 }; |
27 | |
253 | 28 class Paragraph : public QLabel { |
29 Q_OBJECT | |
46 | 30 |
253 | 31 public: |
32 Paragraph(const QString& text, QWidget* parent = nullptr); | |
33 void SetText(const QString& text); | |
46 | 34 }; |
35 | |
253 | 36 class LabelledParagraph final : public QWidget { |
37 Q_OBJECT | |
38 | |
39 public: | |
40 LabelledParagraph(const QString& label, const QString& data, QWidget* parent = nullptr); | |
41 Paragraph* GetLabels(); | |
42 Paragraph* GetParagraph(); | |
46 | 43 |
253 | 44 private: |
45 Paragraph* labels; | |
46 Paragraph* paragraph; | |
47 }; | |
48 | |
49 class Line : public Paragraph { | |
50 Q_OBJECT | |
51 | |
52 public: | |
53 Line(QWidget* parent = nullptr); | |
54 Line(const QString& text, QWidget* parent = nullptr); | |
55 void SetText(const QString& text); | |
75 | 56 }; |
57 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
58 class Title final : public Line { |
258 | 59 Q_OBJECT |
75 | 60 |
258 | 61 public: |
62 Title(const QString& title, QWidget* parent = nullptr); | |
75 | 63 }; |
64 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
65 class Section final : public QWidget { |
258 | 66 Q_OBJECT |
75 | 67 |
258 | 68 public: |
69 Section(const QString& title, const QString& data, QWidget* parent = nullptr); | |
70 Header* GetHeader(); | |
71 Paragraph* GetParagraph(); | |
46 | 72 |
258 | 73 private: |
74 Header* header; | |
75 Paragraph* paragraph; | |
46 | 76 }; |
77 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
78 class LabelledSection final : public QWidget { |
258 | 79 Q_OBJECT |
46 | 80 |
258 | 81 public: |
82 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr); | |
83 Header* GetHeader(); | |
84 Paragraph* GetLabels(); | |
85 Paragraph* GetParagraph(); | |
46 | 86 |
258 | 87 private: |
88 Header* header; | |
89 LabelledParagraph* content; | |
46 | 90 }; |
91 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
92 class SelectableSection final : public QWidget { |
258 | 93 Q_OBJECT |
46 | 94 |
258 | 95 public: |
96 SelectableSection(const QString& title, const QString& data, QWidget* parent = nullptr); | |
97 Header* GetHeader(); | |
98 Paragraph* GetParagraph(); | |
46 | 99 |
258 | 100 private: |
101 Header* header; | |
102 Paragraph* paragraph; | |
46 | 103 }; |
64 | 104 |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
105 class OneLineSection final : public QWidget { |
258 | 106 Q_OBJECT |
64 | 107 |
258 | 108 public: |
109 OneLineSection(const QString& title, const QString& data, QWidget* parent = nullptr); | |
110 Header* GetHeader(); | |
111 Line* GetLine(); | |
75 | 112 |
258 | 113 private: |
114 Header* header; | |
115 Line* line; | |
64 | 116 }; |
117 | |
118 } // namespace TextWidgets | |
119 | |
46 | 120 #endif // __gui__ui_utils_h |