aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/latch.h
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-12-15 22:45:28 +0100
committerKarel Kočí <cynerd@email.cz>2017-12-15 22:45:28 +0100
commite6ca4b4568e311b47239bfe83de15ed9e91c57b9 (patch)
tree3da2f72faf360058bae02c35b0c724233bd64d61 /qtmips_gui/coreview/latch.h
parentbbea996112eb7ac81ec50d2af08f4bd681d0e50d (diff)
downloadqtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.gz
qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.bz2
qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.zip
Implement few initial graphic elements
Diffstat (limited to 'qtmips_gui/coreview/latch.h')
-rw-r--r--qtmips_gui/coreview/latch.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/qtmips_gui/coreview/latch.h b/qtmips_gui/coreview/latch.h
new file mode 100644
index 0000000..a8738b3
--- /dev/null
+++ b/qtmips_gui/coreview/latch.h
@@ -0,0 +1,45 @@
+#ifndef LATCH_H
+#define LATCH_H
+
+#include <QGraphicsObject>
+#include <QList>
+#include "qtmipsexception.h"
+#include "qtmipsmachine.h"
+#include "../coreview.h"
+#include "connection.h"
+
+namespace coreview {
+
+class Latch : public QGraphicsObject {
+ Q_OBJECT
+public:
+ Latch(QtMipsMachine *machine, qreal height);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ void setPos(qreal x, qreal y);
+
+ struct ConnectorPair { Connector *in, *out; };
+
+ struct ConnectorPair new_connector(qreal y); // Create new connectors pair that is given y from top of latch
+
+private slots:
+ void tick();
+
+private:
+ qreal height;
+ QList<ConnectorPair> connectors;
+ QList<qreal> connectors_off;
+
+};
+
+}
+
+#else
+
+namespace coreview {
+ class Latch;
+};
+
+#endif // LATCH_H