| 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 #define CHECKBOX_FXGE_CoordinatesAdjust | |
| 25 | 24 |
| 26 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { | 25 CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { |
| 27 m_pThemeData = new CKBThemeData; | 26 m_pThemeData = new CKBThemeData; |
| 28 SetThemeData(0); | 27 SetThemeData(0); |
| 29 } | 28 } |
| 30 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { | 29 CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { |
| 31 if (m_pThemeData) { | 30 if (m_pThemeData) { |
| 32 delete m_pThemeData; | 31 delete m_pThemeData; |
| 33 m_pThemeData = NULL; | 32 m_pThemeData = NULL; |
| 34 } | 33 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) { | 126 (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) { |
| 128 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | 127 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); |
| 129 if (bClipSign) { | 128 if (bClipSign) { |
| 130 fillMode = FXFILL_ALTERNATE; | 129 fillMode = FXFILL_ALTERNATE; |
| 131 path.AddRectangle(pRect->left + CHECKBOX_SIZE_SIGNMARGIN, | 130 path.AddRectangle(pRect->left + CHECKBOX_SIZE_SIGNMARGIN, |
| 132 pRect->top + CHECKBOX_SIZE_SIGNMARGIN, | 131 pRect->top + CHECKBOX_SIZE_SIGNMARGIN, |
| 133 pRect->width - CHECKBOX_SIZE_SIGNMARGIN * 2, | 132 pRect->width - CHECKBOX_SIZE_SIGNMARGIN * 2, |
| 134 pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2); | 133 pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2); |
| 135 } | 134 } |
| 136 } else { | 135 } else { |
| 137 #ifdef CHECKBOX_FXGE_CoordinatesAdjust | |
| 138 CFX_RectF rect(*pRect); | 136 CFX_RectF rect(*pRect); |
| 139 rect.Deflate(0, 0, 1, 1); | 137 rect.Deflate(0, 0, 1, 1); |
| 140 path.AddEllipse(rect); | 138 path.AddEllipse(rect); |
| 141 #else | |
| 142 path.AddEllipse(*pRect); | |
| 143 #endif | |
| 144 if (bClipSign) { | 139 if (bClipSign) { |
| 145 fillMode = FXFILL_ALTERNATE; | 140 fillMode = FXFILL_ALTERNATE; |
| 146 #ifdef CHECKBOX_FXGE_CoordinatesAdjust | |
| 147 CFX_RectF rtClip(rect); | 141 CFX_RectF rtClip(rect); |
| 148 #else | |
| 149 CFX_RectF rtClip(*pRect); | |
| 150 #endif | |
| 151 rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, | 142 rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, |
| 152 CHECKBOX_SIZE_SIGNMARGIN - 1); | 143 CHECKBOX_SIZE_SIGNMARGIN - 1); |
| 153 path.AddEllipse(rtClip); | 144 path.AddEllipse(rtClip); |
| 154 } | 145 } |
| 155 } | 146 } |
| 156 int32_t iTheme = 1; | 147 int32_t iTheme = 1; |
| 157 if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) { | 148 if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) { |
| 158 iTheme = 2; | 149 iTheme = 2; |
| 159 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == | 150 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == |
| 160 FWL_PARTSTATE_CKB_Pressed) { | 151 FWL_PARTSTATE_CKB_Pressed) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 pt1.x + px2 * FWLTHEME_BEZIER, | 518 pt1.x + px2 * FWLTHEME_BEZIER, |
| 528 pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y); | 519 pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y); |
| 529 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; | 520 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; |
| 530 CFX_Matrix mt; | 521 CFX_Matrix mt; |
| 531 mt.Set(1, 0, 0, 1, 0, 0); | 522 mt.Set(1, 0, 0, 1, 0, 0); |
| 532 mt.Scale(fScale, fScale); | 523 mt.Scale(fScale, fScale); |
| 533 CFX_PathData* pData = m_pCheckPath->GetPathData(); | 524 CFX_PathData* pData = m_pCheckPath->GetPathData(); |
| 534 pData->Transform(&mt); | 525 pData->Transform(&mt); |
| 535 } | 526 } |
| 536 } | 527 } |
| OLD | NEW |