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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "../core/include/fwl_targetimp.h" | 8 #include "../core/include/fwl_targetimp.h" |
9 #include "../core/include/fwl_noteimp.h" | 9 #include "../core/include/fwl_noteimp.h" |
10 #include "../core/include/fwl_widgetimp.h" | 10 #include "../core/include/fwl_widgetimp.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { | 27 FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { |
28 if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { | 28 if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { |
29 return TRUE; | 29 return TRUE; |
30 } | 30 } |
31 return CFWL_FormImp::IsInstance(wsClass); | 31 return CFWL_FormImp::IsInstance(wsClass); |
32 } | 32 } |
33 FWL_ERR CFWL_FormProxyImp::Initialize() { | 33 FWL_ERR CFWL_FormProxyImp::Initialize() { |
34 _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), | 34 _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), |
35 FWL_ERR_Indefinite); | 35 FWL_ERR_Indefinite); |
36 m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_FormProxyImpDelegate(this); | 36 m_pDelegate = new CFWL_FormProxyImpDelegate(this); |
37 return FWL_ERR_Succeeded; | 37 return FWL_ERR_Succeeded; |
38 } | 38 } |
39 FWL_ERR CFWL_FormProxyImp::Finalize() { | 39 FWL_ERR CFWL_FormProxyImp::Finalize() { |
40 if (m_pDelegate) { | 40 delete m_pDelegate; |
41 delete (CFWL_FormProxyImpDelegate*)m_pDelegate; | 41 m_pDelegate = nullptr; |
42 m_pDelegate = NULL; | |
43 } | |
44 return CFWL_WidgetImp::Finalize(); | 42 return CFWL_WidgetImp::Finalize(); |
45 } | 43 } |
46 FWL_ERR CFWL_FormProxyImp::Update() { | 44 FWL_ERR CFWL_FormProxyImp::Update() { |
47 return FWL_ERR_Succeeded; | 45 return FWL_ERR_Succeeded; |
48 } | 46 } |
49 FWL_ERR CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, | 47 FWL_ERR CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, |
50 const CFX_Matrix* pMatrix) { | 48 const CFX_Matrix* pMatrix) { |
51 return FWL_ERR_Succeeded; | 49 return FWL_ERR_Succeeded; |
52 } | 50 } |
53 CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner) | 51 CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner) |
54 : m_pOwner(pOwner) {} | 52 : m_pOwner(pOwner) {} |
55 int32_t CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 53 int32_t CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
56 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(NULL); | 54 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(NULL); |
57 return pDelegate->OnProcessMessage(pMessage); | 55 return pDelegate->OnProcessMessage(pMessage); |
58 } | 56 } |
OLD | NEW |