Mercurial > minori
annotate include/gui/widgets/text.h @ 337:a7d4e5107531
dep/animone: REFACTOR ALL THE THINGS
1: animone now has its own syntax divergent from anisthesia,
making different platforms actually have their own sections
2: process names in animone are now called `comm' (this will
probably break things). this is what its called in bsd/linux
so I'm just going to use it everywhere
3: the X11 code now checks for the existence of a UTF-8 window title
and passes it if available
4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK!
I still actually need to test the bsd code. to be honest I'm probably
going to move all of the bsds into separate files because they're
all essentially different operating systems at this point
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 12:51:15 -0400 |
parents | b82841e76e79 |
children | 6b0768158dcd |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
1 #ifndef MINORI_GUI_WIDGETS_TEXT_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
2 #define MINORI_GUI_WIDGETS_TEXT_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: |
291 | 24 QLabel static_text_title; |
25 QFrame static_text_line; | |
46 | 26 }; |
27 | |
291 | 28 class Paragraph : public QWidget { |
253 | 29 Q_OBJECT |
46 | 30 |
253 | 31 public: |
32 Paragraph(const QString& text, QWidget* parent = nullptr); | |
33 void SetText(const QString& text); | |
291 | 34 QPlainTextEdit* GetLabel(); |
35 | |
36 protected: | |
295 | 37 bool hasHeightForWidth() const override; |
38 int heightForWidth(int w) const override; | |
291 | 39 |
40 private: | |
41 QPlainTextEdit text_edit; | |
46 | 42 }; |
43 | |
253 | 44 class LabelledParagraph final : public QWidget { |
45 Q_OBJECT | |
46 | |
47 public: | |
48 LabelledParagraph(const QString& label, const QString& data, QWidget* parent = nullptr); | |
291 | 49 QLabel* GetLabels(); |
50 QLabel* GetData(); | |
51 | |
52 /* synonymous with GetData(), kept for compatibility. don't use in new code!!! */ | |
53 QLabel* GetParagraph(); | |
46 | 54 |
253 | 55 private: |
291 | 56 QLabel labels_; |
57 QLabel data_; | |
253 | 58 }; |
59 | |
291 | 60 class Line : public QWidget { |
253 | 61 Q_OBJECT |
62 | |
63 public: | |
64 Line(QWidget* parent = nullptr); | |
65 Line(const QString& text, QWidget* parent = nullptr); | |
66 void SetText(const QString& text); | |
291 | 67 |
68 protected: | |
69 QLineEdit line_edit_; | |
75 | 70 }; |
71 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
72 class Title final : public Line { |
258 | 73 Q_OBJECT |
75 | 74 |
258 | 75 public: |
76 Title(const QString& title, QWidget* parent = nullptr); | |
75 | 77 }; |
78 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
79 class Section final : public QWidget { |
258 | 80 Q_OBJECT |
75 | 81 |
258 | 82 public: |
83 Section(const QString& title, const QString& data, QWidget* parent = nullptr); | |
84 Header* GetHeader(); | |
85 Paragraph* GetParagraph(); | |
46 | 86 |
258 | 87 private: |
88 Header* header; | |
89 Paragraph* paragraph; | |
46 | 90 }; |
91 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
92 class LabelledSection final : public QWidget { |
258 | 93 Q_OBJECT |
46 | 94 |
258 | 95 public: |
96 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr); | |
97 Header* GetHeader(); | |
291 | 98 QLabel* GetLabels(); |
99 QLabel* GetData(); | |
100 QLabel* GetParagraph(); | |
46 | 101 |
258 | 102 private: |
103 Header* header; | |
104 LabelledParagraph* content; | |
46 | 105 }; |
106 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
107 class SelectableSection final : public QWidget { |
258 | 108 Q_OBJECT |
46 | 109 |
258 | 110 public: |
111 SelectableSection(const QString& title, const QString& data, QWidget* parent = nullptr); | |
112 Header* GetHeader(); | |
113 Paragraph* GetParagraph(); | |
46 | 114 |
258 | 115 private: |
116 Header* header; | |
117 Paragraph* paragraph; | |
46 | 118 }; |
64 | 119 |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
120 class OneLineSection final : public QWidget { |
258 | 121 Q_OBJECT |
64 | 122 |
258 | 123 public: |
124 OneLineSection(const QString& title, const QString& data, QWidget* parent = nullptr); | |
125 Header* GetHeader(); | |
126 Line* GetLine(); | |
75 | 127 |
258 | 128 private: |
129 Header* header; | |
130 Line* line; | |
64 | 131 }; |
132 | |
133 } // namespace TextWidgets | |
134 | |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
135 #endif // MINORI_GUI_WIDGETS_TEXT_H_ |