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/ifwl_notedriver.h" | 10 #include "xfa/fwl/core/fwl_noteimp.h" |
11 #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" | 11 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
12 #include "xfa/fwl/lightwidget/cfwl_checkbox.h" | 12 #include "xfa/fwl/lightwidget/cfwl_checkbox.h" |
13 #include "xfa/fxfa/app/xfa_ffexclgroup.h" | 13 #include "xfa/fxfa/app/xfa_ffexclgroup.h" |
14 #include "xfa/fxfa/app/xfa_fffield.h" | 14 #include "xfa/fxfa/app/xfa_fffield.h" |
15 #include "xfa/fxfa/include/xfa_ffapp.h" | 15 #include "xfa/fxfa/include/xfa_ffapp.h" |
16 #include "xfa/fxfa/include/xfa_ffdoc.h" | 16 #include "xfa/fxfa/include/xfa_ffdoc.h" |
17 #include "xfa/fxfa/include/xfa_ffdocview.h" | 17 #include "xfa/fxfa/include/xfa_ffdocview.h" |
18 #include "xfa/fxfa/include/xfa_ffpageview.h" | 18 #include "xfa/fxfa/include/xfa_ffpageview.h" |
19 #include "xfa/fxfa/include/xfa_ffwidget.h" | 19 #include "xfa/fxfa/include/xfa_ffwidget.h" |
20 | 20 |
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 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 31 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
32 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); | 32 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); |
33 IFWL_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; | 39 m_pNormalWidget = (CFWL_Widget*)pCheckBox; |
40 m_pNormalWidget->SetPrivateData(m_pNormalWidget->GetWidget(), this, NULL); | 40 m_pNormalWidget->SetPrivateData(m_pNormalWidget->GetWidget(), this, NULL); |
41 m_pNormalWidget->LockUpdate(); | 41 m_pNormalWidget->LockUpdate(); |
42 UpdateWidgetProperty(); | 42 UpdateWidgetProperty(); |
43 XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); | 43 XFA_CHECKSTATE eState = m_pDataAcc->GetCheckState(); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 default: | 330 default: |
331 break; | 331 break; |
332 } | 332 } |
333 return m_pOldDelegate->OnProcessEvent(pEvent); | 333 return m_pOldDelegate->OnProcessEvent(pEvent); |
334 } | 334 } |
335 | 335 |
336 FWL_ERR CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, | 336 FWL_ERR CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, |
337 const CFX_Matrix* pMatrix) { | 337 const CFX_Matrix* pMatrix) { |
338 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 338 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
339 } | 339 } |
OLD | NEW |