From 20855384b8149a631c3c1d229551523c12eb767b Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 31 Oct 2016 07:29:34 -0700 Subject: Remove FWL globals. This CL removes the FWL_GetApp, FWL_SetApp and FWL_GetWidgetAdapter methods. In the process it changes the various Initialize methods to return void. Review-Url: https://codereview.chromium.org/2436103002 --- xfa/fwl/core/cfwl_widget.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'xfa/fwl/core/cfwl_widget.cpp') diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index 7f6bd3b07c..d7903ea8a8 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -18,9 +18,10 @@ #define FWL_WGT_CalcWidth 2048 #define FWL_WGT_CalcMultiLineDefWidth 120.0f -CFWL_Widget::CFWL_Widget() - : m_pDelegate(nullptr), - m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), +CFWL_Widget::CFWL_Widget(const IFWL_App* app) + : m_pApp(app), + m_pDelegate(nullptr), + m_pWidgetMgr(app->GetWidgetMgr()), m_pProperties(new CFWL_WidgetProperties) { ASSERT(m_pWidgetMgr); } @@ -30,6 +31,11 @@ CFWL_Widget::~CFWL_Widget() { m_pIface->Finalize(); } +void CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { + ASSERT(m_pIface); + m_pIface->SetAssociateWidget(this); +} + IFWL_Widget* CFWL_Widget::GetWidget() { return m_pIface.get(); } @@ -38,13 +44,6 @@ const IFWL_Widget* CFWL_Widget::GetWidget() const { return m_pIface.get(); } -FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { - if (!m_pIface) - return FWL_Error::Indefinite; - m_pIface->SetAssociateWidget(this); - return FWL_Error::Succeeded; -} - FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (!m_pIface) return FWL_Error::Indefinite; -- cgit v1.2.3