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