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/fxfa/app/xfa_ffpushbutton.h" | 7 #include "xfa/fxfa/app/xfa_ffpushbutton.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_notedriver.h" | 9 #include "xfa/fwl/core/cfwl_notedriver.h" |
10 #include "xfa/fwl/core/cfwl_pushbutton.h" | 10 #include "xfa/fwl/core/cfwl_pushbutton.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void CXFA_FFPushButton::OnProcessEvent(CFWL_Event* pEvent) { | 207 void CXFA_FFPushButton::OnProcessEvent(CFWL_Event* pEvent) { |
208 m_pOldDelegate->OnProcessEvent(pEvent); | 208 m_pOldDelegate->OnProcessEvent(pEvent); |
209 CXFA_FFField::OnProcessEvent(pEvent); | 209 CXFA_FFField::OnProcessEvent(pEvent); |
210 } | 210 } |
211 | 211 |
212 void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, | 212 void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, |
213 const CFX_Matrix* pMatrix) { | 213 const CFX_Matrix* pMatrix) { |
214 if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { | 214 if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { |
215 if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && | 215 if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && |
216 (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { | 216 (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { |
217 CFX_RectF rtFill; | 217 CFX_RectF rtFill = m_pNormalWidget->GetWidgetRect(); |
218 m_pNormalWidget->GetWidgetRect(rtFill, false); | |
219 rtFill.left = rtFill.top = 0; | 218 rtFill.left = rtFill.top = 0; |
220 FX_FLOAT fLineWith = GetLineWidth(); | 219 FX_FLOAT fLineWith = GetLineWidth(); |
221 rtFill.Deflate(fLineWith, fLineWith); | 220 rtFill.Deflate(fLineWith, fLineWith); |
222 CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); | 221 CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); |
223 pGraphics->SetFillColor(&cr); | 222 pGraphics->SetFillColor(&cr); |
224 CFX_Path path; | 223 CFX_Path path; |
225 path.Create(); | 224 path.Create(); |
226 path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height); | 225 path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height); |
227 pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix); | 226 pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix); |
228 } | 227 } |
229 } else if (m_pNormalWidget->GetStylesEx() & | 228 } else if (m_pNormalWidget->GetStylesEx() & |
230 XFA_FWL_PSBSTYLEEXT_HiliteOutLine) { | 229 XFA_FWL_PSBSTYLEEXT_HiliteOutLine) { |
231 if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && | 230 if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && |
232 (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { | 231 (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { |
233 FX_FLOAT fLineWidth = GetLineWidth(); | 232 FX_FLOAT fLineWidth = GetLineWidth(); |
234 CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); | 233 CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); |
235 pGraphics->SetStrokeColor(&cr); | 234 pGraphics->SetStrokeColor(&cr); |
236 pGraphics->SetLineWidth(fLineWidth); | 235 pGraphics->SetLineWidth(fLineWidth); |
237 CFX_Path path; | 236 CFX_Path path; |
238 path.Create(); | 237 path.Create(); |
239 CFX_RectF rect; | 238 |
240 m_pNormalWidget->GetWidgetRect(rect, false); | 239 CFX_RectF rect = m_pNormalWidget->GetWidgetRect(); |
241 path.AddRectangle(0, 0, rect.width, rect.height); | 240 path.AddRectangle(0, 0, rect.width, rect.height); |
242 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); | 241 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); |
243 } | 242 } |
244 } | 243 } |
245 } | 244 } |
OLD | NEW |