| 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 "include/fwl_targetimp.h" | 8 #include "include/fwl_targetimp.h" |
| 9 #include "include/fwl_noteimp.h" | 9 #include "include/fwl_noteimp.h" |
| 10 #include "include/fwl_widgetimp.h" | 10 #include "include/fwl_widgetimp.h" |
| 11 #include "include/fwl_panelimp.h" | 11 #include "include/fwl_panelimp.h" |
| 12 IFWL_Panel* IFWL_Panel::Create() { | 12 IFWL_Panel* IFWL_Panel::Create() { |
| 13 return new IFWL_Panel; | 13 return new IFWL_Panel; |
| 14 } | 14 } |
| 15 FWL_ERR IFWL_Panel::Initialize(IFWL_Widget* pOuter) { | 15 FWL_ERR IFWL_Panel::Initialize(IFWL_Widget* pOuter) { |
| 16 m_pImpl = new CFWL_PanelImp(pOuter); | 16 CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(pOuter); |
| 17 ((CFWL_PanelImp*)m_pImpl)->SetInterface(this); | 17 SetImpl(pPanelImpl); |
| 18 return ((CFWL_PanelImp*)m_pImpl)->Initialize(); | 18 pPanelImpl->SetInterface(this); |
| 19 return pPanelImpl->Initialize(); |
| 19 } | 20 } |
| 20 FWL_ERR IFWL_Panel::Initialize(CFWL_WidgetImpProperties& properties, | 21 FWL_ERR IFWL_Panel::Initialize(CFWL_WidgetImpProperties& properties, |
| 21 IFWL_Widget* pOuter) { | 22 IFWL_Widget* pOuter) { |
| 22 m_pImpl = new CFWL_PanelImp(properties, pOuter); | 23 CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(properties, pOuter); |
| 23 ((CFWL_PanelImp*)m_pImpl)->SetInterface(this); | 24 SetImpl(pPanelImpl); |
| 24 return ((CFWL_PanelImp*)m_pImpl)->Initialize(); | 25 pPanelImpl->SetInterface(this); |
| 26 return pPanelImpl->Initialize(); |
| 25 } | 27 } |
| 26 IFWL_Content* IFWL_Panel::GetContent() { | 28 IFWL_Content* IFWL_Panel::GetContent() { |
| 27 return ((CFWL_PanelImp*)m_pImpl)->GetContent(); | 29 return static_cast<CFWL_PanelImp*>(GetImpl())->GetContent(); |
| 28 } | 30 } |
| 29 FWL_ERR IFWL_Panel::SetContent(IFWL_Content* pContent) { | 31 FWL_ERR IFWL_Panel::SetContent(IFWL_Content* pContent) { |
| 30 return ((CFWL_PanelImp*)m_pImpl)->SetContent(pContent); | 32 return static_cast<CFWL_PanelImp*>(GetImpl())->SetContent(pContent); |
| 31 } | 33 } |
| 32 IFWL_Panel::IFWL_Panel() { | 34 IFWL_Panel::IFWL_Panel() { |
| 33 m_pImpl = NULL; | |
| 34 } | |
| 35 IFWL_Panel::~IFWL_Panel() { | |
| 36 if (m_pImpl) { | |
| 37 delete (CFWL_PanelImp*)m_pImpl; | |
| 38 m_pImpl = NULL; | |
| 39 } | |
| 40 } | 35 } |
| 41 CFWL_PanelImp::CFWL_PanelImp(IFWL_Widget* pOuter) | 36 CFWL_PanelImp::CFWL_PanelImp(IFWL_Widget* pOuter) |
| 42 : CFWL_WidgetImp(pOuter), m_pContent(NULL) {} | 37 : CFWL_WidgetImp(pOuter), m_pContent(NULL) {} |
| 43 CFWL_PanelImp::CFWL_PanelImp(const CFWL_WidgetImpProperties& properties, | 38 CFWL_PanelImp::CFWL_PanelImp(const CFWL_WidgetImpProperties& properties, |
| 44 IFWL_Widget* pOuter) | 39 IFWL_Widget* pOuter) |
| 45 : CFWL_WidgetImp(properties, pOuter), m_pContent(NULL) {} | 40 : CFWL_WidgetImp(properties, pOuter), m_pContent(NULL) {} |
| 46 CFWL_PanelImp::~CFWL_PanelImp() {} | 41 CFWL_PanelImp::~CFWL_PanelImp() {} |
| 47 FWL_ERR CFWL_PanelImp::GetClassName(CFX_WideString& wsClass) const { | 42 FWL_ERR CFWL_PanelImp::GetClassName(CFX_WideString& wsClass) const { |
| 48 wsClass = FWL_CLASS_Panel; | 43 wsClass = FWL_CLASS_Panel; |
| 49 return FWL_ERR_Succeeded; | 44 return FWL_ERR_Succeeded; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return pContent->SetParent(m_pInterface); | 130 return pContent->SetParent(m_pInterface); |
| 136 } | 131 } |
| 137 FWL_ERR CFWL_CustomPanelImp::SetProxy(IFWL_Proxy* pProxy) { | 132 FWL_ERR CFWL_CustomPanelImp::SetProxy(IFWL_Proxy* pProxy) { |
| 138 m_pProxy = pProxy; | 133 m_pProxy = pProxy; |
| 139 return FWL_ERR_Succeeded; | 134 return FWL_ERR_Succeeded; |
| 140 } | 135 } |
| 141 IFWL_CustomPanel* IFWL_CustomPanel::Create() { | 136 IFWL_CustomPanel* IFWL_CustomPanel::Create() { |
| 142 return new IFWL_CustomPanel; | 137 return new IFWL_CustomPanel; |
| 143 } | 138 } |
| 144 FWL_ERR IFWL_CustomPanel::Initialize(IFWL_Widget* pOuter) { | 139 FWL_ERR IFWL_CustomPanel::Initialize(IFWL_Widget* pOuter) { |
| 145 m_pImpl = new CFWL_CustomPanelImp(pOuter); | 140 CFWL_CustomPanelImp* pCustomPanelImpl = new CFWL_CustomPanelImp(pOuter); |
| 146 ((CFWL_CustomPanelImp*)m_pImpl)->SetInterface(this); | 141 SetImpl(pCustomPanelImpl); |
| 147 return ((CFWL_CustomPanelImp*)m_pImpl)->Initialize(); | 142 pCustomPanelImpl->SetInterface(this); |
| 143 return pCustomPanelImpl->Initialize(); |
| 148 } | 144 } |
| 149 FWL_ERR IFWL_CustomPanel::Initialize(CFWL_WidgetImpProperties& properties, | 145 FWL_ERR IFWL_CustomPanel::Initialize(CFWL_WidgetImpProperties& properties, |
| 150 IFWL_Widget* pOuter) { | 146 IFWL_Widget* pOuter) { |
| 151 m_pImpl = new CFWL_CustomPanelImp(properties, pOuter); | 147 CFWL_CustomPanelImp* pCustomPanelImpl = |
| 152 ((CFWL_CustomPanelImp*)m_pImpl)->SetInterface(this); | 148 new CFWL_CustomPanelImp(properties, pOuter); |
| 153 return ((CFWL_CustomPanelImp*)m_pImpl)->Initialize(); | 149 SetImpl(pCustomPanelImpl); |
| 150 pCustomPanelImpl->SetInterface(this); |
| 151 return pCustomPanelImpl->Initialize(); |
| 154 } | 152 } |
| 155 IFWL_Content* IFWL_CustomPanel::GetContent() { | 153 IFWL_Content* IFWL_CustomPanel::GetContent() { |
| 156 return ((CFWL_CustomPanelImp*)m_pImpl)->GetContent(); | 154 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->GetContent(); |
| 157 } | 155 } |
| 158 FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) { | 156 FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) { |
| 159 return ((CFWL_CustomPanelImp*)m_pImpl)->SetContent(pContent); | 157 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetContent(pContent); |
| 160 } | 158 } |
| 161 FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) { | 159 FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) { |
| 162 return ((CFWL_CustomPanelImp*)m_pImpl)->SetProxy(pProxy); | 160 return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetProxy(pProxy); |
| 163 } | 161 } |
| 164 IFWL_CustomPanel::IFWL_CustomPanel() { | 162 IFWL_CustomPanel::IFWL_CustomPanel() { |
| 165 m_pImpl = NULL; | |
| 166 } | 163 } |
| 167 IFWL_CustomPanel::~IFWL_CustomPanel() { | |
| 168 if (m_pImpl) { | |
| 169 delete (CFWL_CustomPanelImp*)m_pImpl; | |
| 170 m_pImpl = NULL; | |
| 171 } | |
| 172 } | |
| OLD | NEW |