| OLD | NEW |
| 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/cfx_pathdata.h" | 9 #include "core/fxge/cfx_pathdata.h" |
| 10 #include "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { | 38 bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { |
| 39 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; | 39 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; |
| 40 } | 40 } |
| 41 | 41 |
| 42 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { | 42 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { |
| 43 if (m_pThemeData) | 43 if (m_pThemeData) |
| 44 SetThemeData(FWL_GetThemeColor(dwThemeID)); | 44 SetThemeData(FWL_GetThemeColor(dwThemeID)); |
| 45 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); | 45 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); |
| 46 } | 46 } |
| 47 | 47 |
| 48 FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { | 48 void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { |
| 49 if (!m_pTextOut) | 49 if (!m_pTextOut) |
| 50 return FALSE; | 50 return; |
| 51 |
| 51 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled | 52 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled |
| 52 ? FWLTHEME_CAPACITY_TextDisColor | 53 ? FWLTHEME_CAPACITY_TextDisColor |
| 53 : FWLTHEME_CAPACITY_TextColor); | 54 : FWLTHEME_CAPACITY_TextColor); |
| 54 return CFWL_WidgetTP::DrawText(pParams); | 55 CFWL_WidgetTP::DrawText(pParams); |
| 55 } | 56 } |
| 56 | 57 |
| 57 FWL_Error CFWL_CheckBoxTP::Initialize() { | 58 void CFWL_CheckBoxTP::Initialize() { |
| 58 InitTTO(); | 59 InitTTO(); |
| 59 return CFWL_WidgetTP::Initialize(); | 60 CFWL_WidgetTP::Initialize(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 FWL_Error CFWL_CheckBoxTP::Finalize() { | 63 void CFWL_CheckBoxTP::Finalize() { |
| 63 FinalizeTTO(); | 64 FinalizeTTO(); |
| 64 return CFWL_WidgetTP::Finalize(); | 65 CFWL_WidgetTP::Finalize(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics, | 68 void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics, |
| 68 const CFX_RectF* pRtSign, | 69 const CFX_RectF* pRtSign, |
| 69 FX_ARGB argbFill, | 70 FX_ARGB argbFill, |
| 70 CFX_Matrix* pMatrix) { | 71 CFX_Matrix* pMatrix) { |
| 71 if (!m_pCheckPath) | 72 if (!m_pCheckPath) |
| 72 InitCheckPath(pRtSign->width); | 73 InitCheckPath(pRtSign->width); |
| 73 | 74 |
| 74 CFX_Matrix mt; | 75 CFX_Matrix mt; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 pt1.x, pt1.y); | 316 pt1.x, pt1.y); |
| 316 FX_FLOAT fScale = fCheckLen / kSignPath; | 317 FX_FLOAT fScale = fCheckLen / kSignPath; |
| 317 CFX_Matrix mt; | 318 CFX_Matrix mt; |
| 318 mt.Set(1, 0, 0, 1, 0, 0); | 319 mt.Set(1, 0, 0, 1, 0, 0); |
| 319 mt.Scale(fScale, fScale); | 320 mt.Scale(fScale, fScale); |
| 320 CFX_PathData* pData = m_pCheckPath->GetPathData(); | 321 CFX_PathData* pData = m_pCheckPath->GetPathData(); |
| 321 pData->Transform(&mt); | 322 pData->Transform(&mt); |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 | 325 |
| 325 FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 326 void CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 326 if (pParams->m_iPart != CFWL_Part::CheckBox) { | 327 if (pParams->m_iPart != CFWL_Part::CheckBox) |
| 327 return FALSE; | 328 return; |
| 328 } | 329 |
| 329 if ((pParams->m_dwStates & CFWL_PartState_Checked) || | 330 if ((pParams->m_dwStates & CFWL_PartState_Checked) || |
| 330 (pParams->m_dwStates & CFWL_PartState_Neutral)) { | 331 (pParams->m_dwStates & CFWL_PartState_Neutral)) { |
| 331 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, pParams->m_rtPart, | 332 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, pParams->m_rtPart, |
| 332 pParams->m_dwStates, &pParams->m_matrix); | 333 pParams->m_dwStates, &pParams->m_matrix); |
| 333 } | 334 } |
| 334 return FALSE; | |
| 335 } | 335 } |
| 336 | 336 |
| 337 void CFWL_CheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, | 337 void CFWL_CheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, |
| 338 CFX_Graphics* pGraphics, | 338 CFX_Graphics* pGraphics, |
| 339 const CFX_RectF& pRtBox, | 339 const CFX_RectF& pRtBox, |
| 340 int32_t iState, | 340 int32_t iState, |
| 341 CFX_Matrix* pMatrix) { | 341 CFX_Matrix* pMatrix) { |
| 342 CFX_RectF rtSign(pRtBox); | 342 CFX_RectF rtSign(pRtBox); |
| 343 uint32_t dwColor = iState & CFWL_PartState_Neutral ? 0xFFA9A9A9 : 0xFF000000; | 343 uint32_t dwColor = iState & CFWL_PartState_Neutral ? 0xFFA9A9A9 : 0xFF000000; |
| 344 | 344 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 360 case FWL_STYLEEXT_CKB_SignShapeSquare: | 360 case FWL_STYLEEXT_CKB_SignShapeSquare: |
| 361 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix); | 361 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix); |
| 362 break; | 362 break; |
| 363 case FWL_STYLEEXT_CKB_SignShapeStar: | 363 case FWL_STYLEEXT_CKB_SignShapeStar: |
| 364 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); | 364 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); |
| 365 break; | 365 break; |
| 366 default: | 366 default: |
| 367 break; | 367 break; |
| 368 } | 368 } |
| 369 } | 369 } |
| OLD | NEW |