]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/widgets/BasicBlockWidget.cxx
Compactify BasicBlockWidget header
[frida/frida.git] / src / gui / widgets / BasicBlockWidget.cxx
index eccb679f35e971a2749d9a721c3153334be84bd7..f6113292dc97a325d48103693f3472caf62f5ca0 100644 (file)
@@ -3,16 +3,14 @@
 
 BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block,
                                    Mainwindow * mainwindow)
-       : width(270), height(45)
-       , _widget("", this)
-       , _table(NULL), name(name)
+       : width(270), height(45), name(name)
+       , _widget("", this), _table(NULL)
        , block(block), mainwindow(mainwindow) {
        next[0] = NULL; next[1] = NULL;
+       _widget.setPos(5, 20);
        _widget.setTextInteractionFlags(Qt::TextSelectableByMouse|
                                        Qt::LinksAccessibleByMouse);
 
-       _widget.setPos(5, 20);
-
        if (width < 250) width = 250;
 }
 
@@ -61,3 +59,25 @@ void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes,
 
        if (width < 250) width = 250;
 }
+
+void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+                  QWidget *widget) {
+       painter->fillRect(0, 0, width, height, QColor(0xcc, 0xcc, 0xff, 0xff));
+       painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
+       painter->drawRect(0, 0, width, height);
+       painter->drawText(5, 15, name);
+}
+
+QRectF BasicBlockWidget::boundingRect() const  {
+       qreal penWidth = 1;
+       QRectF result(- penWidth / 2, - penWidth / 2,
+                     width + penWidth, height + penWidth);
+       return result;
+}
+
+std::array<QPointF, 3> BasicBlockWidget::getExits() const {
+       return { { mapToScene(QPointF(  width/3, height)),
+                          mapToScene(QPointF(  width/2, height)),
+                          mapToScene(QPointF(2*width/3, height)) } };
+}
+