aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/multiplexer.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/multiplexer.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/multiplexer.h')
-rw-r--r--qtmips_gui/coreview/multiplexer.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/qtmips_gui/coreview/multiplexer.h b/qtmips_gui/coreview/multiplexer.h
new file mode 100644
index 0000000..6aa11a6
--- /dev/null
+++ b/qtmips_gui/coreview/multiplexer.h
@@ -0,0 +1,41 @@
+#ifndef MULTIPLEXER_H
+#define MULTIPLEXER_H
+
+#include <QGraphicsItem>
+#include "qtmipsexception.h"
+#include "../coreview.h"
+#include "connection.h"
+
+namespace coreview {
+
+class Multiplexer : public QGraphicsItem {
+public:
+ Multiplexer(unsigned size);
+ ~Multiplexer();
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ void setPos(qreal x, qreal y);
+ const Connector *connector_ctl() const; // Control input
+ const Connector *connector_out() const; // Output
+ const Connector *connector_in(unsigned i) const; // Inputs
+
+ void set(unsigned i); // Set what value should be set as connected
+ void setCtl(bool up); // Set if control signal is from up or down (in default down)
+
+private:
+ bool ctlfrom;
+ unsigned size, seton;
+ Connector *con_ctl, *con_out, **con_in;
+};
+
+}
+
+#else
+
+namespace coreview {
+ class Multiplexer;
+}
+
+#endif // MULTIPLEXER_H