forked from Dax89/QHexView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qhexeditprivate.h
65 lines (57 loc) · 2.1 KB
/
qhexeditprivate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef QHEXEDITPRIVATE_H
#define QHEXEDITPRIVATE_H
#include <QScrollArea>
#include <QScrollBar>
#include <QWidget>
#include "qhexedit.h"
#include "document/qhexdocument.h"
#include "document/qhextheme.h"
#include "paint/qhexmetrics.h"
class QHexEditPrivate : public QWidget
{
Q_OBJECT
public:
explicit QHexEditPrivate(QScrollArea* scrollarea, QScrollBar* vscrollbar, QWidget *parent = 0);
QHexDocument* document() const;
QHexMetrics* metrics() const;
bool overwriteOnly() const;
bool readOnly() const;
void setDocument(QHexDocument* document);
void setOverwriteOnly(bool b);
void setReadOnly(bool b);
void scroll(QWheelEvent *event);
private:
integer_t offsetFromPoint(const QPoint& pt, integer_t* bitindex = NULL) const;
void toggleComment(const QPoint &pos);
void updateCaret(integer_t offset, integer_t nibbleindex);
void processDeleteEvents();
void processBackspaceEvents();
void processHexPart(int key);
void processAsciiPart(int key);
bool processMoveEvents(QKeyEvent* event);
bool processSelectEvents(QKeyEvent* event);
bool processTextInputEvents(QKeyEvent* event);
bool processInsOvrEvents(QKeyEvent* event);
bool processUndoRedo(QKeyEvent* event);
bool processClipboardKeys(QKeyEvent* event);
protected:
void paintEvent(QPaintEvent* pe);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void keyPressEvent(QKeyEvent* event);
void resizeEvent(QResizeEvent*e);
signals:
void visibleLinesChanged();
void verticalScroll(int value);
private:
static const integer_t WHELL_SCROLL_LINES;
QScrollArea* _scrollarea;
QScrollBar* _vscrollbar;
QHexDocument* _document;
QHexMetrics* _metrics;
QHexTheme* _theme;
bool _overwriteonly;
bool _readonly;
};
#endif // QHEXEDITPRIVATE_H