- BasicBlockWidget(const QString& name)
- : x(-5), y(-20)
- , dx(270), dy(45)
- , name(name) {
- _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
- _widget.setMaximumHeight(20);
- dx = _widget.sizeHintForColumn(0) + 20;
- if (dx < 270) dx = 270;
- }
-
- void addItem(const QString& line) {
- _widget.addItem(line);
- _widget.updateGeometry();
- _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
- _widget.setMinimumHeight(_widget.sizeHintForRow(0) * (1 + _widget.count()));
- _widget.setMaximumHeight(_widget.sizeHintForRow(0) * (1 + _widget.count()));
- dy = _widget.sizeHintForRow(0) * (1 + _widget.count()) + 25;
- dx = _widget.sizeHintForColumn(0) + 20;
- if (dx < 270) dx = 270;
- }
-
- QRectF boundingRect() const
- {
- qreal penWidth = 1;
- return QRectF(x - penWidth / 2, y - penWidth / 2,
- dx + penWidth, dy + penWidth);
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget)
- {
- painter->fillRect(x, y, dx, dy, QColor(0xcc, 0xcc, 0xff, 0xff));
- painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
- painter->drawRect(x, y, dx, dy);
- painter->drawText(0, -5, name);
- _widget.render(painter);
- }
+ BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow);
+
+ void addItem(uint8_t* bytes, size_t num_bytes, QString line, const QString& href);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget);
+ QRectF boundingRect() const;
+ std::array<QPointF, 3> getExits() const;
+
+ void mouseMoveEvent(QGraphicsSceneMouseEvent * event)
+ { QGraphicsItem::mouseMoveEvent(event); scene()->update(); }
+
+ QPointF getEntry() const
+ { return mapToScene(QPointF(width/2, 0)); }
+
+ void addPrevious(BasicBlockWidget * widget)
+ { previous.push_back(widget); }
+
+ void addNext(BasicBlockWidget * left, BasicBlockWidget * right)
+ { next[0] = left; next[1] = right; }
+
+ BasicBlockWidget ** getNext()
+ { return next; }
+
+ QString getName() const
+ { return name; }