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" |
| 11 #include "xfa/fwl/core/cfwl_checkbox.h" |
11 #include "xfa/fwl/core/cfwl_themebackground.h" | 12 #include "xfa/fwl/core/cfwl_themebackground.h" |
12 #include "xfa/fwl/core/cfwl_themetext.h" | 13 #include "xfa/fwl/core/cfwl_themetext.h" |
13 #include "xfa/fwl/core/ifwl_checkbox.h" | 14 #include "xfa/fwl/core/cfwl_widget.h" |
14 #include "xfa/fwl/core/ifwl_widget.h" | |
15 #include "xfa/fxgraphics/cfx_color.h" | 15 #include "xfa/fxgraphics/cfx_color.h" |
16 #include "xfa/fxgraphics/cfx_path.h" | 16 #include "xfa/fxgraphics/cfx_path.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const int kSignPath = 100; | 20 const int kSignPath = 100; |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) | 24 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) |
25 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) | 25 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) |
26 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) | 26 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) |
27 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) | 27 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) |
28 | 28 |
29 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pThemeData(new CKBThemeData) { | 29 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pThemeData(new CKBThemeData) { |
30 SetThemeData(); | 30 SetThemeData(); |
31 } | 31 } |
32 | 32 |
33 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { | 33 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { |
34 if (m_pCheckPath) | 34 if (m_pCheckPath) |
35 m_pCheckPath->Clear(); | 35 m_pCheckPath->Clear(); |
36 } | 36 } |
37 | 37 |
38 bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { | 38 bool CFWL_CheckBoxTP::IsValidWidget(CFWL_Widget* pWidget) { |
39 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; | 39 return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; |
40 } | 40 } |
41 | 41 |
42 void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { | 42 void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { |
43 if (!m_pTextOut) | 43 if (!m_pTextOut) |
44 return; | 44 return; |
45 | 45 |
46 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled | 46 m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled |
47 ? FWLTHEME_CAPACITY_TextDisColor | 47 ? FWLTHEME_CAPACITY_TextDisColor |
48 : FWLTHEME_CAPACITY_TextColor); | 48 : FWLTHEME_CAPACITY_TextColor); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (pParams->m_iPart != CFWL_Part::CheckBox) | 290 if (pParams->m_iPart != CFWL_Part::CheckBox) |
291 return; | 291 return; |
292 | 292 |
293 if ((pParams->m_dwStates & CFWL_PartState_Checked) || | 293 if ((pParams->m_dwStates & CFWL_PartState_Checked) || |
294 (pParams->m_dwStates & CFWL_PartState_Neutral)) { | 294 (pParams->m_dwStates & CFWL_PartState_Neutral)) { |
295 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, pParams->m_rtPart, | 295 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, pParams->m_rtPart, |
296 pParams->m_dwStates, &pParams->m_matrix); | 296 pParams->m_dwStates, &pParams->m_matrix); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 void CFWL_CheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, | 300 void CFWL_CheckBoxTP::DrawCheckSign(CFWL_Widget* pWidget, |
301 CFX_Graphics* pGraphics, | 301 CFX_Graphics* pGraphics, |
302 const CFX_RectF& pRtBox, | 302 const CFX_RectF& pRtBox, |
303 int32_t iState, | 303 int32_t iState, |
304 CFX_Matrix* pMatrix) { | 304 CFX_Matrix* pMatrix) { |
305 CFX_RectF rtSign(pRtBox); | 305 CFX_RectF rtSign(pRtBox); |
306 uint32_t dwColor = iState & CFWL_PartState_Neutral ? 0xFFA9A9A9 : 0xFF000000; | 306 uint32_t dwColor = iState & CFWL_PartState_Neutral ? 0xFFA9A9A9 : 0xFF000000; |
307 | 307 |
308 uint32_t dwStyle = pWidget->GetStylesEx(); | 308 uint32_t dwStyle = pWidget->GetStylesEx(); |
309 rtSign.Deflate(rtSign.width / 4, rtSign.height / 4); | 309 rtSign.Deflate(rtSign.width / 4, rtSign.height / 4); |
310 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { | 310 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { |
(...skipping 12 matching lines...) Expand all Loading... |
323 case FWL_STYLEEXT_CKB_SignShapeSquare: | 323 case FWL_STYLEEXT_CKB_SignShapeSquare: |
324 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix); | 324 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix); |
325 break; | 325 break; |
326 case FWL_STYLEEXT_CKB_SignShapeStar: | 326 case FWL_STYLEEXT_CKB_SignShapeStar: |
327 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); | 327 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); |
328 break; | 328 break; |
329 default: | 329 default: |
330 break; | 330 break; |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |