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