forked from Dax89/QHexView
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqhexedithighlighter.h
36 lines (30 loc) · 1.07 KB
/
qhexedithighlighter.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
#ifndef QHEXEDITHIGHLIGHTER_H
#define QHEXEDITHIGHLIGHTER_H
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
#include "qhexeditdata.h"
#include "sparserangemap.h"
class QHexEditHighlighter : public QObject
{
Q_OBJECT
private:
typedef SparseRangeMap<QColor> ColorMap;
public:
explicit QHexEditHighlighter(QHexEditData* hexeditdata, QColor backdefault, QColor foredefault, QObject *parent = 0);
void colors(qint64 pos, QColor& bc, QColor& fc) const;
QColor defaultBackColor() const;
QColor defaultForeColor() const;
QColor backColor(qint64 pos) const;
QColor foreColor(qint64 pos) const;
void highlightForeground(qint64 start, qint64 end, const QColor& color);
void highlightBackground(qint64 start, qint64 end, const QColor& color);
void clearHighlight(qint64 start, qint64 end);
private:
ColorMap _backgroundmap;
ColorMap _foregroundmap;
QHexEditData* _hexeditdata;
QColor _backdefault;
QColor _foredefault;
};
#endif // QHEXEDITHIGHLIGHTER_H