#ifndef INCLUDE__BasicBlockWidget_hxx
#define INCLUDE__BasicBlockWidget_hxx
-#include "gui/qt.hxx"
+#include "qt.hxx"
#include <vector>
#include <cassert>
#include <tuple>
#include <memory>
#include <log4cxx/logger.h>
+#include "disassembler/Instruction.hxx"
+
class Mainwindow;
class CustomQGraphicsTextItem;
-
class BasicBlock;
+class RenameFunctionEvent;
+class ChangeCommentEvent;
class BasicBlockWidget : public QObject, public QGraphicsItem
{
public:
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;
QString getName() const
{ return name; }
+
+ QColor setColor(const QColor& newColor) {
+ QColor lastcolor = currentColor;
+ currentColor = newColor;
+ return lastcolor;
+ }
+
+ const QColor defaultColor = QColor(0xcc, 0xcc, 0xff, 0xff);
+ const QColor highlightColor = QColor(0xff, 0x99, 0xff, 0xff);
private:
+ void updateFunctionName(RenameFunctionEvent* event);
+ void populateWidget();
+ void changeCommentHandler(ChangeCommentEvent* event);
+ QString formatComments(Instruction* inst);
+ void updateSize();
+
uint32_t width, height;
QString name;
+ QColor currentColor;
std::unique_ptr<QGraphicsTextItem> _widget;
QTextTable* _table;
BasicBlock* block;
+ std::vector<Instruction> instructions;
Mainwindow* mainwindow;
std::vector<BasicBlockWidget*> previous;
BasicBlockWidget* next[2];