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