summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-28 10:51:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 10:51:13 -0700
commit7322343b9322b93d97077575f95a00dcca3f0451 (patch)
tree36337e0a2aff2147a9067477f982496129f0f7a1 /xfa/fwl
parente6ebf7af7ea94d48091be300cec84b499d3b8ae0 (diff)
downloadpdfium-7322343b9322b93d97077575f95a00dcca3f0451.tar.xz
More FWL interface cleanup.
This CL merges the IFWL_Target class into IFWL_Widget and IFWL_Thread into IFWL_App. The IFWL_WidgetMgrDelegate, IFWL_NoteDriver and IFWL_NotThread are removed in favour of their concrete classes. Review-Url: https://codereview.chromium.org/1921853006
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_barcodeimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_checkboximp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.cpp22
-rw-r--r--xfa/fwl/basewidget/fwl_datetimepickerimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp2
-rw-r--r--xfa/fwl/basewidget/fwl_formproxyimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_monthcalendarimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_pictureboximp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_pushbuttonimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_scrollbarimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_spinbuttonimp.cpp1
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp1
-rw-r--r--xfa/fwl/core/cfwl_themepart.h3
-rw-r--r--xfa/fwl/core/fwl_appimp.cpp22
-rw-r--r--xfa/fwl/core/fwl_appimp.h17
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp46
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp23
-rw-r--r--xfa/fwl/core/fwl_noteimp.h54
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.cpp4
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.h2
-rw-r--r--xfa/fwl/core/fwl_targetimp.cpp44
-rw-r--r--xfa/fwl/core/fwl_targetimp.h27
-rw-r--r--xfa/fwl/core/fwl_threadimp.cpp20
-rw-r--r--xfa/fwl/core/fwl_threadimp.h33
-rw-r--r--xfa/fwl/core/fwl_timerimp.cpp2
-rw-r--r--xfa/fwl/core/fwl_widgetimp.cpp103
-rw-r--r--xfa/fwl/core/fwl_widgetimp.h24
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.cpp20
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.h25
-rw-r--r--xfa/fwl/core/ifwl_adapternative.h4
-rw-r--r--xfa/fwl/core/ifwl_adapterthreadmgr.h5
-rw-r--r--xfa/fwl/core/ifwl_app.h34
-rw-r--r--xfa/fwl/core/ifwl_notedriver.h49
-rw-r--r--xfa/fwl/core/ifwl_noteloop.h21
-rw-r--r--xfa/fwl/core/ifwl_target.h52
-rw-r--r--xfa/fwl/core/ifwl_thread.h43
-rw-r--r--xfa/fwl/core/ifwl_widget.h42
-rw-r--r--xfa/fwl/core/ifwl_widgetmgrdelegate.h33
-rw-r--r--xfa/fwl/lightwidget/cfwl_tooltip.cpp2
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp38
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp1
43 files changed, 324 insertions, 505 deletions
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
index cc0bd62257..d4589e39c1 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
@@ -10,7 +10,6 @@
#include "xfa/fwl/basewidget/fxmath_barcodeimp.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp
index 959398cbd2..3cb2ed60f7 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.cpp
+++ b/xfa/fwl/basewidget/fwl_caretimp.cpp
@@ -9,7 +9,6 @@
#include "xfa/fwl/basewidget/ifwl_caret.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp
index e511b8e444..76d5b8f421 100644
--- a/xfa/fwl/basewidget/fwl_checkboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp
index d04c641fa3..60794da476 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp
@@ -18,12 +18,10 @@
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
+#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
-#include "xfa/fwl/core/ifwl_thread.h"
// static
IFWL_ComboBox* IFWL_ComboBox::Create(
@@ -1457,8 +1455,8 @@ FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
}
void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
- IFWL_Target* pDstTarget = pMsg->m_pDstTarget;
- IFWL_Target* pSrcTarget = pMsg->m_pSrcTarget;
+ IFWL_Widget* pDstTarget = pMsg->m_pDstTarget;
+ IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget;
FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
if (bSet) {
m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
@@ -1803,11 +1801,12 @@ FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
return FWL_ERR_Succeeded;
}
void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
- IFWL_Thread* pThread = m_pForm->GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = m_pForm->GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
CFX_RectF rtWidget;
m_pForm->GetWidgetRect(rtWidget);
rtWidget.left = rtWidget.top = 0;
@@ -1822,11 +1821,12 @@ void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonDown = FALSE;
- IFWL_Thread* pThread = m_pForm->GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = m_pForm->GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
pDriver->SetGrab(m_pForm, FALSE);
if (m_bLButtonUpSelf) {
CFX_RectF rect;
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
index 94fa549fe4..941b222789 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index 74db0c96af..86c6fe8874 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -22,8 +22,6 @@
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp
index b86f287cee..0a5bb67aec 100644
--- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp
+++ b/xfa/fwl/basewidget/fwl_formproxyimp.cpp
@@ -8,7 +8,6 @@
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties,
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp
index 49d5d41d87..9b5d2fc424 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_listboximp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
index 32cec6d2e7..4b7f342bf7 100644
--- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp
index e61dae3b2b..4495a495ba 100644
--- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp
@@ -7,7 +7,6 @@
#include "xfa/fwl/basewidget/fwl_pictureboximp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/lightwidget/cfwl_picturebox.h"
diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
index 167d8f3c1f..9d6e3b19a9 100644
--- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
+++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
@@ -12,7 +12,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
index fed93fbc07..69c28959d9 100644
--- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
+++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
@@ -11,7 +11,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
index 6d60d81e81..434f6ddacf 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
@@ -11,7 +11,6 @@
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
index 36751b637d..2ce52c65a4 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
@@ -13,7 +13,6 @@
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_tooltiptarget.h"
diff --git a/xfa/fwl/core/cfwl_themepart.h b/xfa/fwl/core/cfwl_themepart.h
index 5868465c08..df75a94f85 100644
--- a/xfa/fwl/core/cfwl_themepart.h
+++ b/xfa/fwl/core/cfwl_themepart.h
@@ -9,7 +9,6 @@
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/ifwl_widget.h"
enum class CFWL_Part {
None = 0,
@@ -78,6 +77,8 @@ enum CFWL_PartState {
CFWL_PartState_Selected = 1 << 14
};
+class IFWL_Widget;
+
class CFWL_ThemePart {
public:
CFWL_ThemePart()
diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp
index 95ed0c90cc..0017aad8ad 100644
--- a/xfa/fwl/core/fwl_appimp.cpp
+++ b/xfa/fwl/core/fwl_appimp.cpp
@@ -7,8 +7,6 @@
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
@@ -19,32 +17,46 @@ IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) {
pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter));
return pApp;
}
+
+void IFWL_App::Release() {}
+
FWL_ERR IFWL_App::Initialize() {
return static_cast<CFWL_AppImp*>(GetImpl())->Initialize();
}
+
FWL_ERR IFWL_App::Finalize() {
return static_cast<CFWL_AppImp*>(GetImpl())->Finalize();
}
+
IFWL_AdapterNative* IFWL_App::GetAdapterNative() {
return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative();
}
+
IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() {
return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr();
}
+
IFWL_ThemeProvider* IFWL_App::GetThemeProvider() {
return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider();
}
+
FWL_ERR IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider);
}
+
FWL_ERR IFWL_App::Exit(int32_t iExitCode) {
return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode);
}
+CFWL_NoteDriver* IFWL_App::GetNoteDriver() const {
+ return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver();
+}
+
CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter)
- : CFWL_ThreadImp(pIface),
- m_pAdapterNative(pAdapter),
- m_pThemeProvider(nullptr) {}
+ : m_pAdapterNative(pAdapter),
+ m_pThemeProvider(nullptr),
+ m_pNoteDriver(new CFWL_NoteDriver),
+ m_pIface(pIface) {}
CFWL_AppImp::~CFWL_AppImp() {
CFWL_ToolTipContainer::DeleteInstance();
diff --git a/xfa/fwl/core/fwl_appimp.h b/xfa/fwl/core/fwl_appimp.h
index a7130602fd..8743b54a43 100644
--- a/xfa/fwl/core/fwl_appimp.h
+++ b/xfa/fwl/core/fwl_appimp.h
@@ -9,18 +9,23 @@
#include <memory>
-#include "xfa/fwl/core/fwl_threadimp.h"
+#include "xfa/fwl/core/fwl_noteimp.h"
class CFWL_WidgetMgr;
class IFWL_AdapterNative;
-class IFWL_WidgetMgr;
-class IFWL_ThemeProvider;
class IFWL_App;
+class IFWL_NoteThread;
+class IFWL_ThemeProvider;
+class IFWL_WidgetMgr;
-class CFWL_AppImp : public CFWL_ThreadImp {
+class CFWL_AppImp {
public:
CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter);
virtual ~CFWL_AppImp();
+
+ IFWL_App* GetInterface() const { return m_pIface; }
+ CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); }
+
virtual FWL_ERR Initialize();
virtual FWL_ERR Finalize();
virtual IFWL_AdapterNative* GetAdapterNative() const;
@@ -33,6 +38,10 @@ class CFWL_AppImp : public CFWL_ThreadImp {
IFWL_AdapterNative* const m_pAdapterNative;
std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr;
IFWL_ThemeProvider* m_pThemeProvider;
+ std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver;
+
+ private:
+ IFWL_App* const m_pIface;
};
#endif // XFA_FWL_CORE_FWL_APPIMP_H_
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index e31f7e8202..815aca974c 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -14,8 +14,6 @@
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
@@ -389,12 +387,14 @@ FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) {
return FWL_ERR_Succeeded;
}
IFWL_Widget* CFWL_FormImp::DoModal() {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
- return NULL;
- IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
+ return nullptr;
+
+ CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
- return NULL;
+ return nullptr;
+
m_pNoteLoop = new CFWL_NoteLoop(this);
pDriver->PushNoteLoop(m_pNoteLoop);
m_bDoModalFlag = TRUE;
@@ -417,13 +417,15 @@ FWL_ERR CFWL_FormImp::EndDoModal() {
m_bDoModalFlag = FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
m_pNoteLoop->EndModalLoop();
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return FWL_ERR_Indefinite;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pDriver)
return FWL_ERR_Indefinite;
+
pDriver->PopNoteLoop();
SetStates(FWL_WGTSTATE_Invisible, TRUE);
return FWL_ERR_Succeeded;
@@ -745,23 +747,27 @@ void CFWL_FormImp::ReSetSysBtn() {
}
}
void CFWL_FormImp::RegisterForm() {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pDriver)
return;
+
pDriver->RegisterForm(this);
}
void CFWL_FormImp::UnRegisterForm() {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pDriver)
return;
+
pDriver->UnRegisterForm(this);
}
FX_BOOL CFWL_FormImp::IsDoModal() {
@@ -888,9 +894,9 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
switch (pMessage->GetClassID()) {
case CFWL_MessageType::Activate: {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
- IFWL_Thread* pThread = m_pOwner->GetOwnerThread();
+ IFWL_App* pApp = m_pOwner->GetOwnerApp();
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
IFWL_Widget* pSubFocus =
pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
@@ -902,9 +908,9 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
}
case CFWL_MessageType::Deactivate: {
m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated;
- IFWL_Thread* pThread = m_pOwner->GetOwnerThread();
+ IFWL_App* pApp = m_pOwner->GetOwnerApp();
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
IFWL_Widget* pSubFocus =
pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index cc548a5728..267b2ca2ee 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -12,8 +12,6 @@
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_formimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
@@ -31,7 +29,7 @@ FWL_ERR CFWL_NoteLoop::Idle(int32_t count) {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return FWL_ERR_Indefinite;
- IFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
+ CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
return FWL_ERR_Indefinite;
pDriver->SendEvent(&ev);
@@ -63,12 +61,14 @@ FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) {
void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
CFWL_EvtMenuCommand ev;
ev.m_iCommand = dwCommand;
- IFWL_Thread* pThread = m_pForm->GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = m_pForm->GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
return;
+
pDriver->SendEvent(&ev);
}
CFWL_NoteDriver::CFWL_NoteDriver()
@@ -153,18 +153,19 @@ FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) {
void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
ClearInvalidEventTargets(bRemoveAll);
}
-IFWL_Thread* CFWL_NoteDriver::GetOwnerThread() const {
+IFWL_App* CFWL_NoteDriver::GetOwnerApp() const {
return FWL_GetApp();
}
-FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) {
+FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
m_noteLoopQueue.Add(pNoteLoop);
return FWL_ERR_Succeeded;
}
-IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
+CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
int32_t pos = m_noteLoopQueue.GetSize();
if (pos <= 0)
- return NULL;
- IFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
+ return nullptr;
+
+ CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
m_noteLoopQueue.RemoveAt(pos - 1);
return p;
}
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index f51f09cf00..8607a334f1 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -7,10 +7,20 @@
#ifndef XFA_FWL_CORE_FWL_NOTEIMP_H_
#define XFA_FWL_CORE_FWL_NOTEIMP_H_
-#include "xfa/fwl/core/ifwl_notedriver.h"
-#include "xfa/fwl/core/ifwl_noteloop.h"
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_message.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/include/cfx_graphics.h"
+#define FWL_KEYFLAG_Ctrl (1 << 0)
+#define FWL_KEYFLAG_Alt (1 << 1)
+#define FWL_KEYFLAG_Shift (1 << 2)
+#define FWL_KEYFLAG_Command (1 << 3)
+#define FWL_KEYFLAG_LButton (1 << 4)
+#define FWL_KEYFLAG_RButton (1 << 5)
+#define FWL_KEYFLAG_MButton (1 << 6)
+
class CFWL_CoreToolTipDP;
class CFWL_MsgActivate;
class CFWL_MsgDeactivate;
@@ -27,14 +37,12 @@ class CFWL_ToolTipImp;
class CFWL_WidgetImp;
class IFWL_ToolTipTarget;
-class CFWL_NoteLoop : public IFWL_NoteLoop {
+class CFWL_NoteLoop {
public:
CFWL_NoteLoop(CFWL_WidgetImp* pForm = nullptr);
- ~CFWL_NoteLoop() override {}
-
- // IFWL_NoteLoop:
- FWL_ERR Idle(int32_t count) override;
+ ~CFWL_NoteLoop() {}
+ FWL_ERR Idle(int32_t count);
CFWL_WidgetImp* GetForm();
FX_BOOL ContinueModal();
FWL_ERR EndModalLoop();
@@ -47,25 +55,24 @@ class CFWL_NoteLoop : public IFWL_NoteLoop {
FX_BOOL m_bContinueModal;
};
-class CFWL_NoteDriver : public IFWL_NoteDriver {
+class CFWL_NoteDriver {
public:
CFWL_NoteDriver();
- ~CFWL_NoteDriver() override;
+ ~CFWL_NoteDriver();
- // IFWL_NoteDriver:
- FX_BOOL SendEvent(CFWL_Event* pNote) override;
+ FX_BOOL SendEvent(CFWL_Event* pNote);
FWL_ERR RegisterEventTarget(IFWL_Widget* pListener,
IFWL_Widget* pEventSource = nullptr,
- uint32_t dwFilter = FWL_EVENT_ALL_MASK) override;
- FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) override;
- void ClearEventTargets(FX_BOOL bRemoveAll) override;
- IFWL_Thread* GetOwnerThread() const override;
- FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) override;
- IFWL_NoteLoop* PopNoteLoop() override;
- IFWL_Widget* GetFocus() override;
- FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) override;
- void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) override;
- FWL_ERR Run() override;
+ uint32_t dwFilter = FWL_EVENT_ALL_MASK);
+ FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener);
+ void ClearEventTargets(FX_BOOL bRemoveAll);
+ IFWL_App* GetOwnerApp() const;
+ FWL_ERR PushNoteLoop(CFWL_NoteLoop* pNoteLoop);
+ CFWL_NoteLoop* PopNoteLoop();
+ IFWL_Widget* GetFocus();
+ FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE);
+ void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet);
+ FWL_ERR Run();
IFWL_Widget* GetHover();
void SetHover(IFWL_Widget* pHover);
@@ -96,9 +103,10 @@ class CFWL_NoteDriver : public IFWL_NoteDriver {
FX_BOOL IsValidMessage(CFWL_Message* pMessage);
IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
void ClearInvalidEventTargets(FX_BOOL bRemoveAll);
- CFX_ArrayTemplate<CFWL_TargetImp*> m_forms;
+
+ CFX_ArrayTemplate<CFWL_WidgetImp*> m_forms;
CFX_ArrayTemplate<CFWL_Message*> m_noteQueue;
- CFX_ArrayTemplate<IFWL_NoteLoop*> m_noteLoopQueue;
+ CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue;
CFX_MapPtrToPtr m_eventTargets;
int32_t m_sendEventCalled;
IFWL_Widget* m_pHover;
diff --git a/xfa/fwl/core/fwl_sdadapterimp.cpp b/xfa/fwl/core/fwl_sdadapterimp.cpp
index 76cbad6b86..c4dc61a8d1 100644
--- a/xfa/fwl/core/fwl_sdadapterimp.cpp
+++ b/xfa/fwl/core/fwl_sdadapterimp.cpp
@@ -8,8 +8,6 @@
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_adapterthreadmgr.h"
#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
@@ -148,6 +146,6 @@ CFWL_SDAdapterThreadMgr::CFWL_SDAdapterThreadMgr() {}
CFWL_SDAdapterThreadMgr::~CFWL_SDAdapterThreadMgr() {}
-IFWL_Thread* CFWL_SDAdapterThreadMgr::GetCurrentThread() {
+IFWL_App* CFWL_SDAdapterThreadMgr::GetCurrentThread() {
return FWL_GetApp();
}
diff --git a/xfa/fwl/core/fwl_sdadapterimp.h b/xfa/fwl/core/fwl_sdadapterimp.h
index 3bd176afe8..cd2ac8d6d8 100644
--- a/xfa/fwl/core/fwl_sdadapterimp.h
+++ b/xfa/fwl/core/fwl_sdadapterimp.h
@@ -74,7 +74,7 @@ class CFWL_SDAdapterThreadMgr : public IFWL_AdapterThreadMgr {
~CFWL_SDAdapterThreadMgr();
public:
- virtual IFWL_Thread* GetCurrentThread();
+ virtual IFWL_App* GetCurrentThread();
};
#endif // XFA_FWL_CORE_FWL_SDADAPTERIMP_H_
diff --git a/xfa/fwl/core/fwl_targetimp.cpp b/xfa/fwl/core/fwl_targetimp.cpp
deleted file mode 100644
index 1e63efe0a0..0000000000
--- a/xfa/fwl/core/fwl_targetimp.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fwl/core/fwl_targetimp.h"
-
-FWL_ERR IFWL_Target::GetClassName(CFX_WideString& wsClass) const {
- return m_pImpl->GetClassName(wsClass);
-}
-uint32_t IFWL_Target::GetClassID() const {
- return m_pImpl->GetClassID();
-}
-FX_BOOL IFWL_Target::IsInstance(const CFX_WideStringC& wsClass) const {
- return m_pImpl->IsInstance(wsClass);
-}
-FWL_ERR IFWL_Target::Initialize() {
- return m_pImpl->Initialize();
-}
-FWL_ERR IFWL_Target::Finalize() {
- return m_pImpl->Finalize();
-}
-IFWL_Target::~IFWL_Target() {
- delete m_pImpl;
-}
-CFWL_TargetImp::CFWL_TargetImp() {}
-CFWL_TargetImp::~CFWL_TargetImp() {}
-FWL_ERR CFWL_TargetImp::GetClassName(CFX_WideString& wsClass) const {
- wsClass.clear();
- return FWL_ERR_Succeeded;
-}
-uint32_t CFWL_TargetImp::GetClassID() const {
- return 0;
-}
-FX_BOOL CFWL_TargetImp::IsInstance(const CFX_WideStringC& wsClass) const {
- return FALSE;
-}
-FWL_ERR CFWL_TargetImp::Initialize() {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_TargetImp::Finalize() {
- return FWL_ERR_Succeeded;
-}
diff --git a/xfa/fwl/core/fwl_targetimp.h b/xfa/fwl/core/fwl_targetimp.h
deleted file mode 100644
index c1a5e56c2a..0000000000
--- a/xfa/fwl/core/fwl_targetimp.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_FWL_TARGETIMP_H_
-#define XFA_FWL_CORE_FWL_TARGETIMP_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fwl/core/ifwl_target.h"
-
-class CFWL_TargetImp {
- public:
- virtual ~CFWL_TargetImp();
-
- virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
- virtual uint32_t GetClassID() const;
- virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
- virtual FWL_ERR Initialize();
- virtual FWL_ERR Finalize();
-
- protected:
- CFWL_TargetImp();
-};
-
-#endif // XFA_FWL_CORE_FWL_TARGETIMP_H_
diff --git a/xfa/fwl/core/fwl_threadimp.cpp b/xfa/fwl/core/fwl_threadimp.cpp
deleted file mode 100644
index d6036b7e3d..0000000000
--- a/xfa/fwl/core/fwl_threadimp.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fwl/core/fwl_threadimp.h"
-
-#include "xfa/fwl/core/fwl_appimp.h"
-#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/ifwl_thread.h"
-
-void IFWL_Thread::Release() {
- delete m_pImpl;
-}
-
-IFWL_NoteDriver* IFWL_Thread::GetNoteDriver() const {
- return static_cast<CFWL_ThreadImp*>(GetImpl())->GetNoteDriver();
-}
diff --git a/xfa/fwl/core/fwl_threadimp.h b/xfa/fwl/core/fwl_threadimp.h
deleted file mode 100644
index d10d493899..0000000000
--- a/xfa/fwl/core/fwl_threadimp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_FWL_THREADIMP_H_
-#define XFA_FWL_CORE_FWL_THREADIMP_H_
-
-#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/ifwl_thread.h"
-
-class IFWL_NoteDriver;
-class IFWL_NoteThread;
-
-class CFWL_ThreadImp {
- public:
- CFWL_ThreadImp(IFWL_Thread* pIface)
- : m_pNoteDriver(new CFWL_NoteDriver), m_pIface(pIface) {}
-
- virtual ~CFWL_ThreadImp() { delete m_pNoteDriver; }
-
- IFWL_Thread* GetInterface() const { return m_pIface; }
- IFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver; }
-
- protected:
- CFWL_NoteDriver* const m_pNoteDriver;
-
- private:
- IFWL_Thread* const m_pIface;
-};
-
-#endif // XFA_FWL_CORE_FWL_THREADIMP_H_
diff --git a/xfa/fwl/core/fwl_timerimp.cpp b/xfa/fwl/core/fwl_timerimp.cpp
index 1dfed0c584..8a5f8896f5 100644
--- a/xfa/fwl/core/fwl_timerimp.cpp
+++ b/xfa/fwl/core/fwl_timerimp.cpp
@@ -5,8 +5,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fwl/core/fwl_appimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/ifwl_adapternative.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_timer.h"
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp
index df3228c6ed..c9d91c41f2 100644
--- a/xfa/fwl/core/fwl_widgetimp.cpp
+++ b/xfa/fwl/core/fwl_widgetimp.cpp
@@ -17,8 +17,6 @@
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
#include "xfa/fwl/core/ifwl_adapternative.h"
#include "xfa/fwl/core/ifwl_adapterthreadmgr.h"
@@ -30,6 +28,28 @@
#define FWL_CLASSHASH_Menu 3957949655
#define FWL_STYLEEXT_MNU_Vert (1L << 0)
+IFWL_Widget::~IFWL_Widget() {}
+
+FWL_ERR IFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
+ return m_pImpl->GetClassName(wsClass);
+}
+
+uint32_t IFWL_Widget::GetClassID() const {
+ return m_pImpl->GetClassID();
+}
+
+FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
+ return m_pImpl->IsInstance(wsClass);
+}
+
+FWL_ERR IFWL_Widget::Initialize() {
+ return m_pImpl->Initialize();
+}
+
+FWL_ERR IFWL_Widget::Finalize() {
+ return m_pImpl->Finalize();
+}
+
FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
return static_cast<CFWL_WidgetImp*>(GetImpl())
->GetWidgetRect(rect, bAutoSize);
@@ -134,12 +154,13 @@ FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) {
IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate);
}
-IFWL_Thread* IFWL_Widget::GetOwnerThread() const {
- return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerThread();
+IFWL_App* IFWL_Widget::GetOwnerApp() const {
+ return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerApp();
}
CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) {
return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent);
}
+
FWL_ERR CFWL_WidgetImp::Initialize() {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
@@ -150,8 +171,8 @@ FWL_ERR CFWL_WidgetImp::Initialize() {
IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr();
if (!pAdapterThread)
return FWL_ERR_Indefinite;
- SetOwnerThread(static_cast<CFWL_ThreadImp*>(
- pAdapterThread->GetCurrentThread()->GetImpl()));
+ SetOwnerApp(
+ static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl()));
IFWL_Widget* pParent = m_pProperties->m_pParent;
m_pWidgetMgr->InsertWidget(pParent, m_pInterface);
if (!IsChild()) {
@@ -165,6 +186,7 @@ FWL_ERR CFWL_WidgetImp::Initialize() {
}
return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_WidgetImp::Finalize() {
NotifyDriver();
if (!IsChild())
@@ -173,6 +195,20 @@ FWL_ERR CFWL_WidgetImp::Finalize() {
m_pWidgetMgr->RemoveWidget(m_pInterface);
return FWL_ERR_Succeeded;
}
+
+FWL_ERR CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const {
+ wsClass.clear();
+ return FWL_ERR_Succeeded;
+}
+
+uint32_t CFWL_WidgetImp::GetClassID() const {
+ return 0;
+}
+
+FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const {
+ return FALSE;
+}
+
FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
if (HasEdge()) {
@@ -286,7 +322,7 @@ FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if (bSet) {
ret = m_pWidgetMgr->HideWidget_Native(m_pInterface);
CFWL_NoteDriver* noteDriver =
- static_cast<CFWL_NoteDriver*>(GetOwnerThread()->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver());
IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr();
noteDriver->NotifyTargetHide(m_pInterface);
IFWL_Widget* child =
@@ -497,11 +533,11 @@ IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate(
m_pCurDelegate = pDelegate;
return pOldDelegate;
}
-IFWL_Thread* CFWL_WidgetImp::GetOwnerThread() const {
- return static_cast<IFWL_Thread*>(m_pOwnerThread->GetInterface());
+IFWL_App* CFWL_WidgetImp::GetOwnerApp() const {
+ return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface());
}
-FWL_ERR CFWL_WidgetImp::SetOwnerThread(CFWL_ThreadImp* pOwnerThread) {
- m_pOwnerThread = pOwnerThread;
+FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) {
+ m_pOwnerApp = pOwnerApp;
return FWL_ERR_Succeeded;
}
IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
@@ -682,13 +718,16 @@ void CFWL_WidgetImp::CalcTextRect(const CFX_WideString& wsText,
void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) {
if (m_pWidgetMgr->IsFormDisabled())
return;
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pDriver)
return;
+
IFWL_Widget* curFocus = pDriver->GetFocus();
if (bFocus && curFocus != m_pInterface) {
pDriver->SetFocus(m_pInterface);
@@ -697,11 +736,11 @@ void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) {
}
}
void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
pDriver->SetGrab(m_pInterface, bSet);
}
FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight,
@@ -813,21 +852,25 @@ FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) {
}
void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource,
uint32_t dwFilter) {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
+
pNoteDriver->RegisterEventTarget(m_pInterface, pEventSource, dwFilter);
}
void CFWL_WidgetImp::UnregisterEventTarget() {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
+
pNoteDriver->UnregisterEventTarget(m_pInterface);
}
void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) {
@@ -847,10 +890,10 @@ void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) {
pDelegate->OnProcessEvent(pEvent);
return;
}
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
pNoteDriver->SendEvent(pEvent);
@@ -914,13 +957,15 @@ void CFWL_WidgetImp::DrawEdge(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
void CFWL_WidgetImp::NotifyDriver() {
- IFWL_Thread* pThread = GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = GetOwnerApp();
+ if (!pApp)
return;
+
CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pDriver)
return;
+
pDriver->NotifyTargetDestroy(m_pInterface);
}
CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h
index 2e5e761512..9381a4203d 100644
--- a/xfa/fwl/core/fwl_widgetimp.h
+++ b/xfa/fwl/core/fwl_widgetimp.h
@@ -11,23 +11,27 @@
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_themepart.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/ifwl_widgetdelegate.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
+class CFWL_AppImp;
class CFWL_MsgKey;
-class CFWL_ThreadImp;
class CFWL_WidgetImpProperties;
class CFWL_WidgetMgr;
+class IFWL_App;
class IFWL_DataProvider;
-class IFWL_Thread;
class IFWL_ThemeProvider;
class IFWL_Widget;
-class CFWL_WidgetImp : public CFWL_TargetImp {
+class CFWL_WidgetImp {
public:
+ virtual ~CFWL_WidgetImp();
+
virtual FWL_ERR Initialize();
virtual FWL_ERR Finalize();
+ virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
+ virtual uint32_t GetClassID() const;
+ virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR GetGlobalRect(CFX_RectF& rect);
@@ -64,16 +68,18 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
virtual FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider);
virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
- virtual IFWL_Thread* GetOwnerThread() const;
- FWL_ERR SetOwnerThread(CFWL_ThreadImp* pOwnerThread);
+ virtual IFWL_App* GetOwnerApp() const;
+ FWL_ERR SetOwnerApp(CFWL_AppImp* pOwnerApp);
IFWL_Widget* GetInterface() const;
void SetInterface(IFWL_Widget* pInterface);
CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
protected:
+ friend class CFWL_WidgetImpDelegate;
+
CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
- virtual ~CFWL_WidgetImp();
+
FX_BOOL IsEnabled() const;
FX_BOOL IsVisible() const;
FX_BOOL IsActive() const;
@@ -141,10 +147,8 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
FX_BOOL IsParent(IFWL_Widget* pParent);
- friend class CFWL_WidgetImpDelegate;
-
CFWL_WidgetMgr* m_pWidgetMgr;
- CFWL_ThreadImp* m_pOwnerThread;
+ CFWL_AppImp* m_pOwnerApp;
CFWL_WidgetImpProperties* m_pProperties;
CFX_PrivateData* m_pPrivateData;
IFWL_WidgetDelegate* m_pDelegate;
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp
index 0bd1acffc7..b1e0ca822a 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.cpp
+++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp
@@ -9,8 +9,6 @@
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_adapternative.h"
#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
@@ -695,22 +693,24 @@ int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) {
return 0;
if (!pMessage->m_pDstTarget)
return 0;
+
IFWL_Widget* pDstWidget = pMessage->m_pDstTarget;
- IFWL_Thread* pThread = pDstWidget->GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = pDstWidget->GetOwnerApp();
+ if (!pApp)
return 0;
+
CFWL_NoteDriver* pNoteDriver =
- static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
+ static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
if (!pNoteDriver)
return 0;
- if (m_pWidgetMgr->IsThreadEnabled()) {
+
+ if (m_pWidgetMgr->IsThreadEnabled())
pMessage = static_cast<CFWL_Message*>(pMessage->Clone());
- }
- if (m_pWidgetMgr->IsFormDisabled()) {
+ if (m_pWidgetMgr->IsFormDisabled())
pNoteDriver->ProcessMessage(pMessage);
- } else {
+ else
pNoteDriver->QueueMessage(pMessage);
- }
+
#if (_FX_OS_ == _FX_MACOSX_)
CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop();
if (pTopLoop) {
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h
index fa489971c5..528ecdb792 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.h
+++ b/xfa/fwl/core/fwl_widgetmgrimp.h
@@ -7,14 +7,21 @@
#ifndef XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
#define XFA_FWL_CORE_FWL_WIDGETMGRIMP_H_
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_widgetmgr.h"
-#include "xfa/fwl/core/ifwl_widgetmgrdelegate.h"
#include "xfa/fxgraphics/include/cfx_graphics.h"
-class IFWL_Widget;
-class IFWL_AdapterWidgetMgr;
+#define FWL_WGTMGR_DisableThread 0x00000001
+#define FWL_WGTMGR_DisableForm 0x00000002
+
+class CFWL_Message;
class CFWL_WidgetMgrDelegate;
+class CFX_Graphics;
+class CFX_Matrix;
+class IFWL_AdapterWidgetMgr;
class IFWL_AdapterNative;
+class IFWL_Widget;
class CFWL_WidgetMgrItem {
public:
@@ -136,18 +143,16 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
#endif
};
-class CFWL_WidgetMgrDelegate : public IFWL_WidgetMgrDelegate {
+class CFWL_WidgetMgrDelegate {
public:
CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr);
- ~CFWL_WidgetMgrDelegate() override {}
+ ~CFWL_WidgetMgrDelegate() {}
- // IFWL_WidgetMgrDelegate:
- FWL_ERR OnSetCapability(
- uint32_t dwCapability = FWL_WGTMGR_DisableThread) override;
- int32_t OnProcessMessageToForm(CFWL_Message* pMessage) override;
+ FWL_ERR OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread);
+ int32_t OnProcessMessageToForm(CFWL_Message* pMessage);
FWL_ERR OnDrawWidget(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) override;
+ const CFX_Matrix* pMatrix);
protected:
void DrawChild(IFWL_Widget* pParent,
diff --git a/xfa/fwl/core/ifwl_adapternative.h b/xfa/fwl/core/ifwl_adapternative.h
index 6c6d8019ff..e787658e19 100644
--- a/xfa/fwl/core/ifwl_adapternative.h
+++ b/xfa/fwl/core/ifwl_adapternative.h
@@ -7,7 +7,7 @@
#ifndef XFA_FWL_CORE_IFWL_ADAPTERNATIVE_H_
#define XFA_FWL_CORE_IFWL_ADAPTERNATIVE_H_
-class IFWL_WidgetMgrDelegate;
+class CFWL_WidgetMgrDelegate;
class IFWL_AdapterWidgetMgr;
class IFWL_AdapterThreadMgr;
class IFWL_AdapterTimerMgr;
@@ -16,7 +16,7 @@ class IFWL_AdapterNative {
public:
virtual ~IFWL_AdapterNative() {}
virtual IFWL_AdapterWidgetMgr* GetWidgetMgr(
- IFWL_WidgetMgrDelegate* pDelegate) = 0;
+ CFWL_WidgetMgrDelegate* pDelegate) = 0;
virtual IFWL_AdapterThreadMgr* GetThreadMgr() = 0;
virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
};
diff --git a/xfa/fwl/core/ifwl_adapterthreadmgr.h b/xfa/fwl/core/ifwl_adapterthreadmgr.h
index dec5010b49..de2616a0af 100644
--- a/xfa/fwl/core/ifwl_adapterthreadmgr.h
+++ b/xfa/fwl/core/ifwl_adapterthreadmgr.h
@@ -9,13 +9,14 @@
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/ifwl_thread.h"
+
+class IFWL_App;
class IFWL_AdapterThreadMgr {
public:
virtual ~IFWL_AdapterThreadMgr() {}
- virtual IFWL_Thread* GetCurrentThread() = 0;
+ virtual IFWL_App* GetCurrentThread() = 0;
};
#endif // XFA_FWL_CORE_IFWL_ADAPTERTHREADMGR_H_
diff --git a/xfa/fwl/core/ifwl_app.h b/xfa/fwl/core/ifwl_app.h
index 3fb0940ed4..53dc35d33a 100644
--- a/xfa/fwl/core/ifwl_app.h
+++ b/xfa/fwl/core/ifwl_app.h
@@ -7,19 +7,33 @@
#ifndef XFA_FWL_CORE_IFWL_APP_H_
#define XFA_FWL_CORE_IFWL_APP_H_
+// The FWL thread/app code contains three parallel classes, which reference each
+// other via pointers as follows:
+//
+// m_pIface m_pImpl
+// CXFA_FFApp ------------> IFWL_App -----------> CFWL_AppImp
+// <-----------
+// m_pIface
+
+#include <memory>
+
#include "core/fxcrt/include/fx_string.h"
-#include "xfa/fwl/core/ifwl_thread.h"
+#include "xfa/fwl/core/fwl_appimp.h"
+#include "xfa/fwl/core/fwl_error.h"
+class CFWL_NoteDriver;
class IFWL_AdapterNative;
+class IFWL_AdapterWidgetMgr;
+class IFWL_ThemeProvider;
class IFWL_Widget;
class IFWL_WidgetMgr;
-class IFWL_ThemeProvider;
-class IFWL_AdapterWidgetMgr;
-class IFWL_App : public IFWL_Thread {
+class IFWL_App {
public:
static IFWL_App* Create(IFWL_AdapterNative* pAdapter);
+ virtual ~IFWL_App() {}
+
FWL_ERR Initialize();
FWL_ERR Finalize();
IFWL_AdapterNative* GetAdapterNative();
@@ -28,8 +42,20 @@ class IFWL_App : public IFWL_Thread {
FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
FWL_ERR Exit(int32_t iExitCode);
+ // These call into polymorphic methods in the impl; no need to override.
+ void Release();
+
+ CFWL_AppImp* GetImpl() const { return m_pImpl.get(); }
+
+ // Takes ownership of |pImpl|.
+ void SetImpl(CFWL_AppImp* pImpl) { m_pImpl.reset(pImpl); }
+
+ CFWL_NoteDriver* GetNoteDriver() const;
+
private:
IFWL_App() {}
+
+ std::unique_ptr<CFWL_AppImp> m_pImpl;
};
IFWL_App* FWL_GetApp();
diff --git a/xfa/fwl/core/ifwl_notedriver.h b/xfa/fwl/core/ifwl_notedriver.h
deleted file mode 100644
index 4bf265593c..0000000000
--- a/xfa/fwl/core/ifwl_notedriver.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_NOTEDRIVER_H_
-#define XFA_FWL_CORE_IFWL_NOTEDRIVER_H_
-
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-#define FWL_KEYFLAG_Ctrl (1 << 0)
-#define FWL_KEYFLAG_Alt (1 << 1)
-#define FWL_KEYFLAG_Shift (1 << 2)
-#define FWL_KEYFLAG_Command (1 << 3)
-#define FWL_KEYFLAG_LButton (1 << 4)
-#define FWL_KEYFLAG_RButton (1 << 5)
-#define FWL_KEYFLAG_MButton (1 << 6)
-
-class CFWL_Message;
-class CFWL_Note;
-class IFWL_NoteLoop;
-class IFWL_Thread;
-class IFWL_Widget;
-
-class IFWL_NoteDriver {
- public:
- virtual ~IFWL_NoteDriver() {}
-
- virtual FX_BOOL SendEvent(CFWL_Event* pNote) = 0;
-
- virtual FWL_ERR RegisterEventTarget(
- IFWL_Widget* pListener,
- IFWL_Widget* pEventSource = NULL,
- uint32_t dwFilter = FWL_EVENT_ALL_MASK) = 0;
- virtual FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) = 0;
- virtual void ClearEventTargets(FX_BOOL bRemoveAll) = 0;
- virtual IFWL_Thread* GetOwnerThread() const = 0;
- virtual FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) = 0;
- virtual IFWL_NoteLoop* PopNoteLoop() = 0;
- virtual IFWL_Widget* GetFocus() = 0;
- virtual FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) = 0;
- virtual void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) = 0;
- virtual FWL_ERR Run() = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_NOTEDRIVER_H_
diff --git a/xfa/fwl/core/ifwl_noteloop.h b/xfa/fwl/core/ifwl_noteloop.h
deleted file mode 100644
index b0b182e793..0000000000
--- a/xfa/fwl/core/ifwl_noteloop.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_NOTELOOP_H_
-#define XFA_FWL_CORE_IFWL_NOTELOOP_H_
-
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-class CFWL_Message;
-
-class IFWL_NoteLoop {
- public:
- virtual ~IFWL_NoteLoop() {}
- virtual FWL_ERR Idle(int32_t count) = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_NOTELOOP_H_
diff --git a/xfa/fwl/core/ifwl_target.h b/xfa/fwl/core/ifwl_target.h
deleted file mode 100644
index f0de3b13ee..0000000000
--- a/xfa/fwl/core/ifwl_target.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_TARGET_H_
-#define XFA_FWL_CORE_IFWL_TARGET_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-// FWL contains three parallel inheritance hierarchies, which reference each
-// other via pointers as follows:
-//
-// m_pImpl
-// (nonesuch) IFWL_Target ----------> CFWL_TargetImp
-// | |
-// A A
-// m_pIface | |
-// CFWL_Widget ----------> IFWL_Widget CFWL_WidgetImp
-// | | |
-// A A A
-// | | |
-// CFWL_... IFWL_... CFWL_...Imp
-//
-
-class CFWL_TargetImp;
-
-class IFWL_Target {
- public:
- IFWL_Target() : m_pImpl(nullptr) {}
- virtual ~IFWL_Target();
-
- // These call into equivalent polymorphic methods of m_pImpl. There
- // should be no need to override these in subclasses.
- FWL_ERR GetClassName(CFX_WideString& wsClass) const;
- uint32_t GetClassID() const;
- FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
- FWL_ERR Initialize();
- FWL_ERR Finalize();
-
- CFWL_TargetImp* GetImpl() const { return m_pImpl; }
-
- protected:
- void SetImpl(CFWL_TargetImp* pImpl) { m_pImpl = pImpl; }
-
- private:
- CFWL_TargetImp* m_pImpl;
-};
-
-#endif // XFA_FWL_CORE_IFWL_TARGET_H_
diff --git a/xfa/fwl/core/ifwl_thread.h b/xfa/fwl/core/ifwl_thread.h
deleted file mode 100644
index b41b988d6e..0000000000
--- a/xfa/fwl/core/ifwl_thread.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_THREAD_H_
-#define XFA_FWL_CORE_IFWL_THREAD_H_
-
-// The FWL thread/app code contains three parallel inheritance hierarchies,
-// which reference each other via pointers as follows:
-//
-// m_pImpl
-// (nonesuch) IFWL_Thread ----------> CFWL_ThreadImp
-// | <---------- |
-// A m_pIface A
-// m_pIface | |
-// CXFA_FFApp ------------> IFWL_App CFWL_AppImp
-//
-
-#include "xfa/fwl/core/fwl_error.h"
-
-class CFWL_ThreadImp;
-class IFWL_NoteDriver;
-
-class IFWL_Thread {
- public:
- // These call into polymorphic methods in the impl; no need to override.
- void Release();
-
- CFWL_ThreadImp* GetImpl() const { return m_pImpl; }
- void SetImpl(CFWL_ThreadImp* pImpl) { m_pImpl = pImpl; }
-
- IFWL_NoteDriver* GetNoteDriver() const;
-
- protected:
- virtual ~IFWL_Thread() {}
-
- private:
- CFWL_ThreadImp* m_pImpl;
-};
-
-#endif // XFA_FWL_CORE_IFWL_THREAD_H_
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 3540a3c87c..ea57c4e3fa 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -7,21 +7,38 @@
#ifndef XFA_FWL_CORE_IFWL_WIDGET_H_
#define XFA_FWL_CORE_IFWL_WIDGET_H_
+#include <memory>
+
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/ifwl_target.h"
+#include "xfa/fwl/core/fwl_widgetimp.h"
+
+// FWL contains three parallel inheritance hierarchies, which reference each
+// other via pointers as follows:
+//
+// m_pIface m_pImpl
+// CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp
+// | | |
+// A A A
+// | | |
+// CFWL_... IFWL_... CFWL_...Imp
+//
+class CFWL_WidgetImp;
class CFX_Graphics;
+class IFWL_App;
class IFWL_DataProvider;
class IFWL_Form;
-class IFWL_Thread;
class IFWL_ThemeProvider;
class IFWL_WidgetDelegate;
-class IFWL_Widget : public IFWL_Target {
+class IFWL_Widget {
public:
+ IFWL_Widget() : m_pImpl(nullptr) {}
+ virtual ~IFWL_Widget();
+
FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
FWL_ERR GetGlobalRect(CFX_RectF& rect);
FWL_ERR SetWidgetRect(const CFX_RectF& rect);
@@ -54,8 +71,25 @@ class IFWL_Widget : public IFWL_Target {
FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider);
IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
- IFWL_Thread* GetOwnerThread() const;
+ IFWL_App* GetOwnerApp() const;
CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
+
+ // These call into equivalent polymorphic methods of m_pImpl. There
+ // should be no need to override these in subclasses.
+ FWL_ERR GetClassName(CFX_WideString& wsClass) const;
+ uint32_t GetClassID() const;
+ FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
+ FWL_ERR Initialize();
+ FWL_ERR Finalize();
+
+ CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); }
+
+ protected:
+ // Takes ownership of |pImpl|.
+ void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); }
+
+ private:
+ std::unique_ptr<CFWL_WidgetImp> m_pImpl;
};
#endif // XFA_FWL_CORE_IFWL_WIDGET_H_
diff --git a/xfa/fwl/core/ifwl_widgetmgrdelegate.h b/xfa/fwl/core/ifwl_widgetmgrdelegate.h
deleted file mode 100644
index 2435c0bc23..0000000000
--- a/xfa/fwl/core/ifwl_widgetmgrdelegate.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_
-#define XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_
-
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-#define FWL_WGTMGR_DisableThread 0x00000001
-#define FWL_WGTMGR_DisableForm 0x00000002
-
-class CFWL_Message;
-class CFX_Graphics;
-class CFX_Matrix;
-class IFWL_Widget;
-
-class IFWL_WidgetMgrDelegate {
- public:
- virtual ~IFWL_WidgetMgrDelegate() {}
-
- virtual FWL_ERR OnSetCapability(
- uint32_t dwCapability = FWL_WGTMGR_DisableThread) = 0;
- virtual int32_t OnProcessMessageToForm(CFWL_Message* pMessage) = 0;
- virtual FWL_ERR OnDrawWidget(IFWL_Widget* pWidget,
- CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_
diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.cpp b/xfa/fwl/lightwidget/cfwl_tooltip.cpp
index 2c16cfdc54..efb61ce018 100644
--- a/xfa/fwl/lightwidget/cfwl_tooltip.cpp
+++ b/xfa/fwl/lightwidget/cfwl_tooltip.cpp
@@ -10,8 +10,6 @@
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
-#include "xfa/fwl/core/fwl_threadimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
CFWL_ToolTip* CFWL_ToolTip::Create() {
diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index 5fbe935767..98a5a22f43 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -10,11 +10,10 @@
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_targetimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
+#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
-#include "xfa/fwl/core/ifwl_thread.h"
IFWL_Widget* CFWL_Widget::GetWidget() {
return m_pIface;
@@ -215,7 +214,7 @@ CFWL_Widget::CFWL_Widget()
: m_pIface(NULL), m_pDelegate(NULL), m_pProperties(NULL) {
m_pProperties = new CFWL_WidgetProperties;
m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
- ASSERT(m_pWidgetMgr != NULL);
+ ASSERT(m_pWidgetMgr);
}
CFWL_Widget::~CFWL_Widget() {
@@ -242,12 +241,15 @@ FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- IFWL_Thread* pThread = m_pIface->GetOwnerThread();
- if (!pThread)
+
+ IFWL_App* pApp = m_pIface->GetOwnerApp();
+ if (!pApp)
return FWL_ERR_Indefinite;
- IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
return FWL_ERR_Indefinite;
+
if (bFocus) {
pDriver->SetFocus(m_pIface);
} else {
@@ -261,12 +263,15 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- IFWL_Thread* pThread = m_pIface->GetOwnerThread();
- if (!pThread)
+
+ IFWL_App* pApp = m_pIface->GetOwnerApp();
+ if (!pApp)
return FWL_ERR_Indefinite;
- IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
return FWL_ERR_Indefinite;
+
pDriver->SetGrab(m_pIface, bSet);
return FWL_ERR_Succeeded;
}
@@ -275,12 +280,15 @@ void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
uint32_t dwFilter) {
if (!m_pIface)
return;
- IFWL_Thread* pThread = m_pIface->GetOwnerThread();
- if (!pThread)
+
+ IFWL_App* pApp = m_pIface->GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
+
+ CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
+
IFWL_Widget* pEventSourceImp =
!pEventSource ? NULL : pEventSource->GetWidget();
pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter);
@@ -292,10 +300,10 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (m_pIface->GetOuter()) {
return;
}
- IFWL_Thread* pThread = m_pIface->GetOwnerThread();
- if (!pThread)
+ IFWL_App* pApp = m_pIface->GetOwnerApp();
+ if (!pApp)
return;
- IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
pNoteDriver->SendEvent(pEvent);
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 5332b3bebd..7f4e547e24 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -14,6 +14,7 @@
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/cfwl_themetext.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/core/ifwl_widgetmgr.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"