| 46 | 1 #ifndef __gui__ui_utils_h | 
|  | 2 #define __gui__ui_utils_h | 
| 64 | 3 | 
| 46 | 4 #include <QFrame> | 
|  | 5 #include <QLabel> | 
|  | 6 #include <QPlainTextEdit> | 
|  | 7 #include <QSize> | 
|  | 8 #include <QString> | 
|  | 9 #include <QWidget> | 
| 64 | 10 | 
| 46 | 11 namespace TextWidgets { | 
|  | 12 | 
|  | 13 class Header : public QWidget { | 
|  | 14 		Q_OBJECT | 
|  | 15 | 
|  | 16 	public: | 
|  | 17 		Header(QString title, QWidget* parent = nullptr); | 
| 64 | 18 		void SetText(QString title); | 
| 46 | 19 | 
|  | 20 	private: | 
|  | 21 		QLabel* static_text_title; | 
|  | 22 		QFrame* static_text_line; | 
|  | 23 }; | 
|  | 24 | 
|  | 25 class Paragraph : public QPlainTextEdit { | 
|  | 26 		Q_OBJECT | 
|  | 27 | 
|  | 28 	public: | 
|  | 29 		Paragraph(QString text, QWidget* parent = nullptr); | 
| 64 | 30 		void SetText(QString text); | 
| 46 | 31 		QSize minimumSizeHint() const override; | 
|  | 32 		QSize sizeHint() const override; | 
|  | 33 }; | 
|  | 34 | 
|  | 35 /* technically a paragraph and a heading is actually a | 
|  | 36    "section", but that name is equally as confusing as | 
|  | 37    "text paragraph". */ | 
|  | 38 class TextParagraph : public QWidget { | 
|  | 39 		Q_OBJECT | 
|  | 40 | 
|  | 41 	public: | 
|  | 42 		TextParagraph(QString title, QString data, QWidget* parent = nullptr); | 
|  | 43 		Header* GetHeader(); | 
|  | 44 		Paragraph* GetParagraph(); | 
|  | 45 | 
|  | 46 	private: | 
|  | 47 		Header* header; | 
|  | 48 		Paragraph* paragraph; | 
|  | 49 }; | 
|  | 50 | 
|  | 51 class LabelledTextParagraph : public QWidget { | 
|  | 52 		Q_OBJECT | 
|  | 53 | 
|  | 54 	public: | 
|  | 55 		LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr); | 
|  | 56 		Header* GetHeader(); | 
|  | 57 		Paragraph* GetLabels(); | 
|  | 58 		Paragraph* GetParagraph(); | 
|  | 59 | 
|  | 60 	private: | 
|  | 61 		Header* header; | 
|  | 62 		Paragraph* labels; | 
|  | 63 		Paragraph* paragraph; | 
|  | 64 }; | 
|  | 65 | 
|  | 66 class SelectableTextParagraph : public QWidget { | 
|  | 67 		Q_OBJECT | 
|  | 68 | 
|  | 69 	public: | 
|  | 70 		SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr); | 
|  | 71 		Header* GetHeader(); | 
|  | 72 		Paragraph* GetParagraph(); | 
|  | 73 | 
|  | 74 	private: | 
|  | 75 		Header* header; | 
|  | 76 		Paragraph* paragraph; | 
|  | 77 }; | 
| 64 | 78 | 
|  | 79 class Title : public Paragraph { | 
|  | 80 		Q_OBJECT | 
|  | 81 | 
|  | 82 	public: | 
|  | 83 		Title(QString title, QWidget* parent = nullptr); | 
|  | 84 }; | 
|  | 85 | 
|  | 86 } // namespace TextWidgets | 
|  | 87 | 
| 46 | 88 #endif // __gui__ui_utils_h |