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