diff options
Diffstat (limited to 'qtmips_gui/coreview/latch.h')
-rw-r--r-- | qtmips_gui/coreview/latch.h | 45 |
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 |