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

Side by Side Diff: xfa/fwl/theme/cfwl_checkboxtp.cpp

Issue 2230813002: Use smart pointers for class owned pointers in xfa/fwl/theme (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 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/fwl/theme/cfwl_checkboxtp.h ('k') | xfa/fwl/theme/cfwl_datetimepickertp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/theme/cfwl_checkboxtp.h" 7 #include "xfa/fwl/theme/cfwl_checkboxtp.h"
8 8
9 #include "core/fxge/include/cfx_pathdata.h" 9 #include "core/fxge/include/cfx_pathdata.h"
10 #include "xfa/fde/tto/fde_textout.h" 10 #include "xfa/fde/tto/fde_textout.h"
(...skipping 10 matching lines...) Expand all
21 const int kSignBorder = 2; 21 const int kSignBorder = 2;
22 const int kSignPath = 100; 22 const int kSignPath = 100;
23 23
24 } // namespace 24 } // namespace
25 25
26 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) 26 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153))
27 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) 27 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100))
28 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) 28 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226))
29 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) 29 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255))
30 30
31 CFWL_CheckBoxTP::CFWL_CheckBoxTP() 31 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pThemeData(new CKBThemeData) {
32 : m_pThemeData(new CKBThemeData), m_pCheckPath(nullptr) {
33 SetThemeData(0); 32 SetThemeData(0);
34 } 33 }
35 34
36 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { 35 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
37 delete m_pThemeData; 36 if (m_pCheckPath)
38 if (m_pCheckPath) {
39 m_pCheckPath->Clear(); 37 m_pCheckPath->Clear();
40 delete m_pCheckPath;
41 }
42 } 38 }
43 39
44 bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { 40 bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
45 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; 41 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox;
46 } 42 }
47 43
48 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, 44 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget,
49 uint32_t dwThemeID, 45 uint32_t dwThemeID,
50 FX_BOOL bChildren) { 46 FX_BOOL bChildren) {
51 if (m_pThemeData) { 47 if (m_pThemeData)
52 SetThemeData(FWL_GetThemeColor(dwThemeID)); 48 SetThemeData(FWL_GetThemeColor(dwThemeID));
53 }
54 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); 49 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
55 } 50 }
51
56 FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { 52 FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
57 if (!m_pTextOut) 53 if (!m_pTextOut)
58 return FALSE; 54 return FALSE;
59 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled 55 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled
60 ? FWLTHEME_CAPACITY_TextDisColor 56 ? FWLTHEME_CAPACITY_TextDisColor
61 : FWLTHEME_CAPACITY_TextColor); 57 : FWLTHEME_CAPACITY_TextColor);
62 return CFWL_WidgetTP::DrawText(pParams); 58 return CFWL_WidgetTP::DrawText(pParams);
63 } 59 }
60
64 FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { 61 FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
65 if (!pParams) 62 if (!pParams)
66 return FALSE; 63 return FALSE;
67 switch (pParams->m_iPart) { 64 switch (pParams->m_iPart) {
68 case CFWL_Part::Border: { 65 case CFWL_Part::Border: {
69 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); 66 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
70 break; 67 break;
71 } 68 }
72 case CFWL_Part::Edge: { 69 case CFWL_Part::Edge: {
73 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), 70 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
(...skipping 19 matching lines...) Expand all
93 } 90 }
94 DrawSignBorder( 91 DrawSignBorder(
95 pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, 92 pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
96 pParams->m_dwStates & CFWL_PartState_Disabled, &pParams->m_matrix); 93 pParams->m_dwStates & CFWL_PartState_Disabled, &pParams->m_matrix);
97 break; 94 break;
98 } 95 }
99 default: { return FALSE; } 96 default: { return FALSE; }
100 } 97 }
101 return TRUE; 98 return TRUE;
102 } 99 }
100
103 FWL_Error CFWL_CheckBoxTP::Initialize() { 101 FWL_Error CFWL_CheckBoxTP::Initialize() {
104 InitTTO(); 102 InitTTO();
105 return CFWL_WidgetTP::Initialize(); 103 return CFWL_WidgetTP::Initialize();
106 } 104 }
105
107 FWL_Error CFWL_CheckBoxTP::Finalize() { 106 FWL_Error CFWL_CheckBoxTP::Finalize() {
108 FinalizeTTO(); 107 FinalizeTTO();
109 return CFWL_WidgetTP::Finalize(); 108 return CFWL_WidgetTP::Finalize();
110 } 109 }
110
111 void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, 111 void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget,
112 CFX_Graphics* pGraphics, 112 CFX_Graphics* pGraphics,
113 const CFX_RectF* pRect, 113 const CFX_RectF* pRect,
114 uint32_t dwStates, 114 uint32_t dwStates,
115 CFX_Matrix* pMatrix) { 115 CFX_Matrix* pMatrix) {
116 dwStates &= 0x03; 116 dwStates &= 0x03;
117 int32_t fillMode = FXFILL_WINDING; 117 int32_t fillMode = FXFILL_WINDING;
118 uint32_t dwStyleEx = pWidget->GetStylesEx(); 118 uint32_t dwStyleEx = pWidget->GetStylesEx();
119 dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask; 119 dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask;
120 CFX_Path path; 120 CFX_Path path;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 if (dwStates & CFWL_PartState_Checked) { 153 if (dwStates & CFWL_PartState_Checked) {
154 iTheme += 4; 154 iTheme += 4;
155 } else if (dwStates & CFWL_PartState_Neutral) { 155 } else if (dwStates & CFWL_PartState_Neutral) {
156 iTheme += 8; 156 iTheme += 8;
157 } 157 }
158 DrawAxialShading(pGraphics, pRect->left - 1, pRect->top - 1, fRight, fBottom, 158 DrawAxialShading(pGraphics, pRect->left - 1, pRect->top - 1, fRight, fBottom,
159 m_pThemeData->clrBoxBk[iTheme][0], 159 m_pThemeData->clrBoxBk[iTheme][0],
160 m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix); 160 m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix);
161 } 161 }
162
162 void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget, 163 void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget,
163 CFX_Graphics* pGraphics, 164 CFX_Graphics* pGraphics,
164 const CFX_RectF* pRtBox, 165 const CFX_RectF* pRtBox,
165 uint32_t dwStates, 166 uint32_t dwStates,
166 CFX_Matrix* pMatrix) { 167 CFX_Matrix* pMatrix) {
167 CFX_RectF rtSign(*pRtBox); 168 CFX_RectF rtSign(*pRtBox);
168 rtSign.Deflate(kSignMargin, kSignMargin); 169 rtSign.Deflate(kSignMargin, kSignMargin);
169 uint32_t dwColor = m_pThemeData->clrSignCheck; 170 uint32_t dwColor = m_pThemeData->clrSignCheck;
170 bool bCheck = true; 171 bool bCheck = true;
171 if ((dwStates & CFWL_PartState_Disabled) && 172 if ((dwStates & CFWL_PartState_Disabled) &&
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 210 }
210 case FWL_STYLEEXT_CKB_SignShapeStar: { 211 case FWL_STYLEEXT_CKB_SignShapeStar: {
211 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); 212 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix);
212 break; 213 break;
213 } 214 }
214 } 215 }
215 } else { 216 } else {
216 FillSoildRect(pGraphics, ArgbEncode(255, 33, 161, 33), &rtSign, pMatrix); 217 FillSoildRect(pGraphics, ArgbEncode(255, 33, 161, 33), &rtSign, pMatrix);
217 } 218 }
218 } 219 }
220
219 void CFWL_CheckBoxTP::DrawSignNeutral(CFX_Graphics* pGraphics, 221 void CFWL_CheckBoxTP::DrawSignNeutral(CFX_Graphics* pGraphics,
220 const CFX_RectF* pRtSign, 222 const CFX_RectF* pRtSign,
221 CFX_Matrix* pMatrix) { 223 CFX_Matrix* pMatrix) {
222 ((CFX_RectF*)pRtSign)->Inflate(-3, -3); 224 ((CFX_RectF*)pRtSign)->Inflate(-3, -3);
223 FillSoildRect(pGraphics, m_pThemeData->clrSignNeutral, pRtSign, pMatrix); 225 FillSoildRect(pGraphics, m_pThemeData->clrSignNeutral, pRtSign, pMatrix);
224 } 226 }
227
225 void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics, 228 void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics,
226 const CFX_RectF* pRtSign, 229 const CFX_RectF* pRtSign,
227 FX_ARGB argbFill, 230 FX_ARGB argbFill,
228 CFX_Matrix* pMatrix) { 231 CFX_Matrix* pMatrix) {
229 if (!m_pCheckPath) { 232 if (!m_pCheckPath)
230 initCheckPath(pRtSign->width); 233 InitCheckPath(pRtSign->width);
231 } 234
232 CFX_Matrix mt; 235 CFX_Matrix mt;
233 mt.SetIdentity(); 236 mt.SetIdentity();
234 mt.Translate(pRtSign->left, pRtSign->top); 237 mt.Translate(pRtSign->left, pRtSign->top);
235 mt.Concat(*pMatrix); 238 mt.Concat(*pMatrix);
236 CFX_Color crFill(argbFill); 239 CFX_Color crFill(argbFill);
237 pGraphics->SaveGraphState(); 240 pGraphics->SaveGraphState();
238 pGraphics->SetFillColor(&crFill); 241 pGraphics->SetFillColor(&crFill);
239 pGraphics->FillPath(m_pCheckPath, FXFILL_WINDING, &mt); 242 pGraphics->FillPath(m_pCheckPath.get(), FXFILL_WINDING, &mt);
240 pGraphics->RestoreGraphState(); 243 pGraphics->RestoreGraphState();
241 } 244 }
245
242 void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics, 246 void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics,
243 const CFX_RectF* pRtSign, 247 const CFX_RectF* pRtSign,
244 FX_ARGB argbFill, 248 FX_ARGB argbFill,
245 CFX_Matrix* pMatrix) { 249 CFX_Matrix* pMatrix) {
246 CFX_Path path; 250 CFX_Path path;
247 path.Create(); 251 path.Create();
248 path.AddEllipse(*pRtSign); 252 path.AddEllipse(*pRtSign);
249 CFX_Color crFill(argbFill); 253 CFX_Color crFill(argbFill);
250 pGraphics->SaveGraphState(); 254 pGraphics->SaveGraphState();
251 pGraphics->SetFillColor(&crFill); 255 pGraphics->SetFillColor(&crFill);
252 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); 256 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
253 pGraphics->RestoreGraphState(); 257 pGraphics->RestoreGraphState();
254 } 258 }
259
255 void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics, 260 void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
256 const CFX_RectF* pRtSign, 261 const CFX_RectF* pRtSign,
257 FX_ARGB argbFill, 262 FX_ARGB argbFill,
258 CFX_Matrix* pMatrix) { 263 CFX_Matrix* pMatrix) {
259 CFX_Path path; 264 CFX_Path path;
260 path.Create(); 265 path.Create();
261 FX_FLOAT fRight = pRtSign->right(); 266 FX_FLOAT fRight = pRtSign->right();
262 FX_FLOAT fBottom = pRtSign->bottom(); 267 FX_FLOAT fBottom = pRtSign->bottom();
263 path.AddLine(pRtSign->left, pRtSign->top, fRight, fBottom); 268 path.AddLine(pRtSign->left, pRtSign->top, fRight, fBottom);
264 path.AddLine(pRtSign->left, fBottom, fRight, pRtSign->top); 269 path.AddLine(pRtSign->left, fBottom, fRight, pRtSign->top);
265 CFX_Color crFill(argbFill); 270 CFX_Color crFill(argbFill);
266 pGraphics->SaveGraphState(); 271 pGraphics->SaveGraphState();
267 pGraphics->SetStrokeColor(&crFill); 272 pGraphics->SetStrokeColor(&crFill);
268 pGraphics->SetLineWidth(1.0f); 273 pGraphics->SetLineWidth(1.0f);
269 pGraphics->StrokePath(&path, pMatrix); 274 pGraphics->StrokePath(&path, pMatrix);
270 pGraphics->RestoreGraphState(); 275 pGraphics->RestoreGraphState();
271 } 276 }
277
272 void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics, 278 void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics,
273 const CFX_RectF* pRtSign, 279 const CFX_RectF* pRtSign,
274 FX_ARGB argbFill, 280 FX_ARGB argbFill,
275 CFX_Matrix* pMatrix) { 281 CFX_Matrix* pMatrix) {
276 CFX_Path path; 282 CFX_Path path;
277 path.Create(); 283 path.Create();
278 FX_FLOAT fWidth = pRtSign->width; 284 FX_FLOAT fWidth = pRtSign->width;
279 FX_FLOAT fHeight = pRtSign->height; 285 FX_FLOAT fHeight = pRtSign->height;
280 FX_FLOAT fBottom = pRtSign->bottom(); 286 FX_FLOAT fBottom = pRtSign->bottom();
281 path.MoveTo(pRtSign->left + fWidth / 2, pRtSign->top); 287 path.MoveTo(pRtSign->left + fWidth / 2, pRtSign->top);
282 path.LineTo(pRtSign->left, pRtSign->top + fHeight / 2); 288 path.LineTo(pRtSign->left, pRtSign->top + fHeight / 2);
283 path.LineTo(pRtSign->left + fWidth / 2, fBottom); 289 path.LineTo(pRtSign->left + fWidth / 2, fBottom);
284 path.LineTo(pRtSign->right(), pRtSign->top + fHeight / 2); 290 path.LineTo(pRtSign->right(), pRtSign->top + fHeight / 2);
285 path.LineTo(pRtSign->left + fWidth / 2, pRtSign->top); 291 path.LineTo(pRtSign->left + fWidth / 2, pRtSign->top);
286 CFX_Color crFill(argbFill); 292 CFX_Color crFill(argbFill);
287 pGraphics->SaveGraphState(); 293 pGraphics->SaveGraphState();
288 pGraphics->SetFillColor(&crFill); 294 pGraphics->SetFillColor(&crFill);
289 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); 295 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
290 pGraphics->RestoreGraphState(); 296 pGraphics->RestoreGraphState();
291 } 297 }
298
292 void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics, 299 void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics,
293 const CFX_RectF* pRtSign, 300 const CFX_RectF* pRtSign,
294 FX_ARGB argbFill, 301 FX_ARGB argbFill,
295 CFX_Matrix* pMatrix) { 302 CFX_Matrix* pMatrix) {
296 CFX_Path path; 303 CFX_Path path;
297 path.Create(); 304 path.Create();
298 path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width, 305 path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width,
299 pRtSign->height); 306 pRtSign->height);
300 CFX_Color crFill(argbFill); 307 CFX_Color crFill(argbFill);
301 pGraphics->SaveGraphState(); 308 pGraphics->SaveGraphState();
302 pGraphics->SetFillColor(&crFill); 309 pGraphics->SetFillColor(&crFill);
303 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); 310 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
304 pGraphics->RestoreGraphState(); 311 pGraphics->RestoreGraphState();
305 } 312 }
313
306 void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics, 314 void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
307 const CFX_RectF* pRtSign, 315 const CFX_RectF* pRtSign,
308 FX_ARGB argbFill, 316 FX_ARGB argbFill,
309 CFX_Matrix* pMatrix) { 317 CFX_Matrix* pMatrix) {
310 CFX_Path path; 318 CFX_Path path;
311 path.Create(); 319 path.Create();
312 FX_FLOAT fBottom = pRtSign->bottom(); 320 FX_FLOAT fBottom = pRtSign->bottom();
313 FX_FLOAT fRadius = 321 FX_FLOAT fRadius =
314 (pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); 322 (pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
315 CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f, 323 CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f,
(...skipping 13 matching lines...) Expand all
329 nNext -= 5; 337 nNext -= 5;
330 } 338 }
331 path.LineTo(px[nNext], py[nNext]); 339 path.LineTo(px[nNext], py[nNext]);
332 } 340 }
333 CFX_Color crFill(argbFill); 341 CFX_Color crFill(argbFill);
334 pGraphics->SaveGraphState(); 342 pGraphics->SaveGraphState();
335 pGraphics->SetFillColor(&crFill); 343 pGraphics->SetFillColor(&crFill);
336 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); 344 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
337 pGraphics->RestoreGraphState(); 345 pGraphics->RestoreGraphState();
338 } 346 }
347
339 void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget, 348 void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget,
340 CFX_Graphics* pGraphics, 349 CFX_Graphics* pGraphics,
341 const CFX_RectF* pRtBox, 350 const CFX_RectF* pRtBox,
342 FX_BOOL bDisable, 351 FX_BOOL bDisable,
343 CFX_Matrix* pMatrix) { 352 CFX_Matrix* pMatrix) {
344 switch (pWidget->GetStylesEx() & FWL_STYLEEXT_CKB_ShapeMask) { 353 switch (pWidget->GetStylesEx() & FWL_STYLEEXT_CKB_ShapeMask) {
345 case FWL_STYLEEXT_CKB_ShapeSolidSquare: { 354 case FWL_STYLEEXT_CKB_ShapeSolidSquare: {
346 DrawAnnulusRect(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable 355 DrawAnnulusRect(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable
347 : m_pThemeData->clrSignBorderNormal, 356 : m_pThemeData->clrSignBorderNormal,
348 pRtBox, 1, pMatrix); 357 pRtBox, 1, pMatrix);
(...skipping 12 matching lines...) Expand all
361 break; 370 break;
362 } 371 }
363 case FWL_STYLEEXT_CKB_ShapeSunkenCircle: { 372 case FWL_STYLEEXT_CKB_ShapeSunkenCircle: {
364 Draw3DCircle(pGraphics, FWLTHEME_EDGE_Sunken, kSignBorder, pRtBox, 373 Draw3DCircle(pGraphics, FWLTHEME_EDGE_Sunken, kSignBorder, pRtBox,
365 CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2, 374 CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2,
366 CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix); 375 CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix);
367 break; 376 break;
368 } 377 }
369 } 378 }
370 } 379 }
380
371 void CFWL_CheckBoxTP::SetThemeData(uint32_t dwID) { 381 void CFWL_CheckBoxTP::SetThemeData(uint32_t dwID) {
372 uint32_t* pData = (uint32_t*)&m_pThemeData->clrBoxBk; 382 uint32_t* pData = (uint32_t*)&m_pThemeData->clrBoxBk;
373 if (dwID) { 383 if (dwID) {
374 *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215), 384 *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215),
375 *pData++ = ArgbEncode(255, 255, 255, 255), 385 *pData++ = ArgbEncode(255, 255, 255, 255),
376 *pData++ = ArgbEncode(255, 255, 240, 207), 386 *pData++ = ArgbEncode(255, 255, 240, 207),
377 *pData++ = ArgbEncode(255, 248, 179, 48), 387 *pData++ = ArgbEncode(255, 248, 179, 48),
378 *pData++ = ArgbEncode(255, 176, 176, 167), 388 *pData++ = ArgbEncode(255, 176, 176, 167),
379 *pData++ = ArgbEncode(255, 241, 239, 239), 389 *pData++ = ArgbEncode(255, 241, 239, 239),
380 *pData++ = ArgbEncode(255, 255, 255, 255), 390 *pData++ = ArgbEncode(255, 255, 255, 255),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 *pData++ = ArgbEncode(255, 255, 255, 255); 439 *pData++ = ArgbEncode(255, 255, 255, 255);
430 m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 28, 81, 128); 440 m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 28, 81, 128);
431 m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187); 441 m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187);
432 m_pThemeData->clrSignCheck = ArgbEncode(255, 28, 81, 128); 442 m_pThemeData->clrSignCheck = ArgbEncode(255, 28, 81, 128);
433 m_pThemeData->clrSignNeutral = ArgbEncode(255, 28, 134, 26); 443 m_pThemeData->clrSignNeutral = ArgbEncode(255, 28, 134, 26);
434 m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113); 444 m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113);
435 m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33); 445 m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33);
436 m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26); 446 m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26);
437 } 447 }
438 } 448 }
439 void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) { 449
450 void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
440 if (!m_pCheckPath) { 451 if (!m_pCheckPath) {
441 m_pCheckPath = new CFX_Path; 452 m_pCheckPath.reset(new CFX_Path);
442 m_pCheckPath->Create(); 453 m_pCheckPath->Create();
443 FX_FLOAT fWidth = kSignPath; 454 FX_FLOAT fWidth = kSignPath;
444 FX_FLOAT fHeight = -kSignPath; 455 FX_FLOAT fHeight = -kSignPath;
445 FX_FLOAT fBottom = kSignPath; 456 FX_FLOAT fBottom = kSignPath;
446 CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f); 457 CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
447 CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f); 458 CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
448 CFX_PointF pt3(fWidth / 3.0f, fBottom); 459 CFX_PointF pt3(fWidth / 3.0f, fBottom);
449 CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f); 460 CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
450 CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f); 461 CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
451 CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f); 462 CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER, 508 pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER,
498 pt1.x, pt1.y); 509 pt1.x, pt1.y);
499 FX_FLOAT fScale = fCheckLen / kSignPath; 510 FX_FLOAT fScale = fCheckLen / kSignPath;
500 CFX_Matrix mt; 511 CFX_Matrix mt;
501 mt.Set(1, 0, 0, 1, 0, 0); 512 mt.Set(1, 0, 0, 1, 0, 0);
502 mt.Scale(fScale, fScale); 513 mt.Scale(fScale, fScale);
503 CFX_PathData* pData = m_pCheckPath->GetPathData(); 514 CFX_PathData* pData = m_pCheckPath->GetPathData();
504 pData->Transform(&mt); 515 pData->Transform(&mt);
505 } 516 }
506 } 517 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_checkboxtp.h ('k') | xfa/fwl/theme/cfwl_datetimepickertp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698