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" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix); | 159 m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix); |
160 } | 160 } |
161 void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget, | 161 void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget, |
162 CFX_Graphics* pGraphics, | 162 CFX_Graphics* pGraphics, |
163 const CFX_RectF* pRtBox, | 163 const CFX_RectF* pRtBox, |
164 uint32_t dwStates, | 164 uint32_t dwStates, |
165 CFX_Matrix* pMatrix) { | 165 CFX_Matrix* pMatrix) { |
166 CFX_RectF rtSign(*pRtBox); | 166 CFX_RectF rtSign(*pRtBox); |
167 rtSign.Deflate(kSignMargin, kSignMargin); | 167 rtSign.Deflate(kSignMargin, kSignMargin); |
168 uint32_t dwColor = m_pThemeData->clrSignCheck; | 168 uint32_t dwColor = m_pThemeData->clrSignCheck; |
169 FX_BOOL bCheck = TRUE; | 169 bool bCheck = true; |
170 if ((dwStates & CFWL_PartState_Disabled) && | 170 if ((dwStates & CFWL_PartState_Disabled) && |
171 (dwStates & CFWL_PartState_Checked)) { | 171 (dwStates & CFWL_PartState_Checked)) { |
172 dwColor = m_pThemeData->clrSignBorderDisable; | 172 dwColor = m_pThemeData->clrSignBorderDisable; |
173 } else if (dwStates & CFWL_PartState_Neutral) { | 173 } else if (dwStates & CFWL_PartState_Neutral) { |
174 if (dwStates & CFWL_PartState_Normal) { | 174 if (dwStates & CFWL_PartState_Hovered) { |
175 bCheck = FALSE; | |
176 dwColor = m_pThemeData->clrSignNeutralNormal; | |
177 } else if (dwStates & CFWL_PartState_Hovered) { | |
178 bCheck = FALSE; | |
179 dwColor = m_pThemeData->clrSignNeutralHover; | 175 dwColor = m_pThemeData->clrSignNeutralHover; |
180 } else if (dwStates & CFWL_PartState_Pressed) { | 176 } else if (dwStates & CFWL_PartState_Pressed) { |
181 bCheck = FALSE, dwColor = m_pThemeData->clrSignNeutralPressed; | 177 dwColor = m_pThemeData->clrSignNeutralPressed; |
182 } else if (dwStates & CFWL_PartState_Disabled) { | 178 } else if (dwStates & CFWL_PartState_Disabled) { |
183 bCheck = FALSE, dwColor = m_pThemeData->clrSignBorderDisable; | 179 dwColor = m_pThemeData->clrSignBorderDisable; |
| 180 } else { |
| 181 dwColor = m_pThemeData->clrSignNeutralNormal; |
184 } | 182 } |
| 183 bCheck = false; |
185 } | 184 } |
186 if (bCheck) { | 185 if (bCheck) { |
187 uint32_t dwStyle = pWidget->GetStylesEx(); | 186 uint32_t dwStyle = pWidget->GetStylesEx(); |
188 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { | 187 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { |
189 case FWL_STYLEEXT_CKB_SignShapeCheck: { | 188 case FWL_STYLEEXT_CKB_SignShapeCheck: { |
190 DrawSignCheck(pGraphics, &rtSign, dwColor, pMatrix); | 189 DrawSignCheck(pGraphics, &rtSign, dwColor, pMatrix); |
191 break; | 190 break; |
192 } | 191 } |
193 case FWL_STYLEEXT_CKB_SignShapeCircle: { | 192 case FWL_STYLEEXT_CKB_SignShapeCircle: { |
194 rtSign.Deflate(1, 1); | 193 rtSign.Deflate(1, 1); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER, | 496 pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER, |
498 pt1.x, pt1.y); | 497 pt1.x, pt1.y); |
499 FX_FLOAT fScale = fCheckLen / kSignPath; | 498 FX_FLOAT fScale = fCheckLen / kSignPath; |
500 CFX_Matrix mt; | 499 CFX_Matrix mt; |
501 mt.Set(1, 0, 0, 1, 0, 0); | 500 mt.Set(1, 0, 0, 1, 0, 0); |
502 mt.Scale(fScale, fScale); | 501 mt.Scale(fScale, fScale); |
503 CFX_PathData* pData = m_pCheckPath->GetPathData(); | 502 CFX_PathData* pData = m_pCheckPath->GetPathData(); |
504 pData->Transform(&mt); | 503 pData->Transform(&mt); |
505 } | 504 } |
506 } | 505 } |
OLD | NEW |