| 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 "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/basewidget/ifwl_checkbox.h" | 10 #include "xfa/fwl/basewidget/ifwl_checkbox.h" |
| 11 #include "xfa/fwl/core/cfwl_themebackground.h" | 11 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 12 #include "xfa/fwl/core/cfwl_themetext.h" | 12 #include "xfa/fwl/core/cfwl_themetext.h" |
| 13 #include "xfa/fwl/core/ifwl_widget.h" | 13 #include "xfa/fwl/core/ifwl_widget.h" |
| 14 #include "xfa/fxgraphics/cfx_color.h" | 14 #include "xfa/fxgraphics/cfx_color.h" |
| 15 #include "xfa/fxgraphics/cfx_path.h" | 15 #include "xfa/fxgraphics/cfx_path.h" |
| 16 | 16 |
| 17 #define CHECKBOX_SIZE_SIGNMARGIN 3 | 17 #define CHECKBOX_SIZE_SIGNMARGIN 3 |
| 18 #define CHECKBOX_SIZE_SIGNBORDER 2 | 18 #define CHECKBOX_SIZE_SIGNBORDER 2 |
| 19 #define CHECKBOX_SIZE_SIGNPATH 100 | 19 #define CHECKBOX_SIZE_SIGNPATH 100 |
| 20 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) | 20 #define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) |
| 21 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) | 21 #define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) |
| 22 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) | 22 #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) |
| 23 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) | 23 #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) |
| 24 | 24 |
| 25 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { | 25 CFWL_CheckBoxTP::CFWL_CheckBoxTP() |
| 26 m_pThemeData = new CKBThemeData; | 26 : m_pThemeData(new CKBThemeData), m_pCheckPath(nullptr) { |
| 27 SetThemeData(0); | 27 SetThemeData(0); |
| 28 } | 28 } |
| 29 |
| 29 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { | 30 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { |
| 30 if (m_pThemeData) { | 31 delete m_pThemeData; |
| 31 delete m_pThemeData; | |
| 32 m_pThemeData = NULL; | |
| 33 } | |
| 34 if (m_pCheckPath) { | 32 if (m_pCheckPath) { |
| 35 m_pCheckPath->Clear(); | 33 m_pCheckPath->Clear(); |
| 36 delete m_pCheckPath; | 34 delete m_pCheckPath; |
| 37 m_pCheckPath = NULL; | |
| 38 } | 35 } |
| 39 } | 36 } |
| 37 |
| 40 FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { | 38 FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { |
| 41 return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox; | 39 return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox; |
| 42 } | 40 } |
| 43 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, | 41 uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, |
| 44 uint32_t dwThemeID, | 42 uint32_t dwThemeID, |
| 45 FX_BOOL bChildren) { | 43 FX_BOOL bChildren) { |
| 46 if (m_pThemeData) { | 44 if (m_pThemeData) { |
| 47 SetThemeData(FWL_GetThemeColor(dwThemeID)); | 45 SetThemeData(FWL_GetThemeColor(dwThemeID)); |
| 48 } | 46 } |
| 49 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); | 47 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 pt1.x + px2 * FWLTHEME_BEZIER, | 498 pt1.x + px2 * FWLTHEME_BEZIER, |
| 501 pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y); | 499 pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y); |
| 502 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; | 500 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; |
| 503 CFX_Matrix mt; | 501 CFX_Matrix mt; |
| 504 mt.Set(1, 0, 0, 1, 0, 0); | 502 mt.Set(1, 0, 0, 1, 0, 0); |
| 505 mt.Scale(fScale, fScale); | 503 mt.Scale(fScale, fScale); |
| 506 CFX_PathData* pData = m_pCheckPath->GetPathData(); | 504 CFX_PathData* pData = m_pCheckPath->GetPathData(); |
| 507 pData->Transform(&mt); | 505 pData->Transform(&mt); |
| 508 } | 506 } |
| 509 } | 507 } |
| OLD | NEW |