]> git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.hxx
Bump Cmake compat version
[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 <vector>
6 #include <cassert>
7 #include <tuple>
8 #include <array>
9 #include <memory>
10 #include <log4cxx/logger.h>
11
12 #include "disassembler/Instruction.hxx"
13
14 class Mainwindow;
15 class CustomQGraphicsTextItem;
16 class BasicBlock;
17 class RenameFunctionEvent;
18
19 class BasicBlockWidget : public QObject, public QGraphicsItem
20 {
21 Q_OBJECT
22 friend class CustomQGraphicsTextItem;
23 public:
24 BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow);
25
26 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
27 QWidget *widget);
28 QRectF boundingRect() const;
29 std::array<QPointF, 3> getExits() const;
30
31 void mouseMoveEvent(QGraphicsSceneMouseEvent * event)
32 { QGraphicsItem::mouseMoveEvent(event); scene()->update(); }
33
34 QPointF getEntry() const
35 { return mapToScene(QPointF(width/2, 0)); }
36
37 void addPrevious(BasicBlockWidget * widget)
38 { previous.push_back(widget); }
39
40 void addNext(BasicBlockWidget * left, BasicBlockWidget * right)
41 { next[0] = left; next[1] = right; }
42
43 BasicBlockWidget ** getNext()
44 { return next; }
45
46 QString getName() const
47 { return name; }
48 private:
49 void updateFunctionName(RenameFunctionEvent* event);
50 void populateWidget();
51
52 uint32_t width, height;
53 QString name;
54 std::unique_ptr<QGraphicsTextItem> _widget;
55 QTextTable* _table;
56 BasicBlock* block;
57 std::vector<Instruction> instructions;
58 Mainwindow* mainwindow;
59 std::vector<BasicBlockWidget*> previous;
60 BasicBlockWidget* next[2];
61 log4cxx::LoggerPtr logger;
62 };
63
64 #endif