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