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