OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/include/fwl/theme/formtp.h" | |
8 | |
9 #include "xfa/include/fwl/core/fwl_form.h" | |
10 #include "xfa/include/fwl/core/fwl_widget.h" | |
11 #include "xfa/src/fde/tto/fde_textout.h" | |
12 | |
13 #define FWLTHEME_CAPACITY_CXFormBorder 3 | |
14 #define FWLTHEME_CAPACITY_CYFormBorder 3 | |
15 #define FWLTHEME_CAPACITY_CYNarrowCaption 18 | |
16 #define FWLTHEME_CAPACITY_CYCaption 29 | |
17 #define FWLTHEME_CAPACITY_BigIconSize 32 | |
18 #define FWLTHEME_CAPACITY_SmallIconSize 16 | |
19 #define FWLTHEME_CAPACITY_FormTextColor 0xFFFFFFFF | |
20 #define FWLTHEME_FORMBTN_Margin 5 | |
21 #define FWLTHEME_FORMBTN_Span 2 | |
22 #define FWLTHEME_FORMBTN_Size 21 | |
23 | |
24 CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { | |
25 m_pThemeData = new SBThemeData; | |
26 SetThemeData(0); | |
27 m_rtDisLBorder.Reset(); | |
28 m_rtDisRBorder.Reset(); | |
29 m_rtDisBBorder.Reset(); | |
30 m_rtDisCaption.Reset(); | |
31 } | |
32 CFWL_FormTP::~CFWL_FormTP() { | |
33 if (m_pThemeData) { | |
34 delete m_pThemeData; | |
35 m_pThemeData = NULL; | |
36 } | |
37 } | |
38 FWL_ERR CFWL_FormTP::Initialize() { | |
39 InitTTO(); | |
40 InitCaption(TRUE); | |
41 InitCaption(FALSE); | |
42 return CFWL_WidgetTP::Initialize(); | |
43 } | |
44 FWL_ERR CFWL_FormTP::Finalize() { | |
45 FinalizeTTO(); | |
46 if (m_pActiveBitmap) { | |
47 delete m_pActiveBitmap; | |
48 m_pActiveBitmap = NULL; | |
49 } | |
50 if (m_pDeactivebitmap) { | |
51 delete m_pDeactivebitmap; | |
52 m_pDeactivebitmap = NULL; | |
53 } | |
54 return CFWL_WidgetTP::Finalize(); | |
55 } | |
56 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { | |
57 if (!pWidget) | |
58 return FALSE; | |
59 FX_DWORD dwHash = pWidget->GetClassID(); | |
60 return dwHash == FWL_CLASSHASH_Form; | |
61 } | |
62 FX_DWORD CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, | |
63 FX_DWORD dwThemeID, | |
64 FX_BOOL bChildren) { | |
65 if (m_pThemeData) { | |
66 SetThemeData(FWL_GetThemeColor(dwThemeID)); | |
67 } | |
68 InitCaption(TRUE); | |
69 InitCaption(FALSE); | |
70 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); | |
71 } | |
72 FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { | |
73 if (!pParams) | |
74 return FALSE; | |
75 int32_t iActive = 0; | |
76 if (pParams->m_dwStates & FWL_PARTSTATE_FRM_Inactive) { | |
77 iActive = 1; | |
78 } | |
79 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | |
80 switch (pParams->m_dwStates & 0x03) { | |
81 case FWL_PARTSTATE_FRM_Hover: { | |
82 eState = FWLTHEME_STATE_Hover; | |
83 break; | |
84 } | |
85 case FWL_PARTSTATE_FRM_Pressed: { | |
86 eState = FWLTHEME_STATE_Pressed; | |
87 break; | |
88 } | |
89 case FWL_PARTSTATE_FRM_Disabled: { | |
90 eState = FWLTHEME_STATE_Disabale; | |
91 break; | |
92 } | |
93 default: {} | |
94 } | |
95 switch (pParams->m_iPart) { | |
96 case FWL_PART_FRM_Border: { | |
97 DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
98 &pParams->m_matrix, iActive); | |
99 break; | |
100 } | |
101 case FWL_PART_FRM_Edge: { | |
102 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), | |
103 &pParams->m_rtPart, &pParams->m_matrix); | |
104 break; | |
105 } | |
106 case FWL_PART_FRM_Background: { | |
107 FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, | |
108 &pParams->m_matrix); | |
109 break; | |
110 } | |
111 case FWL_PART_FRM_Caption: { | |
112 DrawCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
113 &pParams->m_matrix, iActive); | |
114 break; | |
115 } | |
116 case FWL_PART_FRM_NarrowCaption: { | |
117 DrawNarrowCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
118 &pParams->m_matrix, iActive); | |
119 break; | |
120 } | |
121 case FWL_PART_FRM_CloseBox: { | |
122 DrawCloseBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
123 &pParams->m_matrix, iActive); | |
124 break; | |
125 } | |
126 case FWL_PART_FRM_MinimizeBox: { | |
127 DrawMinimizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
128 &pParams->m_matrix, iActive); | |
129 break; | |
130 } | |
131 case FWL_PART_FRM_MaximizeBox: { | |
132 DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, | |
133 pParams->m_dwData, &pParams->m_matrix, iActive); | |
134 break; | |
135 } | |
136 case FWL_PART_FRM_Icon: { | |
137 DrawIconImage(pParams->m_pGraphics, pParams->m_pImage, &pParams->m_rtPart, | |
138 eState, &pParams->m_matrix, iActive); | |
139 break; | |
140 } | |
141 default: {} | |
142 } | |
143 return TRUE; | |
144 } | |
145 FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) { | |
146 if (!m_pTextOut) | |
147 return FALSE; | |
148 if (pParams->m_iPart == FWL_PART_FRM_Caption) { | |
149 m_pTextOut->SetTextColor(0xFFFFFFFF); | |
150 } else { | |
151 m_pTextOut->SetTextColor(0xFF000000); | |
152 } | |
153 return CFWL_WidgetTP::DrawText(pParams); | |
154 } | |
155 void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, | |
156 FX_DWORD dwCapacity) { | |
157 FX_BOOL bDefPro = FALSE; | |
158 FX_BOOL bDwordVal = FALSE; | |
159 switch (dwCapacity) { | |
160 case FWL_WGTCAPACITY_CXBorder: { | |
161 m_fValue = FWLTHEME_CAPACITY_CXFormBorder; | |
162 break; | |
163 } | |
164 case FWL_WGTCAPACITY_CYBorder: { | |
165 m_fValue = FWLTHEME_CAPACITY_CYFormBorder; | |
166 break; | |
167 } | |
168 case FWL_WGTCAPACITY_FRM_CYCaption: { | |
169 m_fValue = FWLTHEME_CAPACITY_CYCaption; | |
170 break; | |
171 } | |
172 case FWL_WGTCAPACITY_FRM_CYNarrowCaption: { | |
173 m_fValue = FWLTHEME_CAPACITY_CYCaption; | |
174 break; | |
175 } | |
176 case FWL_WGTCAPACITY_TextColor: { | |
177 bDwordVal = TRUE; | |
178 m_dwValue = FWLTHEME_CAPACITY_FormTextColor; | |
179 break; | |
180 } | |
181 case FWL_WGTCAPACITY_FRM_BigIcon: { | |
182 m_fValue = FWLTHEME_CAPACITY_BigIconSize; | |
183 break; | |
184 } | |
185 case FWL_WGTCAPACITY_FRM_SmallIcon: { | |
186 m_fValue = FWLTHEME_CAPACITY_SmallIconSize; | |
187 break; | |
188 } | |
189 default: { bDefPro = TRUE; } | |
190 } | |
191 if (!bDefPro) { | |
192 if (bDwordVal) { | |
193 return &m_dwValue; | |
194 } | |
195 return &m_fValue; | |
196 } | |
197 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | |
198 } | |
199 FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, | |
200 CFX_RectF& rtPart) { | |
201 switch (pThemePart->m_iPart) { | |
202 case FWL_PART_FRM_CloseBox: { | |
203 CalCloseBox(pThemePart->m_pWidget, rtPart); | |
204 break; | |
205 } | |
206 case FWL_PART_FRM_MaximizeBox: { | |
207 CalMaxBox(pThemePart->m_pWidget, rtPart); | |
208 break; | |
209 } | |
210 case FWL_PART_FRM_MinimizeBox: { | |
211 CalMinBox(pThemePart->m_pWidget, rtPart); | |
212 break; | |
213 } | |
214 case FWL_PART_FRM_HeadText: { | |
215 CalCaption(pThemePart->m_pWidget, rtPart); | |
216 break; | |
217 } | |
218 case FWL_PART_FRM_Icon: { | |
219 CalIcon(pThemePart->m_pWidget, rtPart); | |
220 break; | |
221 } | |
222 default: {} | |
223 } | |
224 return FWL_ERR_Succeeded; | |
225 } | |
226 void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { | |
227 FX_DWORD dwStyles = pWidget->GetStyles(); | |
228 CFX_RectF rtWidget; | |
229 pWidget->GetWidgetRect(rtWidget); | |
230 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | |
231 if (dwStyles & FWL_WGTSTYLE_CloseBox) { | |
232 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, | |
233 rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, | |
234 FWLTHEME_FORMBTN_Size); | |
235 } else { | |
236 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, | |
237 rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); | |
238 } | |
239 } | |
240 void CFWL_FormTP::CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect) { | |
241 FX_DWORD dwStyles = pWidget->GetStyles(); | |
242 CFX_RectF rtWidget; | |
243 pWidget->GetWidgetRect(rtWidget); | |
244 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | |
245 if (dwStyles & FWL_WGTSTYLE_MaximizeBox) { | |
246 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Size + | |
247 FWLTHEME_FORMBTN_Span * 2, | |
248 rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, | |
249 FWLTHEME_FORMBTN_Size); | |
250 } else { | |
251 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Size + | |
252 FWLTHEME_FORMBTN_Span * 2, | |
253 rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); | |
254 } | |
255 } | |
256 void CFWL_FormTP::CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect) { | |
257 FX_DWORD dwStyles = pWidget->GetStyles(); | |
258 CFX_RectF rtWidget; | |
259 pWidget->GetWidgetRect(rtWidget); | |
260 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | |
261 if (dwStyles & FWL_WGTSTYLE_MinimizeBox) { | |
262 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + | |
263 FWLTHEME_FORMBTN_Size * 2 + FWLTHEME_FORMBTN_Span * 3, | |
264 rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, | |
265 FWLTHEME_FORMBTN_Size); | |
266 } else { | |
267 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + | |
268 FWLTHEME_FORMBTN_Size * 2 + FWLTHEME_FORMBTN_Span * 3, | |
269 rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); | |
270 } | |
271 } | |
272 void CFWL_FormTP::CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect) { | |
273 CFX_RectF rtWidget; | |
274 pWidget->GetWidgetRect(rtWidget); | |
275 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | |
276 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin, | |
277 rtWidget.top + FWLTHEME_FORMBTN_Margin - 2, | |
278 rtWidget.width - FWLTHEME_FORMBTN_Margin * 2, | |
279 FWLTHEME_FORMBTN_Size + 2 * FWLTHEME_FORMBTN_Margin + 4); | |
280 } | |
281 void CFWL_FormTP::CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect) {} | |
282 void CFWL_FormTP::DrawFormBorder(CFX_Graphics* pGraphics, | |
283 const CFX_RectF* pRect, | |
284 FWLTHEME_STATE eState, | |
285 CFX_Matrix* pMatrix, | |
286 int32_t iActive) { | |
287 CFX_RectF rt; | |
288 rt.Set(pRect->left, pRect->top, 1, pRect->height); | |
289 FX_FLOAT fBottom, fRight; | |
290 fBottom = pRect->bottom(); | |
291 fRight = pRect->right(); | |
292 CFX_Path path; | |
293 path.Create(); | |
294 CFX_Color clrLine; | |
295 path.Clear(); | |
296 path.MoveTo(pRect->left, pRect->top); | |
297 path.LineTo(pRect->left, fBottom - 1); | |
298 path.LineTo(fRight - 1, fBottom - 1); | |
299 path.LineTo(fRight - 1, pRect->top); | |
300 clrLine = m_pThemeData->clrFormBorder[iActive][2]; | |
301 pGraphics->SetStrokeColor(&clrLine); | |
302 pGraphics->StrokePath(&path, pMatrix); | |
303 path.Clear(); | |
304 path.MoveTo(pRect->left + 1, pRect->top); | |
305 path.LineTo(pRect->left + 1, fBottom - 2); | |
306 path.LineTo(fRight - 2, fBottom - 2); | |
307 path.LineTo(fRight - 2, pRect->top); | |
308 clrLine = m_pThemeData->clrFormBorder[iActive][1]; | |
309 pGraphics->SetStrokeColor(&clrLine); | |
310 pGraphics->StrokePath(&path, pMatrix); | |
311 path.Clear(); | |
312 path.MoveTo(pRect->left + 2, pRect->top); | |
313 path.LineTo(pRect->left + 2, fBottom - 3); | |
314 path.LineTo(fRight - 3, fBottom - 3); | |
315 path.LineTo(fRight - 3, pRect->top); | |
316 clrLine = m_pThemeData->clrFormBorder[iActive][0]; | |
317 pGraphics->SetStrokeColor(&clrLine); | |
318 pGraphics->StrokePath(&path, pMatrix); | |
319 path.Clear(); | |
320 path.MoveTo(pRect->left + 3, pRect->top); | |
321 path.LineTo(pRect->left + 3, fBottom - 4); | |
322 path.LineTo(fRight - 4, fBottom - 4); | |
323 path.LineTo(fRight - 4, pRect->top); | |
324 clrLine = m_pThemeData->clrFormBorder[iActive][4]; | |
325 pGraphics->SetStrokeColor(&clrLine); | |
326 pGraphics->StrokePath(&path, pMatrix); | |
327 m_rtDisLBorder.Set(pRect->left, pRect->top + 29, 4, pRect->height - 29); | |
328 m_rtDisRBorder.Set(pRect->right() - 4, pRect->top + 29, 4, | |
329 pRect->height - 29); | |
330 m_rtDisBBorder.Set(pRect->left, pRect->bottom() - 4, pRect->width, 4); | |
331 m_rtDisCaption.Set(pRect->left, pRect->top, pRect->width, 29); | |
332 } | |
333 void CFWL_FormTP::DrawCaption(CFX_Graphics* pGraphics, | |
334 const CFX_RectF* pRect, | |
335 FWLTHEME_STATE eState, | |
336 CFX_Matrix* pMatrix, | |
337 int32_t iActive) { | |
338 CFX_RectF rt; | |
339 FX_FLOAT fBottom, fRight; | |
340 fBottom = pRect->bottom(); | |
341 fRight = pRect->right(); | |
342 rt.Set(pRect->left, pRect->top, pRect->width, 1); | |
343 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][0], &rt, | |
344 pMatrix); | |
345 rt.Offset(0, 1); | |
346 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][1], &rt, | |
347 pMatrix); | |
348 rt.Offset(0, 1); | |
349 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][2], &rt, | |
350 pMatrix); | |
351 rt.Set(pRect->left, pRect->bottom() - 1, pRect->width, 1); | |
352 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][2], &rt, | |
353 pMatrix); | |
354 rt.Offset(0, -1); | |
355 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][1], &rt, | |
356 pMatrix); | |
357 rt.Set(pRect->left, pRect->top, 1, pRect->height); | |
358 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][2], &rt, | |
359 pMatrix); | |
360 rt.Set(pRect->left + 1, pRect->top + 1, 1, fBottom - 1); | |
361 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][1], &rt, | |
362 pMatrix); | |
363 rt.Set(pRect->left + 2, pRect->top + 2, 1, fBottom - 2); | |
364 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][0], &rt, | |
365 pMatrix); | |
366 rt.Set(fRight - 1, pRect->top, pRect->width, pRect->height); | |
367 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][2], &rt, | |
368 pMatrix); | |
369 rt.Set(fRight - 2, pRect->top + 1, 1, fBottom - 1); | |
370 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][1], &rt, | |
371 pMatrix); | |
372 rt.Set(fRight - 3, pRect->top + 2, 1, fBottom - 2); | |
373 FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][0], &rt, | |
374 pMatrix); | |
375 CFX_RectF rect(*pRect); | |
376 rect.Set(rect.left + 3, rect.top + 3, rect.width - 6, rect.height - 5); | |
377 if (iActive == 0) { | |
378 pGraphics->StretchImage(m_pActiveBitmap, rect, pMatrix); | |
379 } else { | |
380 pGraphics->StretchImage(m_pDeactivebitmap, rect, pMatrix); | |
381 } | |
382 } | |
383 void CFWL_FormTP::DrawNarrowCaption(CFX_Graphics* pGraphics, | |
384 const CFX_RectF* pRect, | |
385 FWLTHEME_STATE eState, | |
386 CFX_Matrix* pMatrix, | |
387 int32_t iActive) {} | |
388 void CFWL_FormTP::DrawCloseBox(CFX_Graphics* pGraphics, | |
389 const CFX_RectF* pRect, | |
390 FWLTHEME_STATE eState, | |
391 CFX_Matrix* pMatrix, | |
392 int32_t iActive) { | |
393 FX_FLOAT fRight = pRect->right(); | |
394 FX_FLOAT fBottom = pRect->bottom(); | |
395 FX_FLOAT fWidth = pRect->width; | |
396 FX_FLOAT fHeight = pRect->height; | |
397 pGraphics->SaveGraphState(); | |
398 CFX_RectF rt(*pRect); | |
399 pGraphics->SetLineWidth(1.0f); | |
400 CFX_Path path; | |
401 path.Create(); | |
402 path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); | |
403 path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); | |
404 path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); | |
405 path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); | |
406 CFX_Color crFill; | |
407 crFill = m_pThemeData->clrBtnEdgeOut[iActive]; | |
408 pGraphics->SetFillColor(&crFill); | |
409 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
410 path.Clear(); | |
411 path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); | |
412 path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); | |
413 path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); | |
414 path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); | |
415 crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; | |
416 pGraphics->SetFillColor(&crFill); | |
417 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
418 path.Clear(); | |
419 path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); | |
420 path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); | |
421 crFill = m_pThemeData->clrCloseBtEdgeLight[iActive][eState - 1]; | |
422 pGraphics->SetFillColor(&crFill); | |
423 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
424 path.Clear(); | |
425 path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); | |
426 path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); | |
427 crFill = m_pThemeData->clrCloseBtEdgeDark[iActive][eState - 1]; | |
428 pGraphics->SetFillColor(&crFill); | |
429 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
430 path.Clear(); | |
431 path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); | |
432 DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, | |
433 fBottom - 2, | |
434 m_pThemeData->clrCloseBtBKStart[iActive][eState - 1], | |
435 m_pThemeData->clrCloseBtBKEnd[iActive][eState - 1], &path, | |
436 FXFILL_WINDING, pMatrix); | |
437 CFX_RectF rtX(*pRect); | |
438 rtX.Inflate(-5, -5); | |
439 path.Clear(); | |
440 FX_FLOAT frtXRight = rtX.right(); | |
441 FX_FLOAT frtXBottom = rtX.bottom(); | |
442 path.AddLine(rtX.left, rtX.top + 1, frtXRight - 1, frtXBottom); | |
443 path.AddLine(rtX.left, rtX.top, frtXRight, frtXBottom); | |
444 path.AddLine(rtX.left + 1, rtX.top, frtXRight, frtXBottom - 1); | |
445 path.AddLine(rtX.left, frtXBottom - 1, frtXRight - 1, rtX.top); | |
446 path.AddLine(rtX.left, frtXBottom, frtXRight, rtX.top); | |
447 path.AddLine(rtX.left + 1, frtXBottom, frtXRight, rtX.top + 1); | |
448 CFX_Color clrLine(0xffffffff); | |
449 pGraphics->SetLineWidth(1.0f); | |
450 pGraphics->SetStrokeColor(&clrLine); | |
451 pGraphics->StrokePath(&path, pMatrix); | |
452 pGraphics->RestoreGraphState(); | |
453 } | |
454 void CFWL_FormTP::DrawMinMaxBoxCommon(CFX_Graphics* pGraphics, | |
455 const CFX_RectF* pRect, | |
456 FWLTHEME_STATE eState, | |
457 CFX_Matrix* pMatrix, | |
458 int32_t iActive) { | |
459 pGraphics->SaveGraphState(); | |
460 FX_FLOAT fRight = pRect->right(); | |
461 FX_FLOAT fBottom = pRect->bottom(); | |
462 FX_FLOAT fWidth = pRect->width; | |
463 FX_FLOAT fHeight = pRect->height; | |
464 CFX_RectF rt(*pRect); | |
465 pGraphics->SetLineWidth(1.0f); | |
466 CFX_Path path; | |
467 path.Create(); | |
468 path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); | |
469 path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); | |
470 path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); | |
471 path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); | |
472 CFX_Color crFill; | |
473 crFill = m_pThemeData->clrBtnEdgeOut[iActive]; | |
474 pGraphics->SetFillColor(&crFill); | |
475 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
476 path.Clear(); | |
477 path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); | |
478 path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); | |
479 path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); | |
480 path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); | |
481 crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; | |
482 pGraphics->SetFillColor(&crFill); | |
483 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
484 path.Clear(); | |
485 path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); | |
486 path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); | |
487 crFill = m_pThemeData->clrNormalBtEdgeLight[iActive][eState - 1]; | |
488 pGraphics->SetFillColor(&crFill); | |
489 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
490 path.Clear(); | |
491 path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); | |
492 path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); | |
493 crFill = m_pThemeData->clrNormalBtEdgeDark[iActive][eState - 1]; | |
494 pGraphics->SetFillColor(&crFill); | |
495 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
496 pGraphics->RestoreGraphState(); | |
497 path.Clear(); | |
498 path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); | |
499 DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, | |
500 fBottom - 2, | |
501 m_pThemeData->clrNormalBtBKStart[iActive][eState - 1], | |
502 m_pThemeData->clrNormalBtBKEnd[iActive][eState - 1], &path, | |
503 FXFILL_WINDING, pMatrix); | |
504 } | |
505 void CFWL_FormTP::DrawMinimizeBox(CFX_Graphics* pGraphics, | |
506 const CFX_RectF* pRect, | |
507 FWLTHEME_STATE eState, | |
508 CFX_Matrix* pMatrix, | |
509 int32_t iActive) { | |
510 DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); | |
511 CFX_RectF rtMin; | |
512 rtMin.Set(pRect->left + 5, pRect->top + 13, pRect->width - 14, | |
513 pRect->height - 18); | |
514 FillSoildRect(pGraphics, 0xFFFFFFFF, &rtMin, pMatrix); | |
515 } | |
516 void CFWL_FormTP::DrawMaximizeBox(CFX_Graphics* pGraphics, | |
517 const CFX_RectF* pRect, | |
518 FWLTHEME_STATE eState, | |
519 FX_BOOL bMax, | |
520 CFX_Matrix* pMatrix, | |
521 int32_t iActive) { | |
522 DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); | |
523 FX_FLOAT fWidth = pRect->width; | |
524 FX_FLOAT fHeight = pRect->height; | |
525 if (bMax) { | |
526 CFX_Path path; | |
527 path.Create(); | |
528 path.AddLine(pRect->left + 7, pRect->top + 6, pRect->left + 14, | |
529 pRect->top + 6); | |
530 path.AddLine(pRect->left + 4, pRect->top + 9, pRect->left + 11, | |
531 pRect->top + 9); | |
532 pGraphics->SaveGraphState(); | |
533 pGraphics->SetLineWidth(2); | |
534 CFX_Color crStroke(0xFFFFFFFF); | |
535 pGraphics->SetStrokeColor(&crStroke); | |
536 pGraphics->StrokePath(&path, pMatrix); | |
537 pGraphics->SetLineWidth(1); | |
538 path.Clear(); | |
539 path.AddLine(pRect->left + 4, pRect->top + 10, pRect->left + 4, | |
540 pRect->top + 14); | |
541 path.AddLine(pRect->left + 10, pRect->top + 10, pRect->left + 10, | |
542 pRect->top + 14); | |
543 path.AddLine(pRect->left + 13, pRect->top + 7, pRect->left + 13, | |
544 pRect->top + 11); | |
545 path.AddLine(pRect->left + 4, pRect->top + 14, pRect->left + 10, | |
546 pRect->top + 14); | |
547 path.AddLine(pRect->left + 12, pRect->top + 11, pRect->left + 12, | |
548 pRect->top + 11); | |
549 pGraphics->StrokePath(&path, pMatrix); | |
550 pGraphics->RestoreGraphState(); | |
551 } else { | |
552 CFX_RectF rtMax(*pRect); | |
553 rtMax.Inflate(-5, -5); | |
554 CFX_Path path; | |
555 path.Create(); | |
556 path.AddRectangle(pRect->left + 5, pRect->top + 5, fWidth - 10, | |
557 fHeight - 10); | |
558 path.AddRectangle(pRect->left + 6, pRect->top + 8, fWidth - 12, | |
559 fHeight - 14); | |
560 pGraphics->SaveGraphState(); | |
561 CFX_Color crFill(0xFFFFFFFF); | |
562 pGraphics->SetFillColor(&crFill); | |
563 pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); | |
564 pGraphics->RestoreGraphState(); | |
565 } | |
566 } | |
567 void CFWL_FormTP::DrawIconImage(CFX_Graphics* pGraphics, | |
568 CFX_DIBitmap* pDIBitmap, | |
569 const CFX_RectF* pRect, | |
570 FWLTHEME_STATE eState, | |
571 CFX_Matrix* pMatrix, | |
572 int32_t iActive) { | |
573 pGraphics->StretchImage(pDIBitmap, *pRect, pMatrix); | |
574 } | |
575 void CFWL_FormTP::SetThemeData(FX_DWORD dwID) { | |
576 m_pThemeData->clrTransWhite = ArgbEncode(0x65, 255, 255, 255); | |
577 m_pThemeData->clrCloseBtBKStart[0][0] = ArgbEncode(0xff, 240, 166, 148); | |
578 m_pThemeData->clrCloseBtBKEnd[0][0] = ArgbEncode(0xff, 228, 61, 5); | |
579 m_pThemeData->clrCloseBtBKStart[0][1] = ArgbEncode(0xff, 255, 184, 176); | |
580 m_pThemeData->clrCloseBtBKEnd[0][1] = ArgbEncode(0xff, 252, 107, 71); | |
581 m_pThemeData->clrCloseBtBKStart[0][2] = ArgbEncode(0xff, 141, 44, 20); | |
582 m_pThemeData->clrCloseBtBKEnd[0][2] = ArgbEncode(0xff, 202, 72, 33); | |
583 m_pThemeData->clrCloseBtEdgeLight[0][0] = ArgbEncode(0xff, 255, 122, 107); | |
584 m_pThemeData->clrCloseBtEdgeDark[0][0] = ArgbEncode(0xff, 218, 77, 54); | |
585 m_pThemeData->clrCloseBtEdgeLight[0][1] = ArgbEncode(0xff, 255, 93, 74); | |
586 m_pThemeData->clrCloseBtEdgeDark[0][1] = ArgbEncode(0xff, 218, 74, 51); | |
587 m_pThemeData->clrCloseBtEdgeLight[0][2] = ArgbEncode(0xff, 191, 61, 28); | |
588 m_pThemeData->clrCloseBtEdgeDark[0][2] = ArgbEncode(0xff, 93, 30, 13); | |
589 if (dwID) { | |
590 m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 194, 205, 149); | |
591 m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 170, 184, 131); | |
592 m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 168, 182, 128); | |
593 m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 194, 205, 149); | |
594 m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 117, 141, 94); | |
595 m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 139, 161, 105); | |
596 m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 171, 189, 133); | |
597 m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 155, 175, 125); | |
598 m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 128, 146, 103); | |
599 m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 94, 118, 79); | |
600 m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 139, 161, 105); | |
601 m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 234, 245, 201); | |
602 m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 194, 205, 149); | |
603 m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 175, 189, 133); | |
604 m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 153, 168, 121); | |
605 m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 150, 168, 103); | |
606 m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 182, 195, 162); | |
607 m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 128, 144, 84); | |
608 m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 234, 241, 208); | |
609 m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 169, 186, 112); | |
610 m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 199, 199, 190); | |
611 m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 133, 148, 88); | |
612 m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 163, 176, 137); | |
613 m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 118, 135, 83); | |
614 m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 154, 174, 105); | |
615 m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 154, 174, 105); | |
616 m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 172, 193, 123); | |
617 m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 154, 174, 105); | |
618 m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); | |
619 m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); | |
620 m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); | |
621 m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); | |
622 m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 117, 141, 94); | |
623 m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 139, 161, 105); | |
624 m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 171, 189, 133); | |
625 m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 164, 178, 127); | |
626 m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); | |
627 m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 171, 189, 133); | |
628 } else { | |
629 m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 3, 114, 255); | |
630 m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 0, 85, 226); | |
631 m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 0, 85, 226); | |
632 m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 3, 114, 255); | |
633 m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 0, 32, 200); | |
634 m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 0, 61, 220); | |
635 m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 0, 54, 210); | |
636 m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 0, 56, 234); | |
637 m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 0, 50, 193); | |
638 m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 0, 19, 139); | |
639 m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 0, 88, 238); | |
640 m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 63, 151, 255); | |
641 m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 3, 114, 255); | |
642 m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 0, 96, 252); | |
643 m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 63, 151, 255); | |
644 m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 0, 67, 207); | |
645 m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 0, 49, 112); | |
646 m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 0, 87, 188); | |
647 m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 154, 183, 250); | |
648 m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 17, 110, 248); | |
649 m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 164, 194, 255); | |
650 m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 29, 158, 255); | |
651 m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 68, 120, 245); | |
652 m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 24, 72, 187); | |
653 m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 72, 122, 245); | |
654 m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 35, 87, 195); | |
655 m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 60, 114, 244); | |
656 m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 21, 70, 185); | |
657 m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); | |
658 m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); | |
659 m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); | |
660 m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); | |
661 m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 0, 72, 241); | |
662 m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 0, 61, 220); | |
663 m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 0, 30, 160); | |
664 m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 0, 19, 140); | |
665 m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); | |
666 m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 22, 106, 239); | |
667 } | |
668 m_pThemeData->clrCloseBtBKStart[1][0] = m_pThemeData->clrCloseBtBKStart[0][0]; | |
669 m_pThemeData->clrCloseBtBKEnd[1][0] = m_pThemeData->clrCloseBtBKEnd[0][0]; | |
670 m_pThemeData->clrCloseBtBKStart[1][1] = m_pThemeData->clrCloseBtBKStart[0][1]; | |
671 m_pThemeData->clrCloseBtBKEnd[1][1] = m_pThemeData->clrCloseBtBKEnd[0][1]; | |
672 m_pThemeData->clrCloseBtBKStart[1][2] = m_pThemeData->clrCloseBtBKStart[0][2]; | |
673 m_pThemeData->clrCloseBtBKEnd[1][2] = m_pThemeData->clrCloseBtBKEnd[0][2]; | |
674 m_pThemeData->clrCloseBtEdgeLight[1][0] = | |
675 m_pThemeData->clrCloseBtEdgeLight[0][0]; | |
676 m_pThemeData->clrCloseBtEdgeDark[1][0] = | |
677 m_pThemeData->clrCloseBtEdgeDark[0][0]; | |
678 m_pThemeData->clrCloseBtEdgeLight[1][1] = | |
679 m_pThemeData->clrCloseBtEdgeLight[0][1]; | |
680 m_pThemeData->clrCloseBtEdgeDark[1][1] = | |
681 m_pThemeData->clrCloseBtEdgeDark[0][1]; | |
682 m_pThemeData->clrCloseBtEdgeLight[1][2] = | |
683 m_pThemeData->clrCloseBtEdgeLight[0][2]; | |
684 m_pThemeData->clrCloseBtEdgeDark[1][2] = | |
685 m_pThemeData->clrCloseBtEdgeDark[0][2]; | |
686 m_pThemeData->clrHeadBK[1][0] = m_pThemeData->clrHeadBK[0][0]; | |
687 m_pThemeData->clrHeadBK[1][1] = m_pThemeData->clrHeadBK[0][1]; | |
688 m_pThemeData->clrHeadBK[1][2] = m_pThemeData->clrHeadBK[0][2]; | |
689 m_pThemeData->clrHeadBK[1][3] = m_pThemeData->clrHeadBK[0][3]; | |
690 m_pThemeData->clrHeadEdgeLeft[1][2] = m_pThemeData->clrHeadEdgeLeft[0][2]; | |
691 m_pThemeData->clrHeadEdgeLeft[1][1] = m_pThemeData->clrHeadEdgeLeft[0][1]; | |
692 m_pThemeData->clrHeadEdgeLeft[1][0] = m_pThemeData->clrHeadEdgeLeft[0][0]; | |
693 m_pThemeData->clrHeadEdgeRight[1][0] = m_pThemeData->clrHeadEdgeRight[0][0]; | |
694 m_pThemeData->clrHeadEdgeRight[1][1] = m_pThemeData->clrHeadEdgeRight[0][1]; | |
695 m_pThemeData->clrHeadEdgeRight[1][2] = m_pThemeData->clrHeadEdgeRight[0][2]; | |
696 m_pThemeData->clrHeadEdgeTop[1][0] = m_pThemeData->clrHeadEdgeTop[0][0]; | |
697 m_pThemeData->clrHeadEdgeTop[1][1] = m_pThemeData->clrHeadEdgeTop[0][1]; | |
698 m_pThemeData->clrHeadEdgeTop[1][2] = m_pThemeData->clrHeadEdgeTop[0][2]; | |
699 m_pThemeData->clrHeadEdgeBottom[1][0] = m_pThemeData->clrHeadEdgeBottom[0][0]; | |
700 m_pThemeData->clrHeadEdgeBottom[1][1] = m_pThemeData->clrHeadEdgeBottom[0][1]; | |
701 m_pThemeData->clrHeadEdgeBottom[1][2] = m_pThemeData->clrHeadEdgeBottom[0][2]; | |
702 m_pThemeData->clrNormalBtBKStart[1][2] = | |
703 m_pThemeData->clrNormalBtBKStart[0][2]; | |
704 m_pThemeData->clrNormalBtBKEnd[1][2] = m_pThemeData->clrNormalBtBKEnd[0][2]; | |
705 m_pThemeData->clrNormalBtBKStart[1][0] = | |
706 m_pThemeData->clrNormalBtBKStart[0][0]; | |
707 m_pThemeData->clrNormalBtBKEnd[1][0] = m_pThemeData->clrNormalBtBKEnd[1][0]; | |
708 m_pThemeData->clrNormalBtBKStart[1][1] = | |
709 m_pThemeData->clrNormalBtBKStart[0][1]; | |
710 m_pThemeData->clrNormalBtBKEnd[1][1] = m_pThemeData->clrNormalBtBKEnd[0][1]; | |
711 m_pThemeData->clrNormalBtEdgeLight[1][0] = | |
712 m_pThemeData->clrNormalBtEdgeLight[0][0]; | |
713 m_pThemeData->clrNormalBtEdgeDark[1][0] = | |
714 m_pThemeData->clrNormalBtEdgeDark[0][0]; | |
715 m_pThemeData->clrNormalBtEdgeLight[1][1] = | |
716 m_pThemeData->clrNormalBtEdgeLight[0][1]; | |
717 m_pThemeData->clrNormalBtEdgeDark[1][1] = | |
718 m_pThemeData->clrNormalBtEdgeDark[0][1]; | |
719 m_pThemeData->clrNormalBtEdgeLight[1][2] = | |
720 m_pThemeData->clrNormalBtEdgeLight[0][2]; | |
721 m_pThemeData->clrNormalBtEdgeDark[1][2] = | |
722 m_pThemeData->clrNormalBtEdgeDark[0][2]; | |
723 m_pThemeData->clrBtnCornerLight[1][0] = m_pThemeData->clrBtnCornerLight[0][0]; | |
724 m_pThemeData->clrBtnCornerLight[1][1] = m_pThemeData->clrBtnCornerLight[0][1]; | |
725 m_pThemeData->clrBtnCornerLight[1][2] = m_pThemeData->clrBtnCornerLight[0][2]; | |
726 m_pThemeData->clrBtnEdgeOut[1] = m_pThemeData->clrBtnEdgeOut[0]; | |
727 m_pThemeData->clrFormBorder[1][0] = m_pThemeData->clrFormBorder[0][0]; | |
728 m_pThemeData->clrFormBorder[1][1] = m_pThemeData->clrFormBorder[0][1]; | |
729 m_pThemeData->clrFormBorder[1][2] = m_pThemeData->clrFormBorder[0][2]; | |
730 m_pThemeData->clrFormBorder[1][3] = m_pThemeData->clrFormBorder[0][3]; | |
731 m_pThemeData->clrFormBorder[1][4] = m_pThemeData->clrFormBorder[0][4]; | |
732 m_pThemeData->clrFormBorderLight[1] = m_pThemeData->clrFormBorderLight[0]; | |
733 DeactiveForm(); | |
734 } | |
735 void CFWL_FormTP::DeactiveForm() { | |
736 TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][0]); | |
737 TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][1]); | |
738 TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][2]); | |
739 TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][3]); | |
740 TransModeColor(m_pThemeData->clrTransWhite, | |
741 m_pThemeData->clrHeadEdgeLeft[1][0]); | |
742 TransModeColor(m_pThemeData->clrTransWhite, | |
743 m_pThemeData->clrHeadEdgeLeft[1][1]); | |
744 TransModeColor(m_pThemeData->clrTransWhite, | |
745 m_pThemeData->clrHeadEdgeLeft[1][2]); | |
746 TransModeColor(m_pThemeData->clrTransWhite, | |
747 m_pThemeData->clrHeadEdgeRight[1][0]); | |
748 TransModeColor(m_pThemeData->clrTransWhite, | |
749 m_pThemeData->clrHeadEdgeRight[1][1]); | |
750 TransModeColor(m_pThemeData->clrTransWhite, | |
751 m_pThemeData->clrHeadEdgeRight[1][2]); | |
752 TransModeColor(m_pThemeData->clrTransWhite, | |
753 m_pThemeData->clrHeadEdgeTop[1][0]); | |
754 TransModeColor(m_pThemeData->clrTransWhite, | |
755 m_pThemeData->clrHeadEdgeTop[1][1]); | |
756 TransModeColor(m_pThemeData->clrTransWhite, | |
757 m_pThemeData->clrHeadEdgeTop[1][2]); | |
758 TransModeColor(m_pThemeData->clrTransWhite, | |
759 m_pThemeData->clrHeadEdgeBottom[1][0]); | |
760 TransModeColor(m_pThemeData->clrTransWhite, | |
761 m_pThemeData->clrHeadEdgeBottom[1][1]); | |
762 TransModeColor(m_pThemeData->clrTransWhite, | |
763 m_pThemeData->clrHeadEdgeBottom[1][2]); | |
764 TransModeColor(m_pThemeData->clrTransWhite, | |
765 m_pThemeData->clrNormalBtBKStart[1][0]); | |
766 TransModeColor(m_pThemeData->clrTransWhite, | |
767 m_pThemeData->clrNormalBtBKStart[1][1]); | |
768 TransModeColor(m_pThemeData->clrTransWhite, | |
769 m_pThemeData->clrNormalBtBKStart[1][2]); | |
770 TransModeColor(m_pThemeData->clrTransWhite, | |
771 m_pThemeData->clrNormalBtBKEnd[1][0]); | |
772 TransModeColor(m_pThemeData->clrTransWhite, | |
773 m_pThemeData->clrNormalBtBKEnd[1][1]); | |
774 TransModeColor(m_pThemeData->clrTransWhite, | |
775 m_pThemeData->clrNormalBtBKEnd[1][2]); | |
776 TransModeColor(m_pThemeData->clrTransWhite, | |
777 m_pThemeData->clrNormalBtEdgeLight[1][0]); | |
778 TransModeColor(m_pThemeData->clrTransWhite, | |
779 m_pThemeData->clrNormalBtEdgeLight[1][1]); | |
780 TransModeColor(m_pThemeData->clrTransWhite, | |
781 m_pThemeData->clrNormalBtEdgeLight[1][2]); | |
782 TransModeColor(m_pThemeData->clrTransWhite, | |
783 m_pThemeData->clrNormalBtEdgeDark[1][0]); | |
784 TransModeColor(m_pThemeData->clrTransWhite, | |
785 m_pThemeData->clrNormalBtEdgeDark[1][1]); | |
786 TransModeColor(m_pThemeData->clrTransWhite, | |
787 m_pThemeData->clrNormalBtEdgeDark[1][2]); | |
788 TransModeColor(m_pThemeData->clrTransWhite, | |
789 m_pThemeData->clrBtnCornerLight[1][0]); | |
790 TransModeColor(m_pThemeData->clrTransWhite, | |
791 m_pThemeData->clrBtnCornerLight[1][1]); | |
792 TransModeColor(m_pThemeData->clrTransWhite, | |
793 m_pThemeData->clrBtnCornerLight[1][2]); | |
794 TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrBtnEdgeOut[1]); | |
795 TransModeColor(m_pThemeData->clrTransWhite, | |
796 m_pThemeData->clrFormBorder[1][0]); | |
797 TransModeColor(m_pThemeData->clrTransWhite, | |
798 m_pThemeData->clrFormBorder[1][1]); | |
799 TransModeColor(m_pThemeData->clrTransWhite, | |
800 m_pThemeData->clrFormBorder[1][2]); | |
801 TransModeColor(m_pThemeData->clrTransWhite, | |
802 m_pThemeData->clrFormBorder[1][3]); | |
803 TransModeColor(m_pThemeData->clrTransWhite, | |
804 m_pThemeData->clrFormBorder[1][4]); | |
805 TransModeColor(m_pThemeData->clrTransWhite, | |
806 m_pThemeData->clrFormBorderLight[1]); | |
807 TransModeColor(m_pThemeData->clrTransWhite, | |
808 m_pThemeData->clrCloseBtBKStart[1][0]); | |
809 TransModeColor(m_pThemeData->clrTransWhite, | |
810 m_pThemeData->clrCloseBtBKStart[1][1]); | |
811 TransModeColor(m_pThemeData->clrTransWhite, | |
812 m_pThemeData->clrCloseBtBKStart[1][2]); | |
813 TransModeColor(m_pThemeData->clrTransWhite, | |
814 m_pThemeData->clrCloseBtBKEnd[1][0]); | |
815 TransModeColor(m_pThemeData->clrTransWhite, | |
816 m_pThemeData->clrCloseBtBKEnd[1][1]); | |
817 TransModeColor(m_pThemeData->clrTransWhite, | |
818 m_pThemeData->clrCloseBtBKEnd[1][2]); | |
819 TransModeColor(m_pThemeData->clrTransWhite, | |
820 m_pThemeData->clrCloseBtEdgeLight[1][0]); | |
821 TransModeColor(m_pThemeData->clrTransWhite, | |
822 m_pThemeData->clrCloseBtEdgeLight[1][1]); | |
823 TransModeColor(m_pThemeData->clrTransWhite, | |
824 m_pThemeData->clrCloseBtEdgeLight[1][2]); | |
825 TransModeColor(m_pThemeData->clrTransWhite, | |
826 m_pThemeData->clrCloseBtEdgeDark[1][0]); | |
827 TransModeColor(m_pThemeData->clrTransWhite, | |
828 m_pThemeData->clrCloseBtEdgeDark[1][1]); | |
829 TransModeColor(m_pThemeData->clrTransWhite, | |
830 m_pThemeData->clrCloseBtEdgeDark[1][2]); | |
831 } | |
832 void CFWL_FormTP::TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack) { | |
833 int32_t iAlfaF, iRF, iGF, iBF; | |
834 int32_t iAlfaB, iRB, iGB, iBB; | |
835 ArgbDecode(clrFore, iAlfaF, iRF, iGF, iBF); | |
836 ArgbDecode(clrBack, iAlfaB, iRB, iGB, iBB); | |
837 clrBack = ArgbEncode(0xff, iRB + (iRF - iRB) * iAlfaF / 255, | |
838 iGB + (iGF - iGB) * iAlfaF / 255, | |
839 iBB + (iBF - iBB) * iAlfaF / 255); | |
840 } | |
841 void CFWL_FormTP::InitCaption(FX_BOOL bActive) { | |
842 if (bActive) { | |
843 CFX_FxgeDevice dev; | |
844 CFX_Graphics gs; | |
845 CFX_Path path; | |
846 path.Create(); | |
847 if (m_pActiveBitmap) { | |
848 delete m_pActiveBitmap; | |
849 m_pActiveBitmap = NULL; | |
850 } | |
851 m_pActiveBitmap = new CFX_DIBitmap; | |
852 m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); | |
853 dev.Attach(m_pActiveBitmap); | |
854 gs.Create(&dev); | |
855 path.AddRectangle(0, 0, 1, 5); | |
856 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0], | |
857 m_pThemeData->clrHeadBK[0][1], &path); | |
858 path.Clear(); | |
859 path.AddRectangle(0, 5, 1, 15); | |
860 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1], | |
861 m_pThemeData->clrHeadBK[0][2], &path); | |
862 path.Clear(); | |
863 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); | |
864 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, | |
865 m_pThemeData->clrHeadBK[0][2], | |
866 m_pThemeData->clrHeadBK[0][3], &path); | |
867 } else { | |
868 CFX_FxgeDevice dev; | |
869 CFX_Graphics gs; | |
870 CFX_Path path; | |
871 path.Create(); | |
872 if (m_pDeactivebitmap) { | |
873 delete m_pDeactivebitmap; | |
874 m_pDeactivebitmap = NULL; | |
875 } | |
876 m_pDeactivebitmap = new CFX_DIBitmap; | |
877 m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); | |
878 dev.Attach(m_pDeactivebitmap); | |
879 gs.Create(&dev); | |
880 path.AddRectangle(0, 0, 1, 5); | |
881 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0], | |
882 m_pThemeData->clrHeadBK[1][1], &path); | |
883 path.Clear(); | |
884 path.AddRectangle(0, 5, 1, 15); | |
885 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], | |
886 m_pThemeData->clrHeadBK[1][2], &path); | |
887 path.Clear(); | |
888 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); | |
889 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, | |
890 m_pThemeData->clrHeadBK[1][2], | |
891 m_pThemeData->clrHeadBK[1][3], &path); | |
892 } | |
893 } | |
OLD | NEW |