summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_widget.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-02 14:51:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-02 14:51:25 -0700
commit3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (patch)
tree365d9ee7f8eec1103fb9fce0986e23d9f548ecae /xfa/fwl/core/ifwl_widget.cpp
parent4cf551577856f89103e162edc761def44ffb96fc (diff)
downloadpdfium-3b3ce1a242f8445848d3f23d6c35ba01d7c645f4.tar.xz
Merge delegates into IFWL_* classes.
This Cl removes ownership of the delgates from IFWL_Widget and puts it in the hand of the creating classes. In doing so, merge the delegates back into the IFWL_* classes to simplify logic. Review-Url: https://codereview.chromium.org/2467993003
Diffstat (limited to 'xfa/fwl/core/ifwl_widget.cpp')
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp
index 961c02497b..f57d0a11c7 100644
--- a/xfa/fwl/core/ifwl_widget.cpp
+++ b/xfa/fwl/core/ifwl_widget.cpp
@@ -30,12 +30,12 @@ IFWL_Widget::IFWL_Widget(const IFWL_App* app,
: m_pOwnerApp(app),
m_pWidgetMgr(app->GetWidgetMgr()),
m_pProperties(new CFWL_WidgetImpProperties(properties)),
- m_pCurDelegate(nullptr),
m_pOuter(pOuter),
m_pLayoutItem(nullptr),
m_pAssociate(nullptr),
m_iLock(0),
- m_nEventKey(0) {
+ m_nEventKey(0),
+ m_pDelegate(nullptr) {
ASSERT(m_pWidgetMgr);
IFWL_Widget* pParent = m_pProperties->m_pParent;
@@ -97,7 +97,7 @@ FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
ev.m_rtOld = rtOld;
ev.m_rtNew = rect;
- if (IFWL_WidgetDelegate* pDelegate = GetCurrentDelegate())
+ if (IFWL_WidgetDelegate* pDelegate = GetDelegate())
pDelegate->OnProcessEvent(&ev);
}
return FWL_Error::Succeeded;
@@ -348,16 +348,6 @@ FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
return FWL_Error::Succeeded;
}
-IFWL_WidgetDelegate* IFWL_Widget::GetCurrentDelegate() {
- if (!m_pCurDelegate)
- m_pCurDelegate = m_pDelegate.get();
- return m_pCurDelegate;
-}
-
-void IFWL_Widget::SetCurrentDelegate(IFWL_WidgetDelegate* pDelegate) {
- m_pCurDelegate = pDelegate;
-}
-
const IFWL_App* IFWL_Widget::GetOwnerApp() const {
return m_pOwnerApp;
}
@@ -720,7 +710,7 @@ void IFWL_Widget::DispatchKeyEvent(CFWL_MsgKey* pNote) {
void IFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (m_pOuter) {
- m_pOuter->GetCurrentDelegate()->OnProcessEvent(pEvent);
+ m_pOuter->GetDelegate()->OnProcessEvent(pEvent);
return;
}
const IFWL_App* pApp = GetOwnerApp();
@@ -838,9 +828,7 @@ FX_BOOL IFWL_Widget::IsParent(IFWL_Widget* pParent) {
return FALSE;
}
-CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {}
-
-void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+void IFWL_Widget::OnProcessMessage(CFWL_Message* pMessage) {
if (!pMessage->m_pDstTarget)
return;
@@ -908,10 +896,7 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
}
}
-void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
+void IFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {}
-void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- CFWL_EvtDraw evt;
- evt.m_pGraphics = pGraphics;
-}
+void IFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {}