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_message.h" | 9 #include "xfa/fwl/core/cfwl_message.h" |
10 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 10 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, | 21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, |
22 CXFA_WidgetAcc* pDataAcc) | 22 CXFA_WidgetAcc* pDataAcc) |
23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) { | 23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) { |
24 m_rtCheckBox.Set(0, 0, 0, 0); | 24 m_rtCheckBox.Set(0, 0, 0, 0); |
25 } | 25 } |
26 CXFA_FFCheckButton::~CXFA_FFCheckButton() {} | 26 CXFA_FFCheckButton::~CXFA_FFCheckButton() {} |
27 FX_BOOL CXFA_FFCheckButton::LoadWidget() { | 27 FX_BOOL CXFA_FFCheckButton::LoadWidget() { |
28 CFWL_CheckBox* pCheckBox = CFWL_CheckBox::Create(); | 28 CFWL_CheckBox* pCheckBox = CFWL_CheckBox::Create(); |
29 pCheckBox->Initialize(); | 29 pCheckBox->Initialize(); |
30 m_pNormalWidget = pCheckBox; | 30 m_pNormalWidget = pCheckBox; |
| 31 m_pNormalWidget->SetLayoutItem(this); |
31 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
32 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); | |
33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); | 33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); |
34 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 34 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
35 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 35 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); |
36 if (m_pDataAcc->IsRadioButton()) { | 36 if (m_pDataAcc->IsRadioButton()) { |
37 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); | 37 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); |
38 } | 38 } |
39 m_pNormalWidget = (CFWL_Widget*)pCheckBox; | |
40 m_pNormalWidget->SetPrivateData(m_pNormalWidget->GetWidget(), this, NULL); | |
41 m_pNormalWidget->LockUpdate(); | 39 m_pNormalWidget->LockUpdate(); |
42 UpdateWidgetProperty(); | 40 UpdateWidgetProperty(); |
43 XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); | 41 SetFWLCheckState(m_pDataAcc->GetCheckState()); |
44 SetFWLCheckState(eState); | |
45 m_pNormalWidget->UnlockUpdate(); | 42 m_pNormalWidget->UnlockUpdate(); |
46 return CXFA_FFField::LoadWidget(); | 43 return CXFA_FFField::LoadWidget(); |
47 } | 44 } |
48 void CXFA_FFCheckButton::UpdateWidgetProperty() { | 45 void CXFA_FFCheckButton::UpdateWidgetProperty() { |
49 CFWL_CheckBox* pCheckBox = (CFWL_CheckBox*)m_pNormalWidget; | 46 CFWL_CheckBox* pCheckBox = (CFWL_CheckBox*)m_pNormalWidget; |
50 if (!m_pNormalWidget) { | 47 if (!m_pNormalWidget) { |
51 return; | 48 return; |
52 } | 49 } |
53 FX_FLOAT fSize = m_pDataAcc->GetCheckButtonSize(); | 50 FX_FLOAT fSize = m_pDataAcc->GetCheckButtonSize(); |
54 pCheckBox->SetBoxSize(fSize); | 51 pCheckBox->SetBoxSize(fSize); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 default: | 328 default: |
332 break; | 329 break; |
333 } | 330 } |
334 m_pOldDelegate->OnProcessEvent(pEvent); | 331 m_pOldDelegate->OnProcessEvent(pEvent); |
335 } | 332 } |
336 | 333 |
337 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, | 334 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, |
338 const CFX_Matrix* pMatrix) { | 335 const CFX_Matrix* pMatrix) { |
339 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 336 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
340 } | 337 } |
OLD | NEW |