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