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_ffcheckbutton.h" | 7 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_checkbox.h" | 9 #include "xfa/fwl/core/cfwl_checkbox.h" |
10 #include "xfa/fwl/core/cfwl_msgmouse.h" | 10 #include "xfa/fwl/core/cfwl_msgmouse.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 m_pDataAcc->SetCheckState(eCheckState, true); | 270 m_pDataAcc->SetCheckState(eCheckState, true); |
271 return true; | 271 return true; |
272 } | 272 } |
273 | 273 |
274 bool CXFA_FFCheckButton::IsDataChanged() { | 274 bool CXFA_FFCheckButton::IsDataChanged() { |
275 XFA_CHECKSTATE eCheckState = FWLState2XFAState(); | 275 XFA_CHECKSTATE eCheckState = FWLState2XFAState(); |
276 return m_pDataAcc->GetCheckState() != eCheckState; | 276 return m_pDataAcc->GetCheckState() != eCheckState; |
277 } | 277 } |
278 void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) { | 278 void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) { |
279 if (eCheckState == XFA_CHECKSTATE_Neutral) { | 279 if (eCheckState == XFA_CHECKSTATE_Neutral) { |
280 m_pNormalWidget->SetStates(FWL_STATE_CKB_Neutral, true); | 280 m_pNormalWidget->SetStates(FWL_STATE_CKB_Neutral); |
281 } else { | 281 } else { |
282 m_pNormalWidget->SetStates(FWL_STATE_CKB_Checked, | 282 if (eCheckState == XFA_CHECKSTATE_On) |
283 eCheckState == XFA_CHECKSTATE_On); | 283 m_pNormalWidget->SetStates(FWL_STATE_CKB_Checked); |
| 284 else |
| 285 m_pNormalWidget->RemoveStates(FWL_STATE_CKB_Checked); |
284 } | 286 } |
285 } | 287 } |
286 bool CXFA_FFCheckButton::UpdateFWLData() { | 288 bool CXFA_FFCheckButton::UpdateFWLData() { |
287 if (!m_pNormalWidget) { | 289 if (!m_pNormalWidget) { |
288 return false; | 290 return false; |
289 } | 291 } |
290 XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); | 292 XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); |
291 SetFWLCheckState(eState); | 293 SetFWLCheckState(eState); |
292 m_pNormalWidget->Update(); | 294 m_pNormalWidget->Update(); |
293 return true; | 295 return true; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 default: | 330 default: |
329 break; | 331 break; |
330 } | 332 } |
331 m_pOldDelegate->OnProcessEvent(pEvent); | 333 m_pOldDelegate->OnProcessEvent(pEvent); |
332 } | 334 } |
333 | 335 |
334 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, | 336 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, |
335 const CFX_Matrix* pMatrix) { | 337 const CFX_Matrix* pMatrix) { |
336 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 338 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
337 } | 339 } |
OLD | NEW |