@@ -1,177 +1,177 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2014 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Enterprise Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Enterprise licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Enterprise License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | // W A R N I N G |
|
22 | 22 | // ------------- |
|
23 | 23 | // |
|
24 | 24 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
25 | 25 | // implementation detail. This header file may change from version to |
|
26 | 26 | // version without notice, or even be removed. |
|
27 | 27 | // |
|
28 | 28 | // We mean it. |
|
29 | 29 | |
|
30 | 30 | #ifndef CHARTTHEMESYSTEM_P_H |
|
31 | 31 | #define CHARTTHEMESYSTEM_P_H |
|
32 | 32 | |
|
33 | 33 | #include "charttheme_p.h" |
|
34 | 34 | #ifdef Q_OS_WIN |
|
35 | 35 | #include <windows.h> |
|
36 | 36 | #include <stdio.h> |
|
37 | 37 | #endif |
|
38 | 38 | |
|
39 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | 40 | |
|
41 | 41 | class ChartThemeSystem: public ChartTheme |
|
42 | 42 | { |
|
43 | 43 | public: |
|
44 | 44 | // System theme not used at the moment (the user is not able to select this theme) |
|
45 | 45 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) |
|
46 | 46 | { |
|
47 | #ifdef Q_OS_WIN | |
|
47 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) | |
|
48 | 48 | // We could also use theme specific window frame color as a series base color (it would give more |
|
49 | 49 | // variation to the base colors in addition to the blue and black used now) |
|
50 | 50 | |
|
51 | 51 | // First series base color from COLOR_HIGHLIGHT |
|
52 | 52 | DWORD colorHighlight; |
|
53 | 53 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); |
|
54 | 54 | m_seriesColors.append(QColor(GetRValue(colorHighlight), |
|
55 | 55 | GetGValue(colorHighlight), |
|
56 | 56 | GetBValue(colorHighlight))); |
|
57 | 57 | |
|
58 | 58 | // Second series base color from COLOR_WINDOWFRAME |
|
59 | 59 | DWORD colorWindowFrame; |
|
60 | 60 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); |
|
61 | 61 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), |
|
62 | 62 | GetGValue(colorWindowFrame), |
|
63 | 63 | GetBValue(colorWindowFrame))); |
|
64 | 64 | |
|
65 | 65 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / |
|
66 | 66 | // COLOR_GRADIENTACTIVECAPTION gradient |
|
67 | 67 | DWORD colorGradientActiveCaptionLeft; |
|
68 | 68 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); |
|
69 | 69 | DWORD colorGradientActiveCaptionRight; |
|
70 | 70 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); |
|
71 | 71 | QLinearGradient g; |
|
72 | 72 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), |
|
73 | 73 | GetGValue(colorGradientActiveCaptionLeft), |
|
74 | 74 | GetBValue(colorGradientActiveCaptionLeft)); |
|
75 | 75 | g.setColorAt(0.0, start); |
|
76 | 76 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), |
|
77 | 77 | GetGValue(colorGradientActiveCaptionRight), |
|
78 | 78 | GetBValue(colorGradientActiveCaptionRight)); |
|
79 | 79 | g.setColorAt(1.0, end); |
|
80 | 80 | m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5)); |
|
81 | 81 | |
|
82 | 82 | // Generate gradients from the base colors |
|
83 | 83 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
84 | 84 | |
|
85 | 85 | // Background fill color from COLOR_WINDOW |
|
86 | 86 | QLinearGradient backgroundGradient; |
|
87 | 87 | DWORD colorWindow; |
|
88 | 88 | colorWindow = GetSysColor(COLOR_WINDOW); |
|
89 | 89 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), |
|
90 | 90 | GetGValue(colorWindow), |
|
91 | 91 | GetBValue(colorWindow))); |
|
92 | 92 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), |
|
93 | 93 | GetGValue(colorWindow), |
|
94 | 94 | GetBValue(colorWindow))); |
|
95 | 95 | // Axes and other |
|
96 | 96 | m_axisLinePen = QPen(0xd6d6d6); |
|
97 | 97 | m_axisLinePen.setWidth(1); |
|
98 | 98 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
99 | 99 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
100 | 100 | m_gridLinePen.setWidth(1); |
|
101 | 101 | m_backgroundShades = BackgroundShadesNone; |
|
102 | 102 | |
|
103 | 103 | #elif defined(Q_OS_LINUX) |
|
104 | 104 | // Using a hard coded theme for Linux system theme |
|
105 | 105 | m_seriesColors << QRgb(0x60a6e6); |
|
106 | 106 | m_seriesColors << QRgb(0x92ca66); |
|
107 | 107 | m_seriesColors << QRgb(0xeba85f); |
|
108 | 108 | m_seriesColors << QRgb(0xfc5751); |
|
109 | 109 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
110 | 110 | |
|
111 | 111 | // Background |
|
112 | 112 | QLinearGradient backgroundGradient; |
|
113 | 113 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
114 | 114 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
115 | 115 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
116 | 116 | m_chartBackgroundGradient = backgroundGradient; |
|
117 | 117 | |
|
118 | 118 | // Axes and other |
|
119 | 119 | m_axisLinePen = QPen(0xd6d6d6); |
|
120 | 120 | m_axisLinePen.setWidth(1); |
|
121 | 121 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
122 | 122 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
123 | 123 | m_gridLinePen.setWidth(1); |
|
124 | 124 | m_backgroundShades = BackgroundShadesNone; |
|
125 | 125 | |
|
126 | 126 | #elif defined(Q_OS_MAC) |
|
127 | 127 | // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors |
|
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 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
133 | 133 | |
|
134 | 134 | // Background |
|
135 | 135 | QLinearGradient backgroundGradient; |
|
136 | 136 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
137 | 137 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
138 | 138 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
139 | 139 | m_chartBackgroundGradient = backgroundGradient; |
|
140 | 140 | |
|
141 | 141 | // Axes and other |
|
142 | 142 | m_axisLinePen = QPen(0xd6d6d6); |
|
143 | 143 | m_axisLinePen.setWidth(1); |
|
144 | 144 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
145 | 145 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
146 | 146 | m_gridLinePen.setWidth(1); |
|
147 | 147 | m_backgroundShades = BackgroundShadesNone; |
|
148 | 148 | |
|
149 | 149 | #else |
|
150 | 150 | // Hard coded theme |
|
151 | 151 | m_seriesColors << QRgb(0x60a6e6); |
|
152 | 152 | m_seriesColors << QRgb(0x92ca66); |
|
153 | 153 | m_seriesColors << QRgb(0xeba85f); |
|
154 | 154 | m_seriesColors << QRgb(0xfc5751); |
|
155 | 155 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
156 | 156 | |
|
157 | 157 | // Background |
|
158 | 158 | QLinearGradient backgroundGradient; |
|
159 | 159 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
160 | 160 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
161 | 161 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
162 | 162 | m_chartBackgroundGradient = backgroundGradient; |
|
163 | 163 | |
|
164 | 164 | // Axes and other |
|
165 | 165 | m_axisLinePen = QPen(0xd6d6d6); |
|
166 | 166 | m_axisLinePen.setWidth(1); |
|
167 | 167 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
168 | 168 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
169 | 169 | m_gridLinePen.setWidth(1); |
|
170 | 170 | m_backgroundShades = BackgroundShadesNone; |
|
171 | 171 | #endif |
|
172 | 172 | } |
|
173 | 173 | }; |
|
174 | 174 | |
|
175 | 175 | QTCOMMERCIALCHART_END_NAMESPACE |
|
176 | 176 | |
|
177 | 177 | #endif // CHARTTHEMESYSTEM_P_H |
General Comments 0
You need to be logged in to leave comments.
Login now