peripheralwidget.h
61 lines
| 1.6 KiB
| text/x-c
|
CLexer
/ src / peripheralwidget.h
|
r5 | #ifndef PERIPHERALWIDGET_H | ||
#define PERIPHERALWIDGET_H | ||||
#include <QWidget> | ||||
#include <QGroupBox> | ||||
#include <QVBoxLayout> | ||||
#include <QList> | ||||
#include <QTimer> | ||||
#include "registerwidget.h" | ||||
|
r15 | #if defined(SOCEXPLORER_SDK_BUILD) | ||
# define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | ||||
|
r10 | #else | ||
|
r15 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | ||
|
r10 | #endif | ||
|
r7 | /* | ||
* TODO ADD an outdated marker | ||||
* Show outdated registers with a different color for example | ||||
*/ | ||||
|
r15 | class SOCEXPLORER_SDK_EXPORT peripheralWidget : public QWidget | ||
|
r5 | { | ||
Q_OBJECT | ||||
public: | ||||
explicit peripheralWidget(const QString& name,qint32 baseAddress, QWidget *parent = 0); | ||||
|
r7 | registerWidget* registerAt(int index) | ||
{ | ||||
if(index>=0 && index<registersWdgts.count()) | ||||
return registersWdgts.at(index); | ||||
return NULL; | ||||
} | ||||
|
r5 | signals: | ||
void writeRegSig(qint32 address,qint32 value); | ||||
qint32 readRegSig(qint32 address); | ||||
|
r11 | void clicked(peripheralWidget* sender); | ||
void upSig(peripheralWidget* sender,int cursorIndex); | ||||
void downSig(peripheralWidget* sender,int cursorIndex); | ||||
|
r5 | public slots: | ||
void blinkCursor(); | ||||
void addRegister(const QString& name,qint32 address); | ||||
|
r11 | void leave(); | ||
void enter(int cursorIndex,bool fromTop=true); | ||||
|
r5 | protected: | ||
void mousePressEvent(QMouseEvent *event); | ||||
void mouseMoveEvent(QMouseEvent *event); | ||||
void mouseReleaseEvent(QMouseEvent *event); | ||||
void keyPressEvent(QKeyEvent * event); | ||||
void paintEvent(QPaintEvent* event); | ||||
private: | ||||
void up(); | ||||
void down(); | ||||
QString p_name; | ||||
QString p_header; | ||||
qint32 p_baseAddress; | ||||
QList<registerWidget*> registersWdgts; | ||||
int selectedReg; | ||||
QTimer* p_timer; | ||||
r9 | ||||
|
r5 | }; | ||
#endif // PERIPHERALWIDGET_H | ||||