]> git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.hxx
Compile fix for last commit
[frida/frida.git] / src / gui / widgets / BasicBlockWidget.hxx
1 #ifndef INCLUDE__BasicBlockWidget_hxx
2 #define INCLUDE__BasicBlockWidget_hxx
3
4 #include "gui/qt.hxx"
5 #include "disassembler/BasicBlock.hxx"
6 #include <vector>
7 #include <cassert>
8 #include <tuple>
9 #include <array>
10 #include <memory>
11
12 class Mainwindow;
13
14 class BasicBlockWidget : public QObject, public QGraphicsItem
15 {
16 Q_OBJECT
17 public:
18 BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow);
19
20 void addItem(uint8_t* bytes, size_t num_bytes, QString line, const QString& href);
21 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
22 QWidget *widget);
23 QRectF boundingRect() const;
24 std::array<QPointF, 3> getExits() const;
25
26 void mouseMoveEvent(QGraphicsSceneMouseEvent * event)
27 { QGraphicsItem::mouseMoveEvent(event); scene()->update(); }
28
29 QPointF getEntry() const
30 { return mapToScene(QPointF(width/2, 0)); }
31
32 void addPrevious(BasicBlockWidget * widget)
33 { previous.push_back(widget); }
34
35 void addNext(BasicBlockWidget * left, BasicBlockWidget * right)
36 { next[0] = left; next[1] = right; }
37
38 BasicBlockWidget ** getNext()
39 { return next; }
40
41 QString getName() const
42 { return name; }
43 private:
44 uint32_t width, height;
45 QString name;
46 std::unique_ptr<QGraphicsTextItem> _widget;
47 QTextTable* _table;
48 BasicBlock* block;
49 Mainwindow* mainwindow;
50 std::vector<BasicBlockWidget*> previous;
51 BasicBlockWidget* next[2];
52 };
53
54 #endif