QHexEdit: /media/winni/1p4/Werkstatt/qt/qhexedit2/src/color_manager.h Source File

QHexEdit

Loading...
Searching...
No Matches
color_manager.h
1#ifndef COLOR_MANAGER_H
2#define COLOR_MANAGER_H
3
18#include <QtCore>
19#include <QtGui>
20
21#include "chunks.h"
22
23enum Area {
24 Address,
25 Hex,
26 Ascii,
27};
28
29class ColoredArea
30{
31public:
32 // Cunstructors
33 ColoredArea();
34 ColoredArea(QPen pen, QBrush background);
35 ColoredArea(qint64 posStart, qint64 posEnd, QPen pen, QBrush background);
36
37 // Property to set/get font color
38 QColor fontColor();
39 void setFontColor(QColor color);
40
41 // Property to set/get area style
42 QColor areaColor();
43 QBrush areaStyle();
44 void setAreaColor(QColor color);
45 void setAreaStyle(QBrush background);
46
47 // other Methods to acces and set internal data
48 QPen fontPen();
49 qint64 posStart();
50 qint64 posEnd();
51 void setRange(qint64 posStart, qint64 posEnd);
52 void clear();
53
54private:
55 qint64 _posStart;
56 qint64 _posEnd;
57 QPen _fontColor;
58 QBrush _areaStyle;
59};
60
61
62class ColorManager
63{
64public:
65 // Constructor including the definition of standard colors
66 ColorManager();
67
68 // reload the palette and adapt the apeareance
69 void setPalette(const QPalette &palette);
70
71 // Method returns color definitions for data at position pos in area area
72 ColoredArea markedArea(qint64 pos, Area area, Chunks *chunks);
73
74 // Method returns standard collors (without marking)
75 ColoredArea& notMarked(Area);
76
77 // Get the selection color definitions
78 ColoredArea& selection();
79
80 // Get the highlighting color definitions
81 ColoredArea& highlighting();
82
83 // Add a user defined area
84 void addUserArea(qint64 posStart, qint64 posEnd, QColor fontColor, QBrush areaStyle);
85
86 // Clear all user defined areas
87 void clearUserAreas();
88
89private:
90 ColoredArea _highlighting;
91 ColoredArea _selection;
92 ColoredArea _address;
93 ColoredArea _hex;
94 ColoredArea _ascii;
95
96 QList<ColoredArea> _userAreas;
97};
98
99#endif // COLOR_MANAGER_H