HexViewer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef HEXVIEWER_H
  2. #define HEXVIEWER_H
  3. #include <QFrame>
  4. class HexRequest;
  5. class QScrollBar;
  6. class QPaintEvent;
  7. class HexViewer : public QFrame
  8. {
  9. Q_OBJECT
  10. public:
  11. HexViewer(QWidget* parent = 0);
  12. ~HexViewer();
  13. enum Mode { FIXED, FILL_WIDTH, FILL_WIDTH_POWEROF2 };
  14. void setDebuggable(const QString& name, int size);
  15. void setIsInteractive(bool enabled);
  16. void setUseMarker(bool enabled);
  17. void setIsEditable(bool enabled);
  18. void setDisplayMode(Mode mode);
  19. void setDisplayWidth(short width);
  20. QSize sizeHint() const;
  21. public slots:
  22. void setLocation(int addr);
  23. void setTopLocation(int addr);
  24. void scrollBarChanged(int addr);
  25. void settingsChanged();
  26. void refresh();
  27. private:
  28. void wheelEvent(QWheelEvent* e);
  29. void resizeEvent(QResizeEvent* e);
  30. void paintEvent(QPaintEvent* e);
  31. void mousePressEvent(QMouseEvent* e);
  32. bool event(QEvent* e);
  33. void keyPressEvent(QKeyEvent* e);
  34. void focusInEvent(QFocusEvent* e);
  35. void focusOutEvent(QFocusEvent* e);
  36. void createActions();
  37. void setSizes();
  38. void hexdataTransfered(HexRequest* r);
  39. void transferCancelled(HexRequest* r);
  40. int coorToOffset(int x, int y);
  41. QScrollBar* vertScrollBar;
  42. QAction *fillWidthAction;
  43. QAction *fillWidth2Action;
  44. QAction *setWith8Action;
  45. QAction *setWith16Action;
  46. QAction *setWith32Action;
  47. // layout
  48. int frameL, frameR, frameT, frameB;
  49. int leftCharPos, leftValuePos, rightValuePos, rightCharPos;
  50. Mode displayMode;
  51. short horBytes;
  52. int visibleLines, partialBottomLine;
  53. int lineHeight, xAddr, xData, xChar, dataWidth, charWidth, hexCharWidth;
  54. int addressLength;
  55. // data
  56. QString debuggableName;
  57. int debuggableSize;
  58. int hexTopAddress;
  59. int hexMarkAddress;
  60. unsigned char* hexData;
  61. unsigned char* previousHexData;
  62. bool waitingForData;
  63. bool highlitChanges;
  64. bool useMarker;
  65. bool isInteractive;
  66. bool isEditable;
  67. bool beingEdited;
  68. bool editedChars;
  69. bool hasFocus;
  70. int cursorPosition,editValue;
  71. friend class HexRequest;
  72. private slots:
  73. void changeWidth();
  74. signals:
  75. void locationChanged(int addr);
  76. };
  77. #endif // HEXVIEWER_H