Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: xfa/src/fwl/theme/checkboxtp.cpp

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/src/fwl/theme/carettp.cpp ('k') | xfa/src/fwl/theme/comboboxtp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/checkboxtp.h"
8
9 #include "xfa/include/fwl/basewidget/fwl_checkbox.h"
10 #include "xfa/include/fwl/core/fwl_widget.h"
11 #include "xfa/src/fde/tto/fde_textout.h"
12
13 #define CHECKBOX_SIZE_SIGNMARGIN 3
14 #define CHECKBOX_SIZE_SIGNBORDER 2
15 #define CHECKBOX_SIZE_SIGNPATH 100
16 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153))
17 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100))
18 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226))
19 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255))
20 #define CHECKBOX_FXGE_CoordinatesAdjust
21
22 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) {
23 m_pThemeData = new CKBThemeData;
24 SetThemeData(0);
25 }
26 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
27 if (m_pThemeData) {
28 delete m_pThemeData;
29 m_pThemeData = NULL;
30 }
31 if (m_pCheckPath) {
32 m_pCheckPath->Clear();
33 delete m_pCheckPath;
34 m_pCheckPath = NULL;
35 }
36 }
37 FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
38 return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox;
39 }
40 FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget,
41 FX_DWORD dwThemeID,
42 FX_BOOL bChildren) {
43 if (m_pThemeData) {
44 SetThemeData(FWL_GetThemeColor(dwThemeID));
45 }
46 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
47 }
48 FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
49 if (!m_pTextOut)
50 return FALSE;
51 m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) ==
52 FWL_PARTSTATE_CKB_Disabled
53 ? FWLTHEME_CAPACITY_TextDisColor
54 : FWLTHEME_CAPACITY_TextColor);
55 return CFWL_WidgetTP::DrawText(pParams);
56 }
57 FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
58 if (!pParams)
59 return FALSE;
60 switch (pParams->m_iPart) {
61 case FWL_PART_CKB_Border: {
62 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
63 break;
64 }
65 case FWL_PART_CKB_Edge: {
66 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
67 &pParams->m_rtPart, &pParams->m_matrix);
68 break;
69 }
70 case FWL_PART_CKB_Background: {
71 FillBackground(pParams->m_pGraphics, &pParams->m_rtPart,
72 &pParams->m_matrix);
73 if (pParams->m_dwStates & FWL_PARTSTATE_CKB_Focused) {
74 pParams->m_rtPart = *(CFX_RectF*)pParams->m_pData;
75 DrawFocus(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
76 }
77 break;
78 }
79 case FWL_PART_CKB_CheckBox: {
80 DrawBoxBk(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
81 pParams->m_dwStates, &pParams->m_matrix);
82 if (((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) ==
83 FWL_PARTSTATE_CKB_Checked) |
84 ((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) ==
85 FWL_PARTSTATE_CKB_Neutral)) {
86 DrawSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
87 pParams->m_dwStates, &pParams->m_matrix);
88 }
89 FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) ==
90 FWL_PARTSTATE_CKB_Disabled;
91 DrawSignBorder(pParams->m_pWidget, pParams->m_pGraphics,
92 &pParams->m_rtPart, bDisable, &pParams->m_matrix);
93 break;
94 }
95 default: { return FALSE; }
96 }
97 return TRUE;
98 }
99 FWL_ERR CFWL_CheckBoxTP::Initialize() {
100 InitTTO();
101 return CFWL_WidgetTP::Initialize();
102 }
103 FWL_ERR CFWL_CheckBoxTP::Finalize() {
104 FinalizeTTO();
105 return CFWL_WidgetTP::Finalize();
106 }
107 void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget,
108 CFX_Graphics* pGraphics,
109 const CFX_RectF* pRect,
110 FX_DWORD dwStates,
111 CFX_Matrix* pMatrix) {
112 dwStates &= 0x03;
113 int32_t fillMode = FXFILL_WINDING;
114 FX_DWORD dwStyleEx = pWidget->GetStylesEx();
115 dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask;
116 CFX_Path path;
117 path.Create();
118 FX_FLOAT fRight = pRect->right();
119 FX_FLOAT fBottom = pRect->bottom();
120 FX_BOOL bClipSign =
121 (dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered;
122 if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) ||
123 (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) {
124 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
125 if (bClipSign) {
126 fillMode = FXFILL_ALTERNATE;
127 path.AddRectangle(pRect->left + CHECKBOX_SIZE_SIGNMARGIN,
128 pRect->top + CHECKBOX_SIZE_SIGNMARGIN,
129 pRect->width - CHECKBOX_SIZE_SIGNMARGIN * 2,
130 pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2);
131 }
132 } else {
133 #ifdef CHECKBOX_FXGE_CoordinatesAdjust
134 CFX_RectF rect(*pRect);
135 rect.Deflate(0, 0, 1, 1);
136 path.AddEllipse(rect);
137 #else
138 path.AddEllipse(*pRect);
139 #endif
140 if (bClipSign) {
141 fillMode = FXFILL_ALTERNATE;
142 #ifdef CHECKBOX_FXGE_CoordinatesAdjust
143 CFX_RectF rtClip(rect);
144 #else
145 CFX_RectF rtClip(*pRect);
146 #endif
147 rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1,
148 CHECKBOX_SIZE_SIGNMARGIN - 1);
149 path.AddEllipse(rtClip);
150 }
151 }
152 int32_t iTheme = 1;
153 if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) {
154 iTheme = 2;
155 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) ==
156 FWL_PARTSTATE_CKB_Pressed) {
157 iTheme = 3;
158 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) ==
159 FWL_PARTSTATE_CKB_Disabled) {
160 iTheme = 4;
161 }
162 if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked) {
163 iTheme += 4;
164 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) ==
165 FWL_PARTSTATE_CKB_Neutral) {
166 iTheme += 8;
167 }
168 DrawAxialShading(pGraphics, pRect->left - 1, pRect->top - 1, fRight, fBottom,
169 m_pThemeData->clrBoxBk[iTheme][0],
170 m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix);
171 }
172 void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget,
173 CFX_Graphics* pGraphics,
174 const CFX_RectF* pRtBox,
175 FX_DWORD dwStates,
176 CFX_Matrix* pMatrix) {
177 CFX_RectF rtSign(*pRtBox);
178 rtSign.Deflate(CHECKBOX_SIZE_SIGNMARGIN, CHECKBOX_SIZE_SIGNMARGIN);
179 FX_DWORD dwColor = m_pThemeData->clrSignCheck;
180 FX_BOOL bCheck = TRUE;
181 if (((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Disabled) &&
182 ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked)) {
183 dwColor = m_pThemeData->clrSignBorderDisable;
184 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) ==
185 FWL_PARTSTATE_CKB_Neutral) {
186 switch (dwStates & FWL_PARTSTATE_CKB_Mask1) {
187 case FWL_PARTSTATE_CKB_Normal: {
188 bCheck = FALSE;
189 dwColor = m_pThemeData->clrSignNeutralNormal;
190 break;
191 }
192 case FWL_PARTSTATE_CKB_Hovered: {
193 bCheck = FALSE;
194 dwColor = m_pThemeData->clrSignNeutralHover;
195 break;
196 }
197 case FWL_PARTSTATE_CKB_Pressed: {
198 bCheck = FALSE, dwColor = m_pThemeData->clrSignNeutralPressed;
199 break;
200 }
201 case FWL_PARTSTATE_CKB_Disabled: {
202 bCheck = FALSE, dwColor = m_pThemeData->clrSignBorderDisable;
203 break;
204 }
205 }
206 }
207 if (bCheck) {
208 FX_DWORD dwStyle = pWidget->GetStylesEx();
209 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) {
210 case FWL_STYLEEXT_CKB_SignShapeCheck: {
211 DrawSignCheck(pGraphics, &rtSign, dwColor, pMatrix);
212 break;
213 }
214 case FWL_STYLEEXT_CKB_SignShapeCircle: {
215 rtSign.Deflate(1, 1);
216 DrawSignCircle(pGraphics, &rtSign, dwColor, pMatrix);
217 break;
218 }
219 case FWL_STYLEEXT_CKB_SignShapeCross: {
220 DrawSignCross(pGraphics, &rtSign, dwColor, pMatrix);
221 break;
222 }
223 case FWL_STYLEEXT_CKB_SignShapeDiamond: {
224 DrawSignDiamond(pGraphics, &rtSign, dwColor, pMatrix);
225 break;
226 }
227 case FWL_STYLEEXT_CKB_SignShapeSquare: {
228 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix);
229 break;
230 }
231 case FWL_STYLEEXT_CKB_SignShapeStar: {
232 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix);
233 break;
234 }
235 }
236 } else {
237 FillSoildRect(pGraphics, ArgbEncode(255, 33, 161, 33), &rtSign, pMatrix);
238 }
239 }
240 void CFWL_CheckBoxTP::DrawSignNeutral(CFX_Graphics* pGraphics,
241 const CFX_RectF* pRtSign,
242 CFX_Matrix* pMatrix) {
243 ((CFX_RectF*)pRtSign)->Inflate(-3, -3);
244 FillSoildRect(pGraphics, m_pThemeData->clrSignNeutral, pRtSign, pMatrix);
245 }
246 void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics,
247 const CFX_RectF* pRtSign,
248 FX_ARGB argbFill,
249 CFX_Matrix* pMatrix) {
250 if (!m_pCheckPath) {
251 initCheckPath(pRtSign->width);
252 }
253 CFX_Matrix mt;
254 mt.SetIdentity();
255 mt.Translate(pRtSign->left, pRtSign->top);
256 mt.Concat(*pMatrix);
257 CFX_Color crFill(argbFill);
258 pGraphics->SaveGraphState();
259 pGraphics->SetFillColor(&crFill);
260 pGraphics->FillPath(m_pCheckPath, FXFILL_WINDING, &mt);
261 pGraphics->RestoreGraphState();
262 }
263 void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics,
264 const CFX_RectF* pRtSign,
265 FX_ARGB argbFill,
266 CFX_Matrix* pMatrix) {
267 CFX_Path path;
268 path.Create();
269 path.AddEllipse(*pRtSign);
270 CFX_Color crFill(argbFill);
271 pGraphics->SaveGraphState();
272 pGraphics->SetFillColor(&crFill);
273 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
274 pGraphics->RestoreGraphState();
275 }
276 void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
277 const CFX_RectF* pRtSign,
278 FX_ARGB argbFill,
279 CFX_Matrix* pMatrix) {
280 CFX_Path path;
281 path.Create();
282 FX_FLOAT fRight = pRtSign->right();
283 FX_FLOAT fBottom = pRtSign->bottom();
284 path.AddLine(pRtSign->left, pRtSign->top, fRight, fBottom);
285 path.AddLine(pRtSign->left, fBottom, fRight, pRtSign->top);
286 CFX_Color crFill(argbFill);
287 pGraphics->SaveGraphState();
288 pGraphics->SetStrokeColor(&crFill);
289 pGraphics->SetLineWidth(1.0f);
290 pGraphics->StrokePath(&path, pMatrix);
291 pGraphics->RestoreGraphState();
292 }
293 void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics,
294 const CFX_RectF* pRtSign,
295 FX_ARGB argbFill,
296 CFX_Matrix* pMatrix) {
297 CFX_Path path;
298 path.Create();
299 FX_FLOAT fWidth = pRtSign->width;
300 FX_FLOAT fHeight = pRtSign->height;
301 FX_FLOAT fBottom = pRtSign->bottom();
302 path.MoveTo(pRtSign->left + fWidth / 2, pRtSign->top);
303 path.LineTo(pRtSign->left, pRtSign->top + fHeight / 2);
304 path.LineTo(pRtSign->left + fWidth / 2, fBottom);
305 path.LineTo(pRtSign->right(), pRtSign->top + fHeight / 2);
306 path.LineTo(pRtSign->left + fWidth / 2, pRtSign->top);
307 CFX_Color crFill(argbFill);
308 pGraphics->SaveGraphState();
309 pGraphics->SetFillColor(&crFill);
310 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
311 pGraphics->RestoreGraphState();
312 }
313 void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics,
314 const CFX_RectF* pRtSign,
315 FX_ARGB argbFill,
316 CFX_Matrix* pMatrix) {
317 CFX_Path path;
318 path.Create();
319 path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width,
320 pRtSign->height);
321 CFX_Color crFill(argbFill);
322 pGraphics->SaveGraphState();
323 pGraphics->SetFillColor(&crFill);
324 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
325 pGraphics->RestoreGraphState();
326 }
327 void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
328 const CFX_RectF* pRtSign,
329 FX_ARGB argbFill,
330 CFX_Matrix* pMatrix) {
331 CFX_Path path;
332 path.Create();
333 FX_FLOAT fBottom = pRtSign->bottom();
334 FX_FLOAT fRadius =
335 (pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
336 CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f,
337 (pRtSign->top + fBottom) / 2.0f);
338 FX_FLOAT px[5], py[5];
339 FX_FLOAT fAngel = FX_PI / 10.0f;
340 for (int32_t i = 0; i < 5; i++) {
341 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);
342 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);
343 fAngel += FX_PI * 2 / 5.0f;
344 }
345 path.MoveTo(px[0], py[0]);
346 int32_t nNext = 0;
347 for (int32_t j = 0; j < 5; j++) {
348 nNext += 2;
349 if (nNext >= 5) {
350 nNext -= 5;
351 }
352 path.LineTo(px[nNext], py[nNext]);
353 }
354 CFX_Color crFill(argbFill);
355 pGraphics->SaveGraphState();
356 pGraphics->SetFillColor(&crFill);
357 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
358 pGraphics->RestoreGraphState();
359 }
360 void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget,
361 CFX_Graphics* pGraphics,
362 const CFX_RectF* pRtBox,
363 FX_BOOL bDisable,
364 CFX_Matrix* pMatrix) {
365 switch (pWidget->GetStylesEx() & FWL_STYLEEXT_CKB_ShapeMask) {
366 case FWL_STYLEEXT_CKB_ShapeSolidSquare: {
367 DrawAnnulusRect(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable
368 : m_pThemeData->clrSignBorderNormal,
369 pRtBox, 1, pMatrix);
370 break;
371 }
372 case FWL_STYLEEXT_CKB_ShapeSunkenSquare: {
373 Draw3DRect(pGraphics, FWLTHEME_EDGE_Sunken, CHECKBOX_SIZE_SIGNBORDER,
374 pRtBox, CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2,
375 CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix);
376 break;
377 }
378 case FWL_STYLEEXT_CKB_ShapeSolidCircle: {
379 DrawAnnulusCircle(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable
380 : m_pThemeData->clrSignBorderNormal,
381 pRtBox, 1, pMatrix);
382 break;
383 }
384 case FWL_STYLEEXT_CKB_ShapeSunkenCircle: {
385 Draw3DCircle(pGraphics, FWLTHEME_EDGE_Sunken, CHECKBOX_SIZE_SIGNBORDER,
386 pRtBox, CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2,
387 CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix);
388 break;
389 }
390 }
391 }
392 void CFWL_CheckBoxTP::SetThemeData(FX_DWORD dwID) {
393 FX_DWORD* pData = (FX_DWORD*)&m_pThemeData->clrBoxBk;
394 if (dwID) {
395 *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215),
396 *pData++ = ArgbEncode(255, 255, 255, 255),
397 *pData++ = ArgbEncode(255, 255, 240, 207),
398 *pData++ = ArgbEncode(255, 248, 179, 48),
399 *pData++ = ArgbEncode(255, 176, 176, 167),
400 *pData++ = ArgbEncode(255, 241, 239, 239),
401 *pData++ = ArgbEncode(255, 255, 255, 255),
402 *pData++ = ArgbEncode(255, 255, 255, 255),
403 *pData++ = ArgbEncode(255, 220, 220, 215),
404 *pData++ = ArgbEncode(255, 255, 255, 255),
405 *pData++ = ArgbEncode(255, 255, 240, 207),
406 *pData++ = ArgbEncode(255, 248, 179, 48),
407 *pData++ = ArgbEncode(255, 176, 176, 167),
408 *pData++ = ArgbEncode(255, 241, 239, 239),
409 *pData++ = ArgbEncode(255, 255, 255, 255),
410 *pData++ = ArgbEncode(255, 255, 255, 255),
411 *pData++ = ArgbEncode(255, 220, 220, 215),
412 *pData++ = ArgbEncode(255, 255, 255, 255),
413 *pData++ = ArgbEncode(255, 255, 240, 207),
414 *pData++ = ArgbEncode(255, 248, 179, 48),
415 *pData++ = ArgbEncode(255, 176, 176, 167),
416 *pData++ = ArgbEncode(255, 241, 239, 239),
417 *pData++ = ArgbEncode(255, 255, 255, 255),
418 *pData++ = ArgbEncode(255, 255, 255, 255);
419 m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 154, 167, 114);
420 m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187);
421 m_pThemeData->clrSignCheck = ArgbEncode(255, 164, 180, 138);
422 m_pThemeData->clrSignNeutral = ArgbEncode(2255, 28, 134, 26);
423 m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113);
424 m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33);
425 m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26);
426 } else {
427 *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215),
428 *pData++ = ArgbEncode(255, 255, 255, 255),
429 *pData++ = ArgbEncode(255, 255, 240, 207),
430 *pData++ = ArgbEncode(255, 248, 179, 48),
431 *pData++ = ArgbEncode(255, 176, 176, 167),
432 *pData++ = ArgbEncode(255, 241, 239, 239),
433 *pData++ = ArgbEncode(255, 255, 255, 255),
434 *pData++ = ArgbEncode(255, 255, 255, 255),
435 *pData++ = ArgbEncode(255, 220, 220, 215),
436 *pData++ = ArgbEncode(255, 255, 255, 255),
437 *pData++ = ArgbEncode(255, 255, 240, 207),
438 *pData++ = ArgbEncode(255, 248, 179, 48),
439 *pData++ = ArgbEncode(255, 176, 176, 167),
440 *pData++ = ArgbEncode(255, 241, 239, 239),
441 *pData++ = ArgbEncode(255, 255, 255, 255),
442 *pData++ = ArgbEncode(255, 255, 255, 255),
443 *pData++ = ArgbEncode(255, 220, 220, 215),
444 *pData++ = ArgbEncode(255, 255, 255, 255),
445 *pData++ = ArgbEncode(255, 255, 240, 207),
446 *pData++ = ArgbEncode(255, 248, 179, 48),
447 *pData++ = ArgbEncode(255, 176, 176, 167),
448 *pData++ = ArgbEncode(255, 241, 239, 239),
449 *pData++ = ArgbEncode(255, 255, 255, 255),
450 *pData++ = ArgbEncode(255, 255, 255, 255);
451 m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 28, 81, 128);
452 m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187);
453 m_pThemeData->clrSignCheck = ArgbEncode(255, 28, 81, 128);
454 m_pThemeData->clrSignNeutral = ArgbEncode(255, 28, 134, 26);
455 m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113);
456 m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33);
457 m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26);
458 }
459 }
460 void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) {
461 if (!m_pCheckPath) {
462 m_pCheckPath = new CFX_Path;
463 m_pCheckPath->Create();
464 FX_FLOAT fWidth = CHECKBOX_SIZE_SIGNPATH;
465 FX_FLOAT fHeight = -CHECKBOX_SIZE_SIGNPATH;
466 FX_FLOAT fBottom = CHECKBOX_SIZE_SIGNPATH;
467 CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
468 CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
469 CFX_PointF pt3(fWidth / 3.0f, fBottom);
470 CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
471 CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
472 CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
473 CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
474 CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
475 CFX_PointF pt32(fWidth / 4.0f, fBottom);
476 CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
477 fBottom + fHeight * 4 / 5.0f);
478 CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
479 fBottom + fHeight * 4 / 5.0f);
480 CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
481 CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
482 CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
483 CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
484 m_pCheckPath->MoveTo(pt1.x, pt1.y);
485 FX_FLOAT px1 = pt12.x - pt1.x;
486 FX_FLOAT py1 = pt12.y - pt1.y;
487 FX_FLOAT px2 = pt21.x - pt2.x;
488 FX_FLOAT py2 = pt21.y - pt2.y;
489 m_pCheckPath->BezierTo(pt1.x + px1 * FWLTHEME_BEZIER,
490 pt1.y + py1 * FWLTHEME_BEZIER,
491 pt2.x + px2 * FWLTHEME_BEZIER,
492 pt2.y + py2 * FWLTHEME_BEZIER, pt2.x, pt2.y);
493 px1 = pt23.x - pt2.x;
494 py1 = pt23.y - pt2.y;
495 px2 = pt32.x - pt3.x;
496 py2 = pt32.y - pt3.y;
497 m_pCheckPath->BezierTo(pt2.x + px1 * FWLTHEME_BEZIER,
498 pt2.y + py1 * FWLTHEME_BEZIER,
499 pt3.x + px2 * FWLTHEME_BEZIER,
500 pt3.y + py2 * FWLTHEME_BEZIER, pt3.x, pt3.y);
501 px1 = pt34.x - pt3.x;
502 py1 = pt34.y - pt3.y;
503 px2 = pt43.x - pt4.x;
504 py2 = pt43.y - pt4.y;
505 m_pCheckPath->BezierTo(pt3.x + px1 * FWLTHEME_BEZIER,
506 pt3.y + py1 * FWLTHEME_BEZIER,
507 pt4.x + px2 * FWLTHEME_BEZIER,
508 pt4.y + py2 * FWLTHEME_BEZIER, pt4.x, pt4.y);
509 px1 = pt45.x - pt4.x;
510 py1 = pt45.y - pt4.y;
511 px2 = pt54.x - pt5.x;
512 py2 = pt54.y - pt5.y;
513 m_pCheckPath->BezierTo(pt4.x + px1 * FWLTHEME_BEZIER,
514 pt4.y + py1 * FWLTHEME_BEZIER,
515 pt5.x + px2 * FWLTHEME_BEZIER,
516 pt5.y + py2 * FWLTHEME_BEZIER, pt5.x, pt5.y);
517 px1 = pt51.x - pt5.x;
518 py1 = pt51.y - pt5.y;
519 px2 = pt15.x - pt1.x;
520 py2 = pt15.y - pt1.y;
521 m_pCheckPath->BezierTo(pt5.x + px1 * FWLTHEME_BEZIER,
522 pt5.y + py1 * FWLTHEME_BEZIER,
523 pt1.x + px2 * FWLTHEME_BEZIER,
524 pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y);
525 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH;
526 CFX_Matrix mt;
527 mt.Set(1, 0, 0, 1, 0, 0);
528 mt.Scale(fScale, fScale);
529 CFX_PathData* pData = m_pCheckPath->GetPathData();
530 pData->Transform(&mt);
531 }
532 }
OLDNEW
« no previous file with comments | « xfa/src/fwl/theme/carettp.cpp ('k') | xfa/src/fwl/theme/comboboxtp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698