aboutsummaryrefslogtreecommitdiffstats
path: root/include/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/ui')
-rw-r--r--include/ui/painter.h26
-rw-r--r--include/ui/statementdialog.h22
2 files changed, 43 insertions, 5 deletions
diff --git a/include/ui/painter.h b/include/ui/painter.h
index df62776..0a2accc 100644
--- a/include/ui/painter.h
+++ b/include/ui/painter.h
@@ -1,11 +1,15 @@
#ifndef PAINTER_H
#define PAINTER_H
-#include <QWidget>
+#include "diagram/statement.h"
+#include "diagram/structogram.h"
-namespace Ui {
-class Painter;
-}
+#include <QWidget>
+#include <QFont>
+#include <QFontMetrics>
+#include <QPaintEvent>
+#include <QPainter>
+#include <QRect>
class Painter : public QWidget
{
@@ -15,8 +19,20 @@ public:
explicit Painter(QWidget *parent = 0);
~Painter();
+ void structogram(samb::Structogram **structogram) { _structogram = structogram; }
+ const samb::Structogram structogram() const { return **_structogram; }
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
private:
- Ui::Painter *_ui;
+ samb::Structogram **_structogram = nullptr;
+ QFont _font;
+ QFontMetrics _fontMetrics;
+
+ int _margin = 10;
+
+ void drawStatement(QPainter &qp, samb::Statement &statement, const QRect &rect);
};
#endif // PAINTER_H
diff --git a/include/ui/statementdialog.h b/include/ui/statementdialog.h
new file mode 100644
index 0000000..658ea53
--- /dev/null
+++ b/include/ui/statementdialog.h
@@ -0,0 +1,22 @@
+#ifndef STATEMENTDIALOG_H
+#define STATEMENTDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class StatementDialog;
+}
+
+class StatementDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit StatementDialog(QWidget *parent = 0);
+ ~StatementDialog();
+
+private:
+ Ui::StatementDialog *ui;
+};
+
+#endif // STATEMENTDIALOG_H