@@ -1,154 +1,154 | |||
|
1 | 1 | #include "charttheme_p.h" |
|
2 | 2 | #ifdef Q_OS_WIN |
|
3 | 3 | #include <windows.h> |
|
4 | 4 | #include <stdio.h> |
|
5 | 5 | #endif |
|
6 | 6 | |
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 | 9 | class ChartThemeDefault: public ChartTheme |
|
10 | 10 | { |
|
11 | 11 | public: |
|
12 | 12 | ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault) |
|
13 | 13 | { |
|
14 | 14 | #ifdef Q_OS_WIN |
|
15 | 15 | // TODO: use theme specific window frame color as a series base color (it would give more |
|
16 | 16 | // variation to the base colors in addition to the blue and black used now) |
|
17 | 17 | // TODO: COLOR_WINDOWTEXT for text color? |
|
18 | 18 | // TODO: COLOR_INFOTEXT for tooltip text color? |
|
19 | 19 | // TODO: COLOR_INFOBK for tooltip background color? |
|
20 | 20 | |
|
21 | 21 | // First series base color from COLOR_HIGHLIGHT |
|
22 | 22 | DWORD colorHighlight; |
|
23 | 23 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); |
|
24 | 24 | m_seriesColors.append(QColor(GetRValue(colorHighlight), |
|
25 | 25 | GetGValue(colorHighlight), |
|
26 | 26 | GetBValue(colorHighlight))); |
|
27 | 27 | |
|
28 | 28 | // Second series base color from COLOR_WINDOWFRAME |
|
29 | 29 | DWORD colorWindowFrame; |
|
30 | 30 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); |
|
31 | 31 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), |
|
32 | 32 | GetGValue(colorWindowFrame), |
|
33 | 33 | GetBValue(colorWindowFrame))); |
|
34 | 34 | |
|
35 | 35 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / |
|
36 | 36 | // COLOR_GRADIENTACTIVECAPTION gradient |
|
37 | 37 | DWORD colorGradientActiveCaptionLeft; |
|
38 | 38 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); |
|
39 | 39 | DWORD colorGradientActiveCaptionRight; |
|
40 | 40 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); |
|
41 | 41 | QLinearGradient g; |
|
42 | 42 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), |
|
43 | 43 | GetGValue(colorGradientActiveCaptionLeft), |
|
44 | 44 | GetBValue(colorGradientActiveCaptionLeft)); |
|
45 | 45 | g.setColorAt(0.0, start); |
|
46 | 46 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), |
|
47 | 47 | GetGValue(colorGradientActiveCaptionRight), |
|
48 | 48 | GetBValue(colorGradientActiveCaptionRight)); |
|
49 | 49 | g.setColorAt(1.0, end); |
|
50 | 50 | m_seriesColors.append(colorAt(g, 0.5)); |
|
51 | 51 | |
|
52 | 52 | // Generate gradients from the base colors |
|
53 | 53 | generateSeriesGradients(); |
|
54 | 54 | |
|
55 | 55 | // Background fill color from COLOR_WINDOW |
|
56 | 56 | QLinearGradient backgroundGradient; |
|
57 | 57 | DWORD colorWindow; |
|
58 | 58 | colorWindow = GetSysColor(COLOR_WINDOW); |
|
59 | 59 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), |
|
60 | 60 | GetGValue(colorWindow), |
|
61 | 61 | GetBValue(colorWindow))); |
|
62 | 62 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), |
|
63 | 63 | GetGValue(colorWindow), |
|
64 | 64 | GetBValue(colorWindow))); |
|
65 | 65 | // Axes and other |
|
66 | 66 | m_masterFont = QFont(); |
|
67 | 67 | m_masterFont.setPointSizeF(10.0); |
|
68 | 68 | m_axisLinePen = QPen(Qt::black); |
|
69 | 69 | m_axisLinePen.setWidth(2); |
|
70 | 70 | m_axisLabelBrush = QBrush(Qt::black); |
|
71 | 71 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
72 | 72 | m_backgroundShadesPen = Qt::NoPen; |
|
73 | 73 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
74 | 74 | m_backgroundShades = BackgroundShadesVertical; |
|
75 | 75 | |
|
76 | 76 | #elif defined(Q_OS_LINUX) |
|
77 | 77 | // TODO: replace this dummy theme with linux specific theme |
|
78 | 78 | m_seriesColors << QRgb(0x60a6e6); |
|
79 | 79 | m_seriesColors << QRgb(0x92ca66); |
|
80 | 80 | m_seriesColors << QRgb(0xeba85f); |
|
81 | 81 | m_seriesColors << QRgb(0xfc5751); |
|
82 | 82 | generateSeriesGradients(); |
|
83 | 83 | |
|
84 | 84 | QLinearGradient backgroundGradient; |
|
85 | 85 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
86 | 86 | backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9)); |
|
87 | 87 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
88 |
m_ |
|
|
88 | m_chartBackgroundGradient = backgroundGradient; | |
|
89 | 89 | |
|
90 | 90 | // Axes and other |
|
91 | 91 | m_masterFont = QFont(); |
|
92 | 92 | m_masterFont.setPointSizeF(10.0); |
|
93 | 93 | m_axisLinePen = QPen(Qt::black); |
|
94 | 94 | m_axisLinePen.setWidth(2); |
|
95 | 95 | m_axisLabelBrush = QBrush(Qt::black); |
|
96 | 96 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
97 | 97 | m_backgroundShadesPen = Qt::NoPen; |
|
98 | 98 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
99 | 99 | m_backgroundShades = BackgroundShadesVertical; |
|
100 | 100 | |
|
101 | 101 | #elif defined(Q_OS_MAC) |
|
102 | 102 | // TODO: replace this dummy theme with OSX specific theme |
|
103 | 103 | m_seriesColors << QRgb(0x60a6e6); |
|
104 | 104 | m_seriesColors << QRgb(0x92ca66); |
|
105 | 105 | m_seriesColors << QRgb(0xeba85f); |
|
106 | 106 | m_seriesColors << QRgb(0xfc5751); |
|
107 | 107 | generateSeriesGradients(); |
|
108 | 108 | |
|
109 | 109 | QLinearGradient backgroundGradient; |
|
110 | 110 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
111 | 111 | backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9)); |
|
112 | 112 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
113 | 113 | m_chartBackgroundGradient = backgroundGradient; |
|
114 | 114 | |
|
115 | 115 | // Axes and other |
|
116 | 116 | m_masterFont = QFont(); |
|
117 | 117 | m_masterFont.setPointSizeF(10.0); |
|
118 | 118 | m_axisLinePen = QPen(Qt::black); |
|
119 | 119 | m_axisLinePen.setWidth(2); |
|
120 | 120 | m_axisLabelBrush = QBrush(Qt::black); |
|
121 | 121 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
122 | 122 | m_backgroundShadesPen = Qt::NoPen; |
|
123 | 123 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
124 | 124 | m_backgroundShades = BackgroundShadesVertical; |
|
125 | 125 | |
|
126 | 126 | #else |
|
127 | 127 | // TODO: replace this dummy theme with generic (not OS specific) theme |
|
128 | 128 | m_seriesColors << QRgb(0x60a6e6); |
|
129 | 129 | m_seriesColors << QRgb(0x92ca66); |
|
130 | 130 | m_seriesColors << QRgb(0xeba85f); |
|
131 | 131 | m_seriesColors << QRgb(0xfc5751); |
|
132 | 132 | generateSeriesGradients(); |
|
133 | 133 | |
|
134 | 134 | QLinearGradient backgroundGradient; |
|
135 | 135 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
136 | 136 | backgroundGradient.setColorAt(1.0, QRgb(0xafafaf)); |
|
137 | 137 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
138 | 138 | m_backgroundGradient = backgroundGradient; |
|
139 | 139 | |
|
140 | 140 | // Axes and other |
|
141 | 141 | m_masterFont = QFont(); |
|
142 | 142 | m_masterFont.setPointSizeF(10.0); |
|
143 | 143 | m_axisLinePen = QPen(Qt::black); |
|
144 | 144 | m_axisLinePen.setWidth(2); |
|
145 | 145 | m_axisLabelBrush = QBrush(Qt::black); |
|
146 | 146 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
147 | 147 | m_backgroundShadesPen = Qt::NoPen; |
|
148 | 148 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
149 | 149 | m_backgroundShades = BackgroundShadesVertical; |
|
150 | 150 | #endif |
|
151 | 151 | } |
|
152 | 152 | }; |
|
153 | 153 | |
|
154 | 154 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now