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_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 FX_BOOL CXFA_FFCheckButton::LoadWidget() { | 29 FX_BOOL CXFA_FFCheckButton::LoadWidget() { |
30 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp()); | 30 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp()); |
31 pCheckBox->Initialize(); | 31 pCheckBox->Initialize(); |
32 m_pNormalWidget = pCheckBox; | 32 m_pNormalWidget = pCheckBox; |
33 m_pNormalWidget->SetLayoutItem(this); | 33 m_pNormalWidget->SetLayoutItem(this); |
34 | 34 |
35 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 35 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
36 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 36 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
37 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 37 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
38 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 38 |
39 if (m_pDataAcc->IsRadioButton()) { | 39 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); |
| 40 m_pNormalWidget->SetCurrentDelegate(this); |
| 41 |
| 42 if (m_pDataAcc->IsRadioButton()) |
40 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); | 43 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); |
41 } | 44 |
42 m_pNormalWidget->LockUpdate(); | 45 m_pNormalWidget->LockUpdate(); |
43 UpdateWidgetProperty(); | 46 UpdateWidgetProperty(); |
44 SetFWLCheckState(m_pDataAcc->GetCheckState()); | 47 SetFWLCheckState(m_pDataAcc->GetCheckState()); |
45 m_pNormalWidget->UnlockUpdate(); | 48 m_pNormalWidget->UnlockUpdate(); |
46 return CXFA_FFField::LoadWidget(); | 49 return CXFA_FFField::LoadWidget(); |
47 } | 50 } |
48 void CXFA_FFCheckButton::UpdateWidgetProperty() { | 51 void CXFA_FFCheckButton::UpdateWidgetProperty() { |
49 CFWL_CheckBox* pCheckBox = (CFWL_CheckBox*)m_pNormalWidget; | 52 CFWL_CheckBox* pCheckBox = (CFWL_CheckBox*)m_pNormalWidget; |
50 if (!m_pNormalWidget) { | 53 if (!m_pNormalWidget) { |
51 return; | 54 return; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 default: | 331 default: |
329 break; | 332 break; |
330 } | 333 } |
331 m_pOldDelegate->OnProcessEvent(pEvent); | 334 m_pOldDelegate->OnProcessEvent(pEvent); |
332 } | 335 } |
333 | 336 |
334 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, | 337 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, |
335 const CFX_Matrix* pMatrix) { | 338 const CFX_Matrix* pMatrix) { |
336 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 339 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
337 } | 340 } |
OLD | NEW |