| 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/fwl/core/ifwl_formproxy.h" | 7 #include "xfa/fwl/core/ifwl_formproxy.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/fwl_noteimp.h" | 9 #include "xfa/fwl/core/fwl_noteimp.h" |
| 10 | 10 |
| 11 IFWL_FormProxy::IFWL_FormProxy(const CFWL_WidgetImpProperties& properties, | 11 IFWL_FormProxy::IFWL_FormProxy(const IFWL_App* app, |
| 12 const CFWL_WidgetImpProperties& properties, |
| 12 IFWL_Widget* pOuter) | 13 IFWL_Widget* pOuter) |
| 13 : IFWL_Form(properties, pOuter) {} | 14 : IFWL_Form(app, properties, pOuter) {} |
| 14 | 15 |
| 15 IFWL_FormProxy::~IFWL_FormProxy() {} | 16 IFWL_FormProxy::~IFWL_FormProxy() {} |
| 16 | 17 |
| 18 void IFWL_FormProxy::Initialize() { |
| 19 IFWL_Widget::Initialize(); |
| 20 m_pDelegate = new CFWL_FormProxyImpDelegate(this); |
| 21 } |
| 22 |
| 23 void IFWL_FormProxy::Finalize() { |
| 24 delete m_pDelegate; |
| 25 m_pDelegate = nullptr; |
| 26 IFWL_Widget::Finalize(); |
| 27 } |
| 28 |
| 17 FWL_Type IFWL_FormProxy::GetClassID() const { | 29 FWL_Type IFWL_FormProxy::GetClassID() const { |
| 18 return FWL_Type::FormProxy; | 30 return FWL_Type::FormProxy; |
| 19 } | 31 } |
| 20 | 32 |
| 21 FX_BOOL IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { | 33 FX_BOOL IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { |
| 22 if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { | 34 if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { |
| 23 return TRUE; | 35 return TRUE; |
| 24 } | 36 } |
| 25 return IFWL_Form::IsInstance(wsClass); | 37 return IFWL_Form::IsInstance(wsClass); |
| 26 } | 38 } |
| 27 | 39 |
| 28 FWL_Error IFWL_FormProxy::Initialize() { | |
| 29 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | |
| 30 return FWL_Error::Indefinite; | |
| 31 m_pDelegate = new CFWL_FormProxyImpDelegate(this); | |
| 32 return FWL_Error::Succeeded; | |
| 33 } | |
| 34 | |
| 35 void IFWL_FormProxy::Finalize() { | |
| 36 delete m_pDelegate; | |
| 37 m_pDelegate = nullptr; | |
| 38 IFWL_Widget::Finalize(); | |
| 39 } | |
| 40 | |
| 41 FWL_Error IFWL_FormProxy::Update() { | 40 FWL_Error IFWL_FormProxy::Update() { |
| 42 return FWL_Error::Succeeded; | 41 return FWL_Error::Succeeded; |
| 43 } | 42 } |
| 44 | 43 |
| 45 FWL_Error IFWL_FormProxy::DrawWidget(CFX_Graphics* pGraphics, | 44 FWL_Error IFWL_FormProxy::DrawWidget(CFX_Graphics* pGraphics, |
| 46 const CFX_Matrix* pMatrix) { | 45 const CFX_Matrix* pMatrix) { |
| 47 return FWL_Error::Succeeded; | 46 return FWL_Error::Succeeded; |
| 48 } | 47 } |
| 49 | 48 |
| 50 CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(IFWL_FormProxy* pOwner) | 49 CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(IFWL_FormProxy* pOwner) |
| 51 : m_pOwner(pOwner) {} | 50 : m_pOwner(pOwner) {} |
| 52 | 51 |
| 53 void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 52 void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 54 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr); | 53 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr); |
| 55 pDelegate->OnProcessMessage(pMessage); | 54 pDelegate->OnProcessMessage(pMessage); |
| 56 } | 55 } |
| OLD | NEW |