view include/gui/widgets/text.h @ 69:27a19dd6cba1

*: fix up some stuff settings: due to my own incompetence OnOK caused the entire program to crash, now that's fixed :)
author Paper <mrpapersonic@gmail.com>
date Tue, 03 Oct 2023 03:38:25 -0400
parents fe719c109dbc
children d3e9310598b1
line wrap: on
line source

#ifndef __gui__ui_utils_h
#define __gui__ui_utils_h

#include <QWidget>
#include <QString>
#include <QSize>
#include <QPlainTextEdit>

class QFrame;
class QLabel;

namespace TextWidgets {

class Header : public QWidget {
		Q_OBJECT

	public:
		Header(QString title, QWidget* parent = nullptr);
		void SetText(QString title);

	private:
		QLabel* static_text_title;
		QFrame* static_text_line;
};

class Paragraph : public QPlainTextEdit {
		Q_OBJECT

	public:
		Paragraph(QString text, QWidget* parent = nullptr);
		void SetText(QString text);
		QSize minimumSizeHint() const override;
		QSize sizeHint() const override;
};

/* technically a paragraph and a heading is actually a
   "section", but that name is equally as confusing as
   "text paragraph". */
class TextParagraph : public QWidget {
		Q_OBJECT

	public:
		TextParagraph(QString title, QString data, QWidget* parent = nullptr);
		Header* GetHeader();
		Paragraph* GetParagraph();

	private:
		Header* header;
		Paragraph* paragraph;
};

class LabelledTextParagraph : public QWidget {
		Q_OBJECT

	public:
		LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr);
		Header* GetHeader();
		Paragraph* GetLabels();
		Paragraph* GetParagraph();

	private:
		Header* header;
		Paragraph* labels;
		Paragraph* paragraph;
};

class SelectableTextParagraph : public QWidget {
		Q_OBJECT

	public:
		SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr);
		Header* GetHeader();
		Paragraph* GetParagraph();

	private:
		Header* header;
		Paragraph* paragraph;
};

class Title : public Paragraph {
		Q_OBJECT

	public:
		Title(QString title, QWidget* parent = nullptr);
};

} // namespace TextWidgets

#endif // __gui__ui_utils_h