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