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