summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-04 14:24:53 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-04 14:24:53 -0700
commit55fa356c8ce72c597e75fc591fc67597b1c019d5 (patch)
tree14495a8fc3c21726c970069a696614d95bd11f6d /xfa/fwl
parentb7675f63684ebff68c688a1c7b160596b6747c3e (diff)
downloadpdfium-55fa356c8ce72c597e75fc591fc67597b1c019d5.tar.xz
Cleanup IFWL_Adapter interfaces.
This CL removes: * IFWL_AdapterNative * IFWL_Adapter{Widget|Thread}Mgr * IFWL_WidgetMgrDelegate * CFWL_SDAdapter{Widget|Thread}Mgr Methods which just returned have also been removed. Review-Url: https://codereview.chromium.org/1928963004
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.cpp15
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.cpp12
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp6
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_pushbuttonimp.cpp8
-rw-r--r--xfa/fwl/basewidget/fwl_pushbuttonimp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp6
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_caret.h2
-rw-r--r--xfa/fwl/core/fwl_appimp.cpp39
-rw-r--r--xfa/fwl/core/fwl_appimp.h26
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp35
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp70
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.cpp151
-rw-r--r--xfa/fwl/core/fwl_sdadapterimp.h80
-rw-r--r--xfa/fwl/core/fwl_timerimp.cpp6
-rw-r--r--xfa/fwl/core/fwl_widgetimp.cpp82
-rw-r--r--xfa/fwl/core/fwl_widgetimp.h2
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.cpp84
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.h34
-rw-r--r--xfa/fwl/core/ifwl_adapternative.h24
-rw-r--r--xfa/fwl/core/ifwl_adapterthreadmgr.h22
-rw-r--r--xfa/fwl/core/ifwl_adapterwidgetmgr.h79
-rw-r--r--xfa/fwl/core/ifwl_app.h18
-rw-r--r--xfa/fwl/core/ifwl_widget.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp56
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.h2
29 files changed, 168 insertions, 703 deletions
diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp
index c61c459f2e..23a5213a4d 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.cpp
+++ b/xfa/fwl/basewidget/fwl_caretimp.cpp
@@ -22,8 +22,8 @@ IFWL_Caret* IFWL_Caret::Create(const CFWL_WidgetImpProperties& properties,
return pCaret;
}
IFWL_Caret::IFWL_Caret() {}
-FWL_ERR IFWL_Caret::ShowCaret(FX_BOOL bFlag) {
- return static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag);
+void IFWL_Caret::ShowCaret(FX_BOOL bFlag) {
+ static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag);
}
FWL_ERR IFWL_Caret::GetFrequency(uint32_t& elapse) {
return static_cast<CFWL_CaretImp*>(GetImpl())->GetFrequency(elapse);
@@ -82,15 +82,16 @@ FWL_ERR CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics,
DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix);
return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
+
+void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
if (m_hTimer) {
FWL_StopTimer(m_hTimer);
- m_hTimer = NULL;
+ m_hTimer = nullptr;
}
- if (bFlag) {
+ if (bFlag)
m_hTimer = FWL_StartTimer(m_pTimer, m_dwElapse);
- }
- return SetStates(FWL_WGTSTATE_Invisible, !bFlag);
+
+ SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
FWL_ERR CFWL_CaretImp::GetFrequency(uint32_t& elapse) {
elapse = m_dwElapse;
diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h
index 47c3a1a7f5..81d6e45449 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.h
+++ b/xfa/fwl/basewidget/fwl_caretimp.h
@@ -30,7 +30,7 @@ class CFWL_CaretImp : public CFWL_WidgetImp {
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
- virtual FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE);
+ virtual void ShowCaret(FX_BOOL bFlag = TRUE);
virtual FWL_ERR GetFrequency(uint32_t& elapse);
virtual FWL_ERR SetFrequency(uint32_t elapse);
virtual FWL_ERR SetColor(CFX_Color crFill);
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp
index e86a52eaa0..5b3e7c7c35 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp
@@ -722,16 +722,16 @@ FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
m_iCurSel = bClearSel ? -1 : iSel;
return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+
+void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
FX_BOOL bIsDropDown = IsDropDownStyle();
- if (bIsDropDown && m_pEdit) {
+ if (bIsDropDown && m_pEdit)
m_pEdit->SetStates(dwStates, bSet);
- }
- if (m_pListBox) {
+ if (m_pListBox)
m_pListBox->SetStates(dwStates, bSet);
- }
- return CFWL_WidgetImp::SetStates(dwStates, bSet);
+ CFWL_WidgetImp::SetStates(dwStates, bSet);
}
+
FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) {
if (!m_pEdit)
return FWL_ERR_Indefinite;
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h
index a4138b27a8..202ba7cae2 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.h
+++ b/xfa/fwl/basewidget/fwl_comboboximp.h
@@ -91,7 +91,7 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
- virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
virtual FWL_ERR Update();
virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index 01557ba2cc..bf4f911ea8 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -296,13 +296,15 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
}
return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+
+void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
ShowCaret(FALSE);
}
- return CFWL_WidgetImp::SetStates(dwStates, bSet);
+ CFWL_WidgetImp::SetStates(dwStates, bSet);
}
+
FWL_ERR CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) {
return CFWL_WidgetImp::SetWidgetRect(rect);
}
diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h
index 3732b48f1f..72f2ad03e4 100644
--- a/xfa/fwl/basewidget/fwl_editimp.h
+++ b/xfa/fwl/basewidget/fwl_editimp.h
@@ -38,7 +38,7 @@ class CFWL_EditImp : public CFWL_WidgetImp {
FWL_ERR SetWidgetRect(const CFX_RectF& rect) override;
FWL_ERR Update() override;
FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
- FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override;
+ void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override;
FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL) override;
FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
index b1e5f6bdb4..6fab925c91 100644
--- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
+++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
@@ -83,13 +83,15 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
}
return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+
+void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((dwStates & FWL_WGTSTATE_Disabled) && bSet) {
m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled;
- return FWL_ERR_Succeeded;
+ return;
}
- return CFWL_WidgetImp::SetStates(dwStates, bSet);
+ CFWL_WidgetImp::SetStates(dwStates, bSet);
}
+
FWL_ERR CFWL_PushButtonImp::Update() {
if (IsLocked()) {
return FWL_ERR_Indefinite;
diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/basewidget/fwl_pushbuttonimp.h
index be6941249c..50a984f5c1 100644
--- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h
+++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.h
@@ -24,7 +24,7 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp {
virtual FWL_ERR Initialize();
virtual FWL_ERR Finalize();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
- virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
virtual FWL_ERR Update();
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
index 2ce52c65a4..0a8d343cef 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
@@ -225,15 +225,17 @@ FWL_ERR CFWL_ToolTipImp::Hide() {
}
return TRUE;
}
-FWL_ERR CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+
+void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
m_hTimerHide = FWL_StartTimer(&m_TimerHide, nAutoPopDelay, FALSE);
}
- return CFWL_WidgetImp::SetStates(dwStates, bSet);
+ CFWL_WidgetImp::SetStates(dwStates, bSet);
}
+
void CFWL_ToolTipImp::RefreshToolTipPos() {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) {
CFX_RectF rtPopup;
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
index 119c3e1159..0c053869ed 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
@@ -28,7 +28,7 @@ class CFWL_ToolTipImp : public CFWL_FormImp {
virtual FWL_ERR Update();
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
- virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet);
+ virtual void SetStates(uint32_t dwStates, FX_BOOL bSet);
virtual FWL_ERR GetClientRect(CFX_RectF& rect);
FWL_ERR SetAnchor(const CFX_RectF& rtAnchor);
FWL_ERR Show();
diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h
index 08a98c91c4..9d0c8a70f9 100644
--- a/xfa/fwl/basewidget/ifwl_caret.h
+++ b/xfa/fwl/basewidget/ifwl_caret.h
@@ -19,7 +19,7 @@ class IFWL_Caret : public IFWL_Widget {
static IFWL_Caret* Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
- FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE);
+ void ShowCaret(FX_BOOL bFlag = TRUE);
FWL_ERR GetFrequency(uint32_t& elapse);
FWL_ERR SetFrequency(uint32_t elapse);
FWL_ERR SetColor(CFX_Color crFill);
diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp
index 0017aad8ad..ac00cca144 100644
--- a/xfa/fwl/core/fwl_appimp.cpp
+++ b/xfa/fwl/core/fwl_appimp.cpp
@@ -8,11 +8,11 @@
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_widget.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
-IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) {
+IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) {
IFWL_App* pApp = new IFWL_App;
pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter));
return pApp;
@@ -28,7 +28,7 @@ FWL_ERR IFWL_App::Finalize() {
return static_cast<CFWL_AppImp*>(GetImpl())->Finalize();
}
-IFWL_AdapterNative* IFWL_App::GetAdapterNative() {
+CXFA_FFApp* IFWL_App::GetAdapterNative() {
return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative();
}
@@ -40,19 +40,19 @@ 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);
+void IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
+ static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider);
}
-FWL_ERR IFWL_App::Exit(int32_t iExitCode) {
- return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode);
+void IFWL_App::Exit(int32_t iExitCode) {
+ 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_AppImp::CFWL_AppImp(IFWL_App* pIface, CXFA_FFApp* pAdapter)
: m_pAdapterNative(pAdapter),
m_pThemeProvider(nullptr),
m_pNoteDriver(new CFWL_NoteDriver),
@@ -72,39 +72,42 @@ FWL_ERR CFWL_AppImp::Finalize() {
m_pWidgetMgr.reset();
return FWL_ERR_Succeeded;
}
-IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const {
+CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const {
return m_pAdapterNative;
}
-IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() {
+CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() {
return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr())
->GetAdapterWidgetMgr();
}
IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const {
return m_pWidgetMgr.get();
}
-FWL_ERR CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
+void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
m_pThemeProvider = pThemeProvider;
- return FWL_ERR_Succeeded;
}
-FWL_ERR CFWL_AppImp::Exit(int32_t iExitCode) {
+
+void CFWL_AppImp::Exit(int32_t iExitCode) {
while (m_pNoteDriver->PopNoteLoop()) {
continue;
}
- return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0);
}
+
IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const {
return m_pThemeProvider;
}
-IFWL_AdapterNative* FWL_GetAdapterNative() {
+
+CXFA_FFApp* FWL_GetAdapterNative() {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return NULL;
return pApp->GetAdapterNative();
}
-static IFWL_App* _theApp = NULL;
+
+static IFWL_App* g_theApp = nullptr;
IFWL_App* FWL_GetApp() {
- return _theApp;
+ return g_theApp;
}
+
void FWL_SetApp(IFWL_App* pApp) {
- _theApp = pApp;
+ g_theApp = pApp;
}
diff --git a/xfa/fwl/core/fwl_appimp.h b/xfa/fwl/core/fwl_appimp.h
index 8743b54a43..64b7922a15 100644
--- a/xfa/fwl/core/fwl_appimp.h
+++ b/xfa/fwl/core/fwl_appimp.h
@@ -12,7 +12,7 @@
#include "xfa/fwl/core/fwl_noteimp.h"
class CFWL_WidgetMgr;
-class IFWL_AdapterNative;
+class CXFA_FFApp;
class IFWL_App;
class IFWL_NoteThread;
class IFWL_ThemeProvider;
@@ -20,27 +20,25 @@ class IFWL_WidgetMgr;
class CFWL_AppImp {
public:
- CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter);
- virtual ~CFWL_AppImp();
+ CFWL_AppImp(IFWL_App* pIface, CXFA_FFApp* pAdapter);
+ ~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;
- virtual IFWL_WidgetMgr* GetWidgetMgr() const;
- virtual IFWL_ThemeProvider* GetThemeProvider() const;
- virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
- virtual FWL_ERR Exit(int32_t iExitCode = 0);
+ FWL_ERR Initialize();
+ FWL_ERR Finalize();
+ CXFA_FFApp* GetAdapterNative() const;
+ IFWL_WidgetMgr* GetWidgetMgr() const;
+ IFWL_ThemeProvider* GetThemeProvider() const;
+ void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
+ void Exit(int32_t iExitCode);
- protected:
- IFWL_AdapterNative* const m_pAdapterNative;
+ private:
+ CXFA_FFApp* 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;
};
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index 539a48dde0..78dc8b56a2 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -16,7 +16,6 @@
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
@@ -155,12 +154,9 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
- IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
- FX_FLOAT l, t, r, b;
- l = t = r = b = 0;
- adapterWidgetMgr->GetSystemBorder(l, t, r, b);
- rect.Deflate(l, t, r, b);
- rect.left = rect.top = 0;
+
+ rect.left = 0;
+ rect.top = 0;
return FWL_ERR_Succeeded;
#else
FX_FLOAT x = 0;
@@ -458,7 +454,6 @@ void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
IFWL_Widget* pChild =
pWidgetMgr->GetWidget(pParent, FWL_WGTRELATION_FirstChild);
while (pChild) {
- pWidgetMgr->ShowWidget_Native(pChild);
ShowChildWidget(pChild);
pChild = pWidgetMgr->GetWidget(pChild, FWL_WGTRELATION_NextSibling);
}
@@ -625,7 +620,6 @@ void CFWL_FormImp::SetWorkAreaRect() {
if (!pWidgetMgr)
return;
m_bSetMaximize = TRUE;
- pWidgetMgr->SetMaximize_Native(m_pInterface);
Repaint(&m_rtRelative);
}
void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {}
@@ -778,14 +772,10 @@ void CFWL_FormImp::UpdateIcon() {
static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
CFX_DIBitmap* pBigIcon = pData->GetIcon(m_pInterface, TRUE);
CFX_DIBitmap* pSmallIcon = pData->GetIcon(m_pInterface, FALSE);
- if (pBigIcon && pBigIcon != m_pBigIcon) {
+ if (pBigIcon)
m_pBigIcon = pBigIcon;
- pWidgetMgr->SetWidgetIcon_Native(m_pInterface, m_pBigIcon, TRUE);
- }
- if (pSmallIcon && pSmallIcon != m_pSmallIcon) {
+ if (pSmallIcon)
m_pSmallIcon = pSmallIcon;
- pWidgetMgr->SetWidgetIcon_Native(m_pInterface, m_pBigIcon, FALSE);
- }
}
void CFWL_FormImp::UpdateCaption() {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
@@ -797,7 +787,6 @@ void CFWL_FormImp::UpdateCaption() {
return;
CFX_WideString text;
pData->GetCaption(m_pInterface, text);
- pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text.AsStringC());
}
void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
FX_FLOAT& fWidth,
@@ -957,10 +946,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
m_pOwner->m_bSetMaximize = FALSE;
CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage);
- CFX_RectF rt;
- pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt);
- m_pOwner->m_pProperties->m_rtWidget.left = rt.left;
- m_pOwner->m_pProperties->m_rtWidget.top = rt.top;
+ m_pOwner->m_pProperties->m_rtWidget.left = 0;
+ m_pOwner->m_pProperties->m_rtWidget.top = 0;
m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth;
m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight;
m_pOwner->Update();
@@ -1044,13 +1031,7 @@ void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->Update();
}
m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized;
- } else if (pPressedBtn == m_pOwner->m_pMinBox) {
- CFWL_WidgetMgr* pWidgetMgr =
- static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
- if (!pWidgetMgr)
- return;
- pWidgetMgr->SetMinimize_Native(m_pOwner->m_pInterface);
- } else {
+ } else if (pPressedBtn != m_pOwner->m_pMinBox) {
CFWL_EvtClose eClose;
eClose.m_pSrcTarget = m_pOwner->m_pInterface;
m_pOwner->DispatchEvent(&eClose);
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index d73a49fa90..5d439d7f0c 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_tooltiptarget.h"
@@ -46,11 +45,6 @@ FX_BOOL CFWL_NoteLoop::ContinueModal() {
}
FWL_ERR CFWL_NoteLoop::EndModalLoop() {
m_bContinueModal = FALSE;
-#if (_FX_OS_ == _FX_MACOSX_)
- CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
- IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
- adapterWidgetMgr->EndLoop();
-#endif
return FWL_ERR_Succeeded;
}
@@ -213,60 +207,22 @@ FWL_ERR CFWL_NoteDriver::Run() {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
-#if (_FX_OS_ == _FX_MACOSX_)
- IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
- CFWL_NoteLoop* pTopLoop = GetTopLoop();
- if (pTopLoop) {
- CFWL_WidgetImp* formImp = pTopLoop->GetForm();
- if (formImp) {
- IFWL_Widget* pForm = formImp->GetInterface();
- adapterWidgetMgr->RunLoop(pForm);
- }
- }
-#elif(_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
- FX_BOOL bIdle = TRUE;
- int32_t iIdleCount = 0;
- CFWL_NoteLoop* pTopLoop = NULL;
- for (;;) {
- pTopLoop = GetTopLoop();
- if (!pTopLoop || !pTopLoop->ContinueModal()) {
- break;
- }
- if (UnqueueMessage(pTopLoop)) {
- continue;
- }
- while (bIdle && !(pWidgetMgr->CheckMessage_Native())) {
- if (FWL_ERR_Indefinite == pTopLoop->Idle(iIdleCount++)) {
- bIdle = FALSE;
- }
- }
- do {
- if (FWL_ERR_Indefinite == pWidgetMgr->DispatchMessage_Native()) {
- break;
- }
- if (pWidgetMgr->IsIdleMessage_Native()) {
- bIdle = TRUE;
- iIdleCount = 0;
- }
- } while (pWidgetMgr->CheckMessage_Native());
- }
-#elif(_FX_OS_ == _FX_LINUX_DESKTOP_)
- CFWL_NoteLoop* pTopLoop = NULL;
- for (;;) {
- pTopLoop = GetTopLoop();
- if (!pTopLoop || !pTopLoop->ContinueModal()) {
- break;
- }
- if (UnqueueMessage(pTopLoop)) {
- continue;
- }
- if (pWidgetMgr->CheckMessage_Native()) {
- pWidgetMgr->DispatchMessage_Native();
- }
- }
+
+#if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
+ _FX_OS_ == _FX_WIN64_)
+ CFWL_NoteLoop* pTopLoop = NULL;
+ for (;;) {
+ pTopLoop = GetTopLoop();
+ if (!pTopLoop || !pTopLoop->ContinueModal())
+ break;
+ if (UnqueueMessage(pTopLoop))
+ continue;
+ }
#endif
+
return FWL_ERR_Succeeded;
}
+
IFWL_Widget* CFWL_NoteDriver::GetFocus() {
return m_pFocus;
}
diff --git a/xfa/fwl/core/fwl_sdadapterimp.cpp b/xfa/fwl/core/fwl_sdadapterimp.cpp
deleted file mode 100644
index c4dc61a8d1..0000000000
--- a/xfa/fwl/core/fwl_sdadapterimp.cpp
+++ /dev/null
@@ -1,151 +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_sdadapterimp.h"
-
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetmgrimp.h"
-#include "xfa/fwl/core/ifwl_adapterthreadmgr.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
-#include "xfa/fwl/core/ifwl_app.h"
-
-CFWL_SDAdapterWidgetMgr::CFWL_SDAdapterWidgetMgr() {}
-CFWL_SDAdapterWidgetMgr::~CFWL_SDAdapterWidgetMgr() {}
-
-FWL_ERR CFWL_SDAdapterWidgetMgr::CreateWidget(IFWL_Widget* pWidget,
- IFWL_Widget* pParent) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::DestroyWidget(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetWidgetRect(IFWL_Widget* pWidget,
- const CFX_RectF& rect) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetWidgetPosition(IFWL_Widget* pWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetParentWidget(IFWL_Widget* pWidget,
- IFWL_Widget* pParent) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::ShowWidget(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::HideWidget(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetNormal(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetMaximize(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetMinimize(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::RunWidget(IFWL_Widget* pWidget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget,
- const CFX_RectF* pRect) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::Exit(int32_t iExitCode) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::CreateWidgetWithNativeId(IFWL_Widget* pWidget,
- void* vp) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::GetWidgetRect(IFWL_Widget* pWidget,
- CFX_RectF& rect) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetWidgetIcon(IFWL_Widget* pWidget,
- const CFX_DIBitmap* pIcon,
- FX_BOOL bBig) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetWidgetCaption(
- IFWL_Widget* pWidget,
- const CFX_WideStringC& wsCaption) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetBorderRegion(IFWL_Widget* pWidget,
- CFX_Path* pPath) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetTransparent(IFWL_Widget* pWidget,
- uint32_t dwAlpha) {
- return FWL_ERR_Succeeded;
-}
-FX_BOOL CFWL_SDAdapterWidgetMgr::CheckMessage() {
- return TRUE;
-}
-FX_BOOL CFWL_SDAdapterWidgetMgr::IsIdleMessage() {
- return TRUE;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::DispatchMessage() {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::GetWidgetDC(IFWL_Widget* pWidget, void*& pDC) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::ReleaseWidgetDC(IFWL_Widget* pWidget,
- void* pDC,
- CFX_RectF* pClip) {
- return FWL_ERR_Succeeded;
-}
-void* CFWL_SDAdapterWidgetMgr::GetWindow(IFWL_Widget* pWidget) {
- return NULL;
-}
-uint32_t CFWL_SDAdapterWidgetMgr::GetKeyState(uint32_t dwVirtKey) {
- return 0;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::RunLoop(IFWL_Widget* widget) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::EndLoop() {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::InitMenu(IFWL_Menu* pMenu,
- IFWL_MenuDP* pMenuData) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::UpdateMenu(IFWL_Menu* pMenu,
- const void* hItem,
- int32_t iType) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::SetMessageHook(IFWL_AdapterMessageHook* hook) {
- return FWL_ERR_Succeeded;
-}
-FWL_ERR CFWL_SDAdapterWidgetMgr::GetSystemBorder(FX_FLOAT& l,
- FX_FLOAT& t,
- FX_FLOAT& r,
- FX_FLOAT& b) {
- return FWL_ERR_Succeeded;
-}
-FX_BOOL CFWL_SDAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup) {
- return FWL_ERR_Succeeded;
-}
-
-CFWL_SDAdapterThreadMgr::CFWL_SDAdapterThreadMgr() {}
-
-CFWL_SDAdapterThreadMgr::~CFWL_SDAdapterThreadMgr() {}
-
-IFWL_App* CFWL_SDAdapterThreadMgr::GetCurrentThread() {
- return FWL_GetApp();
-}
diff --git a/xfa/fwl/core/fwl_sdadapterimp.h b/xfa/fwl/core/fwl_sdadapterimp.h
deleted file mode 100644
index cd2ac8d6d8..0000000000
--- a/xfa/fwl/core/fwl_sdadapterimp.h
+++ /dev/null
@@ -1,80 +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_SDADAPTERIMP_H_
-#define XFA_FWL_CORE_FWL_SDADAPTERIMP_H_
-
-#include "xfa/fwl/core/ifwl_adapterthreadmgr.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
-
-class CFWL_SDAdapterWidgetMgr : public IFWL_AdapterWidgetMgr {
- public:
- CFWL_SDAdapterWidgetMgr();
- ~CFWL_SDAdapterWidgetMgr();
- virtual FWL_ERR CreateWidget(IFWL_Widget* pWidget,
- IFWL_Widget* pParent = NULL);
- virtual FWL_ERR DestroyWidget(IFWL_Widget* pWidget);
- virtual FWL_ERR SetWidgetRect(IFWL_Widget* pWidget, const CFX_RectF& rect);
- virtual FWL_ERR SetWidgetPosition(IFWL_Widget* pWidget,
- FX_FLOAT fx,
- FX_FLOAT fy);
- virtual FWL_ERR SetParentWidget(IFWL_Widget* pWidget, IFWL_Widget* pParent);
- virtual FWL_ERR ShowWidget(IFWL_Widget* pWidget);
- virtual FWL_ERR HideWidget(IFWL_Widget* pWidget);
- virtual FWL_ERR SetNormal(IFWL_Widget* pWidget);
- virtual FWL_ERR SetMaximize(IFWL_Widget* pWidget);
- virtual FWL_ERR SetMinimize(IFWL_Widget* pWidget);
- virtual FWL_ERR RunWidget(IFWL_Widget* pWidget);
- virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect);
- virtual FWL_ERR Exit(int32_t iExitCode);
- virtual FWL_ERR CreateWidgetWithNativeId(IFWL_Widget* pWidget, void* vp);
- virtual FX_BOOL GetPopupPos(IFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup);
-
- public:
- virtual FWL_ERR GetWidgetRect(IFWL_Widget* pWidget, CFX_RectF& rect);
- virtual FWL_ERR SetWidgetIcon(IFWL_Widget* pWidget,
- const CFX_DIBitmap* pIcon,
- FX_BOOL bBig);
- virtual FWL_ERR SetWidgetCaption(IFWL_Widget* pWidget,
- const CFX_WideStringC& wsCaption);
- virtual FWL_ERR SetBorderRegion(IFWL_Widget* pWidget, CFX_Path* pPath);
- virtual FWL_ERR SetTransparent(IFWL_Widget* pWidget, uint32_t dwAlpha);
- virtual FX_BOOL CheckMessage();
- virtual FX_BOOL IsIdleMessage();
- virtual FWL_ERR DispatchMessage();
- virtual FWL_ERR GetWidgetDC(IFWL_Widget* pWidget, void*& pDC);
- virtual FWL_ERR ReleaseWidgetDC(IFWL_Widget* pWidget,
- void* pDC,
- CFX_RectF* pClip = 0);
- virtual void* GetWindow(IFWL_Widget* pWidget);
- virtual uint32_t GetKeyState(uint32_t dwVirtKey);
- virtual FWL_ERR RunLoop(IFWL_Widget* widget);
- virtual FWL_ERR EndLoop();
- virtual FWL_ERR InitMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData);
- virtual FWL_ERR UpdateMenu(IFWL_Menu* pMenu,
- const void* hItem,
- int32_t iType);
- virtual FWL_ERR SetMessageHook(IFWL_AdapterMessageHook* hook);
- virtual FWL_ERR GetSystemBorder(FX_FLOAT& l,
- FX_FLOAT& t,
- FX_FLOAT& r,
- FX_FLOAT& b);
-};
-
-class CFWL_SDAdapterThreadMgr : public IFWL_AdapterThreadMgr {
- public:
- CFWL_SDAdapterThreadMgr();
- ~CFWL_SDAdapterThreadMgr();
-
- public:
- virtual IFWL_App* GetCurrentThread();
-};
-
-#endif // XFA_FWL_CORE_FWL_SDADAPTERIMP_H_
diff --git a/xfa/fwl/core/fwl_timerimp.cpp b/xfa/fwl/core/fwl_timerimp.cpp
index 8a5f8896f5..5adf8e158c 100644
--- a/xfa/fwl/core/fwl_timerimp.cpp
+++ b/xfa/fwl/core/fwl_timerimp.cpp
@@ -5,15 +5,15 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fwl/core/fwl_appimp.h"
-#include "xfa/fwl/core/ifwl_adapternative.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_timer.h"
#include "xfa/fwl/core/include/ifwl_adaptertimermgr.h"
+#include "xfa/fxfa/include/xfa_ffapp.h"
FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer,
uint32_t dwElapse,
FX_BOOL bImmediately) {
- IFWL_AdapterNative* pAdapterNative = FWL_GetAdapterNative();
+ CXFA_FFApp* pAdapterNative = FWL_GetAdapterNative();
if (!pAdapterNative)
return NULL;
IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr();
@@ -24,7 +24,7 @@ FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer,
return hTimer;
}
int32_t FWL_StopTimer(FWL_HTIMER hTimer) {
- IFWL_AdapterNative* pAdapterNative = FWL_GetAdapterNative();
+ CXFA_FFApp* pAdapterNative = FWL_GetAdapterNative();
if (!pAdapterNative)
return FWL_ERR_Indefinite;
IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr();
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp
index b9db4f984e..8863cef0f3 100644
--- a/xfa/fwl/core/fwl_widgetimp.cpp
+++ b/xfa/fwl/core/fwl_widgetimp.cpp
@@ -18,12 +18,10 @@
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_widgetmgrimp.h"
-#include "xfa/fwl/core/ifwl_adapternative.h"
-#include "xfa/fwl/core/ifwl_adapterthreadmgr.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_form.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
+#include "xfa/fxfa/include/xfa_ffapp.h"
#define FWL_CLASSHASH_Menu 3957949655
#define FWL_STYLEEXT_MNU_Vert (1L << 0)
@@ -97,8 +95,8 @@ FWL_ERR IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t IFWL_Widget::GetStates() {
return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStates();
}
-FWL_ERR IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
- return static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet);
+void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+ static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet);
}
FWL_ERR IFWL_Widget::SetPrivateData(void* module_id,
void* pData,
@@ -165,33 +163,23 @@ FWL_ERR CFWL_WidgetImp::Initialize() {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return FWL_ERR_Indefinite;
- IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative();
+ CXFA_FFApp* pAdapter = pApp->GetAdapterNative();
if (!pAdapter)
return FWL_ERR_Indefinite;
- IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr();
- if (!pAdapterThread)
- return FWL_ERR_Indefinite;
- SetOwnerApp(
- static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl()));
+
+ SetOwnerApp(static_cast<CFWL_AppImp*>(FWL_GetApp()->GetImpl()));
IFWL_Widget* pParent = m_pProperties->m_pParent;
m_pWidgetMgr->InsertWidget(pParent, m_pInterface);
if (!IsChild()) {
- {
- IFWL_Widget* pOwner = m_pProperties->m_pOwner;
- if (pOwner) {
- m_pWidgetMgr->SetOwner(pOwner, m_pInterface);
- }
- }
- m_pWidgetMgr->CreateWidget_Native(m_pInterface);
+ IFWL_Widget* pOwner = m_pProperties->m_pOwner;
+ if (pOwner)
+ m_pWidgetMgr->SetOwner(pOwner, m_pInterface);
}
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_WidgetImp::Finalize() {
NotifyDriver();
- if (!IsChild())
- m_pWidgetMgr->DestroyWidget_Native(m_pInterface);
-
m_pWidgetMgr->RemoveWidget(m_pInterface);
return FWL_ERR_Succeeded;
}
@@ -314,29 +302,24 @@ static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr,
child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling);
}
}
-FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
bSet ? (m_pProperties->m_dwStates |= dwStates)
: (m_pProperties->m_dwStates &= ~dwStates);
- FWL_ERR ret = FWL_ERR_Succeeded;
- if (dwStates & FWL_WGTSTATE_Invisible) {
- if (bSet) {
- ret = m_pWidgetMgr->HideWidget_Native(m_pInterface);
- CFWL_NoteDriver* noteDriver =
- static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver());
- IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr();
- noteDriver->NotifyTargetHide(m_pInterface);
- IFWL_Widget* child =
- widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild);
- while (child) {
- noteDriver->NotifyTargetHide(child);
- NotifyHideChildWidget(widgetMgr, child, noteDriver);
- child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling);
- }
- } else {
- ret = m_pWidgetMgr->ShowWidget_Native(m_pInterface);
- }
+ if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet)
+ return;
+
+ CFWL_NoteDriver* noteDriver =
+ static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver());
+ IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr();
+ noteDriver->NotifyTargetHide(m_pInterface);
+ IFWL_Widget* child =
+ widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild);
+ while (child) {
+ noteDriver->NotifyTargetHide(child);
+ NotifyHideChildWidget(widgetMgr, child, noteDriver);
+ child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling);
}
- return ret;
+ return;
}
FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id,
void* pData,
@@ -418,14 +401,6 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
form1->GetWidgetRect(r);
fx += r.left;
fy += r.top;
-#ifdef FWL_UseMacSystemBorder
- if (form1->GetStyles() & FWL_WGTSTYLE_Caption) {
- FX_FLOAT l, t, r, b;
- l = t = r = b = 0;
- FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b);
- fy += t;
- }
-#endif
return FWL_ERR_Succeeded;
}
IFWL_Widget* form2 =
@@ -439,15 +414,6 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
form2->GetWidgetRect(r);
fx -= r.left;
fy -= r.top;
-#ifdef FWL_UseMacSystemBorder
- if ((form1->GetStyles() & FWL_WGTSTYLE_Caption) !=
- (form2->GetStyles() & FWL_WGTSTYLE_Caption)) {
- FX_FLOAT l, t, r, b;
- l = t = r = b = 0;
- FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b);
- (form1->GetStyles() & FWL_WGTSTYLE_Caption) ? (fy += t) : (fy -= t);
- }
-#endif
}
parent = pWidget->GetParent();
if (parent) {
diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h
index 3eddfa51c2..d20fe0d75e 100644
--- a/xfa/fwl/core/fwl_widgetimp.h
+++ b/xfa/fwl/core/fwl_widgetimp.h
@@ -50,7 +50,7 @@ class CFWL_WidgetImp {
virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
virtual uint32_t GetStates();
- virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
virtual FWL_ERR SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback);
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp
index 3548f9b7a9..e56c308be9 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.cpp
+++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp
@@ -10,10 +10,10 @@
#include "xfa/fwl/core/fwl_appimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_adapternative.h"
-#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_form.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/include/xfa_ffapp.h"
namespace {
@@ -43,8 +43,7 @@ IFWL_WidgetMgr* FWL_GetWidgetMgr() {
return pApp->GetWidgetMgr();
}
-CFWL_WidgetMgr::CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative)
- : m_dwCapability(0) {
+CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) : m_dwCapability(0) {
m_pDelegate = new CFWL_WidgetMgrDelegate(this);
m_pAdapter = pAdapterNative->GetWidgetMgr(m_pDelegate);
ASSERT(m_pAdapter);
@@ -360,10 +359,8 @@ void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) {
}
pItem->pParent = pParentItem;
SetWidgetIndex(pChild, -1);
- if (!m_pAdapter)
- return;
- m_pAdapter->SetParentWidget(pChild, pParent);
}
+
FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) {
IFWL_Widget* pTemp = pChild;
do {
@@ -374,25 +371,6 @@ FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) {
} while (pTemp);
return FALSE;
}
-FWL_ERR CFWL_WidgetMgr::CreateWidget_Native(IFWL_Widget* pWidget) {
- if (!IsAbleNative(pWidget)) {
- return FWL_ERR_Succeeded;
- }
- return m_pAdapter->CreateWidget(pWidget, pWidget->GetOwner());
-}
-FWL_ERR CFWL_WidgetMgr::DestroyWidget_Native(IFWL_Widget* pWidget) {
- if (!IsAbleNative(pWidget)) {
- return FWL_ERR_Succeeded;
- }
- return m_pAdapter->DestroyWidget(pWidget);
-}
-FWL_ERR CFWL_WidgetMgr::GetWidgetRect_Native(IFWL_Widget* pWidget,
- CFX_RectF& rect) {
- if (!IsAbleNative(pWidget)) {
- return FWL_ERR_Succeeded;
- }
- return m_pAdapter->GetWidgetRect(pWidget, rect);
-}
FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget,
const CFX_RectF& rect) {
if (FWL_UseOffscreen(pWidget)) {
@@ -413,57 +391,7 @@ FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget,
pItem->bOutsideChanged = !m_rtScreen.Contains(rect);
#endif
}
- return m_pAdapter->SetWidgetRect(pWidget, rect);
-}
-FWL_ERR CFWL_WidgetMgr::SetWidgetPosition_Native(IFWL_Widget* pWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- return m_pAdapter->SetWidgetPosition(pWidget, fx, fy);
-}
-FWL_ERR CFWL_WidgetMgr::SetWidgetIcon_Native(IFWL_Widget* pWidget,
- const CFX_DIBitmap* pIcon,
- FX_BOOL bBig) {
- return m_pAdapter->SetWidgetIcon(pWidget, pIcon, bBig);
-}
-FWL_ERR CFWL_WidgetMgr::SetWidgetCaption_Native(
- IFWL_Widget* pWidget,
- const CFX_WideStringC& wsCaption) {
- return m_pAdapter->SetWidgetCaption(pWidget, wsCaption);
-}
-FWL_ERR CFWL_WidgetMgr::SetBorderRegion_Native(IFWL_Widget* pWidget,
- CFX_Path* pPath) {
- return m_pAdapter->SetBorderRegion(pWidget, pPath);
-}
-FWL_ERR CFWL_WidgetMgr::ShowWidget_Native(IFWL_Widget* pWidget) {
- return m_pAdapter->ShowWidget(pWidget);
-}
-FWL_ERR CFWL_WidgetMgr::HideWidget_Native(IFWL_Widget* pWidget) {
- return m_pAdapter->HideWidget(pWidget);
-}
-FWL_ERR CFWL_WidgetMgr::SetNormal_Native(IFWL_Widget* pWidget) {
- return m_pAdapter->SetNormal(pWidget);
-}
-FWL_ERR CFWL_WidgetMgr::SetMaximize_Native(IFWL_Widget* pWidget) {
- return m_pAdapter->SetMaximize(pWidget);
-}
-FWL_ERR CFWL_WidgetMgr::SetMinimize_Native(IFWL_Widget* pWidget) {
- return m_pAdapter->SetMinimize(pWidget);
-}
-FX_BOOL CFWL_WidgetMgr::CheckMessage_Native() {
- return m_pAdapter->CheckMessage();
-}
-FWL_ERR CFWL_WidgetMgr::DispatchMessage_Native() {
- return m_pAdapter->DispatchMessage();
-}
-FX_BOOL CFWL_WidgetMgr::IsIdleMessage_Native() {
- return m_pAdapter->IsIdleMessage();
-}
-FWL_ERR CFWL_WidgetMgr::Exit_Native(int32_t iExitCode) {
- return m_pAdapter->Exit(iExitCode);
-}
-FWL_ERR CFWL_WidgetMgr::CreateWidgetWithNativeId_Native(IFWL_Widget* pWidget,
- void* vp) {
- return m_pAdapter->CreateWidgetWithNativeId(pWidget, vp);
+ return FWL_ERR_Succeeded;
}
IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent,
FX_FLOAT x,
@@ -697,7 +625,7 @@ FX_BOOL CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget,
FX_FLOAT fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
- IFWL_AdapterWidgetMgr* pSDApapter = GetAdapterWidgetMgr();
+ CXFA_FWLAdapterWidgetMgr* pSDApapter = GetAdapterWidgetMgr();
return pSDApapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor,
rtPopup);
}
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h
index 0fcd057aeb..ff732e5cc0 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.h
+++ b/xfa/fwl/core/fwl_widgetmgrimp.h
@@ -17,10 +17,10 @@
class CFWL_Message;
class CFWL_WidgetMgrDelegate;
+class CXFA_FFApp;
+class CXFA_FWLAdapterWidgetMgr;
class CFX_Graphics;
class CFX_Matrix;
-class IFWL_AdapterWidgetMgr;
-class IFWL_AdapterNative;
class IFWL_Widget;
class CFWL_WidgetMgrItem {
@@ -61,7 +61,7 @@ class CFWL_WidgetMgrItem {
class CFWL_WidgetMgr : public IFWL_WidgetMgr {
public:
- CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative);
+ CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative);
~CFWL_WidgetMgr() override;
// IFWL_WidgetMgr:
@@ -83,29 +83,7 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
void SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned);
void SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild);
FX_BOOL IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent);
- FWL_ERR CreateWidget_Native(IFWL_Widget* pWidget);
- FWL_ERR DestroyWidget_Native(IFWL_Widget* pWidget);
- FWL_ERR GetWidgetRect_Native(IFWL_Widget* pWidget, CFX_RectF& rect);
FWL_ERR SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect);
- FWL_ERR SetWidgetPosition_Native(IFWL_Widget* pWidget,
- FX_FLOAT fx,
- FX_FLOAT fy);
- FWL_ERR SetWidgetIcon_Native(IFWL_Widget* pWidget,
- const CFX_DIBitmap* pIcon,
- FX_BOOL bBig);
- FWL_ERR SetWidgetCaption_Native(IFWL_Widget* pWidget,
- const CFX_WideStringC& wsCaption);
- FWL_ERR SetBorderRegion_Native(IFWL_Widget* pWidget, CFX_Path* pPath);
- FWL_ERR ShowWidget_Native(IFWL_Widget* pWidget);
- FWL_ERR HideWidget_Native(IFWL_Widget* pWidget);
- FWL_ERR SetNormal_Native(IFWL_Widget* pWidget);
- FWL_ERR SetMaximize_Native(IFWL_Widget* pWidget);
- FWL_ERR SetMinimize_Native(IFWL_Widget* pWidget);
- FX_BOOL CheckMessage_Native();
- FWL_ERR DispatchMessage_Native();
- FX_BOOL IsIdleMessage_Native();
- FWL_ERR Exit_Native(int32_t iExitCode);
- FWL_ERR CreateWidgetWithNativeId_Native(IFWL_Widget* pWidget, void* vp);
IFWL_Widget* GetWidgetAtPoint(IFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy);
void NotifySizeChanged(IFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy);
IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind);
@@ -117,8 +95,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent);
void AddRedrawCounts(IFWL_Widget* pWidget);
void ResetRedrawCounts(IFWL_Widget* pWidget);
- IFWL_AdapterWidgetMgr* GetAdapterWidgetMgr() { return m_pAdapter; }
- CFWL_WidgetMgrDelegate* GetDelegate() { return m_pDelegate; }
+ CXFA_FWLAdapterWidgetMgr* GetAdapterWidgetMgr() const { return m_pAdapter; }
+ CFWL_WidgetMgrDelegate* GetDelegate() const { return m_pDelegate; }
CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget);
bool IsThreadEnabled();
bool IsFormDisabled();
@@ -135,7 +113,7 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
IFWL_Widget** pWidget = NULL);
FX_BOOL IsAbleNative(IFWL_Widget* pWidget);
CFX_MapPtrToPtr m_mapWidgetItem;
- IFWL_AdapterWidgetMgr* m_pAdapter;
+ CXFA_FWLAdapterWidgetMgr* m_pAdapter;
CFWL_WidgetMgrDelegate* m_pDelegate;
friend class CFWL_WidgetMgrDelegate;
uint32_t m_dwCapability;
diff --git a/xfa/fwl/core/ifwl_adapternative.h b/xfa/fwl/core/ifwl_adapternative.h
deleted file mode 100644
index e787658e19..0000000000
--- a/xfa/fwl/core/ifwl_adapternative.h
+++ /dev/null
@@ -1,24 +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_ADAPTERNATIVE_H_
-#define XFA_FWL_CORE_IFWL_ADAPTERNATIVE_H_
-
-class CFWL_WidgetMgrDelegate;
-class IFWL_AdapterWidgetMgr;
-class IFWL_AdapterThreadMgr;
-class IFWL_AdapterTimerMgr;
-
-class IFWL_AdapterNative {
- public:
- virtual ~IFWL_AdapterNative() {}
- virtual IFWL_AdapterWidgetMgr* GetWidgetMgr(
- CFWL_WidgetMgrDelegate* pDelegate) = 0;
- virtual IFWL_AdapterThreadMgr* GetThreadMgr() = 0;
- virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_ADAPTERNATIVE_H_
diff --git a/xfa/fwl/core/ifwl_adapterthreadmgr.h b/xfa/fwl/core/ifwl_adapterthreadmgr.h
deleted file mode 100644
index de2616a0af..0000000000
--- a/xfa/fwl/core/ifwl_adapterthreadmgr.h
+++ /dev/null
@@ -1,22 +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_ADAPTERTHREADMGR_H_
-#define XFA_FWL_CORE_IFWL_ADAPTERTHREADMGR_H_
-
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-class IFWL_App;
-
-class IFWL_AdapterThreadMgr {
- public:
- virtual ~IFWL_AdapterThreadMgr() {}
-
- virtual IFWL_App* GetCurrentThread() = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_ADAPTERTHREADMGR_H_
diff --git a/xfa/fwl/core/ifwl_adapterwidgetmgr.h b/xfa/fwl/core/ifwl_adapterwidgetmgr.h
deleted file mode 100644
index a737e81c3c..0000000000
--- a/xfa/fwl/core/ifwl_adapterwidgetmgr.h
+++ /dev/null
@@ -1,79 +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_ADAPTERWIDGETMGR_H_
-#define XFA_FWL_CORE_IFWL_ADAPTERWIDGETMGR_H_
-
-#include "core/fxcrt/include/fx_coordinates.h"
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-class IFWL_Widget;
-class IFWL_Menu;
-class IFWL_MenuDP;
-class CFX_Path;
-class CFX_DIBitmap;
-class IFWL_AdapterMessageHook;
-
-class IFWL_AdapterWidgetMgr {
- public:
- virtual ~IFWL_AdapterWidgetMgr() {}
- virtual FWL_ERR CreateWidget(IFWL_Widget* pWidget,
- IFWL_Widget* pParent = NULL) = 0;
- virtual FWL_ERR DestroyWidget(IFWL_Widget* pWidget) = 0;
- virtual FWL_ERR GetWidgetRect(IFWL_Widget* pWidget, CFX_RectF& rect) = 0;
- virtual FWL_ERR SetWidgetRect(IFWL_Widget* pWidget,
- const CFX_RectF& rect) = 0;
- virtual FWL_ERR SetWidgetPosition(IFWL_Widget* pWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FWL_ERR SetParentWidget(IFWL_Widget* pWidget,
- IFWL_Widget* pParent) = 0;
- virtual FWL_ERR SetWidgetIcon(IFWL_Widget* pWidget,
- const CFX_DIBitmap* pIcon,
- FX_BOOL bBig) = 0;
- virtual FWL_ERR SetWidgetCaption(IFWL_Widget* pWidget,
- const CFX_WideStringC& wsCaption) = 0;
- virtual FWL_ERR SetBorderRegion(IFWL_Widget* pWidget, CFX_Path* pPath) = 0;
- virtual FWL_ERR SetTransparent(IFWL_Widget* pWidget, uint32_t dwAlpha) = 0;
- virtual FWL_ERR ShowWidget(IFWL_Widget* pWidget) = 0;
- virtual FWL_ERR HideWidget(IFWL_Widget* pWidget) = 0;
- virtual FWL_ERR SetNormal(IFWL_Widget* pWidget) = 0;
- virtual FWL_ERR SetMaximize(IFWL_Widget* pWidget) = 0;
- virtual FWL_ERR SetMinimize(IFWL_Widget* pWidget) = 0;
- virtual FX_BOOL CheckMessage() = 0;
- virtual FX_BOOL IsIdleMessage() = 0;
- virtual FWL_ERR DispatchMessage() = 0;
- virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget,
- const CFX_RectF* pRect) = 0;
- virtual FWL_ERR Exit(int32_t iExitCode) = 0;
- virtual FWL_ERR CreateWidgetWithNativeId(IFWL_Widget* pWidget,
- void* UserData) = 0;
- virtual FWL_ERR GetWidgetDC(IFWL_Widget* pWidget, void*& pDC) = 0;
- virtual FWL_ERR ReleaseWidgetDC(IFWL_Widget* pWidget,
- void* pDC,
- CFX_RectF* pClip = 0) = 0;
- virtual void* GetWindow(IFWL_Widget* pWidget) = 0;
- virtual uint32_t GetKeyState(uint32_t dwVirtKey) = 0;
- virtual FWL_ERR RunLoop(IFWL_Widget* widget) = 0;
- virtual FWL_ERR EndLoop() = 0;
- virtual FWL_ERR InitMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData) = 0;
- virtual FWL_ERR UpdateMenu(IFWL_Menu* pMenu,
- const void* hItem,
- int32_t iType) = 0;
- virtual FWL_ERR SetMessageHook(IFWL_AdapterMessageHook* hook) = 0;
- virtual FWL_ERR GetSystemBorder(FX_FLOAT& l,
- FX_FLOAT& t,
- FX_FLOAT& r,
- FX_FLOAT& b) = 0;
- virtual FX_BOOL GetPopupPos(IFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup) = 0;
-};
-
-#endif // XFA_FWL_CORE_IFWL_ADAPTERWIDGETMGR_H_
diff --git a/xfa/fwl/core/ifwl_app.h b/xfa/fwl/core/ifwl_app.h
index 53dc35d33a..af5fafe0ad 100644
--- a/xfa/fwl/core/ifwl_app.h
+++ b/xfa/fwl/core/ifwl_app.h
@@ -7,7 +7,7 @@
#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
+// The FWL app code contains three parallel classes, which reference each
// other via pointers as follows:
//
// m_pIface m_pImpl
@@ -22,25 +22,25 @@
#include "xfa/fwl/core/fwl_error.h"
class CFWL_NoteDriver;
-class IFWL_AdapterNative;
-class IFWL_AdapterWidgetMgr;
+class CXFA_FFApp;
+class CXFA_FWLAdapterWidgetMgr;
class IFWL_ThemeProvider;
class IFWL_Widget;
class IFWL_WidgetMgr;
class IFWL_App {
public:
- static IFWL_App* Create(IFWL_AdapterNative* pAdapter);
+ static IFWL_App* Create(CXFA_FFApp* pAdapter);
virtual ~IFWL_App() {}
FWL_ERR Initialize();
FWL_ERR Finalize();
- IFWL_AdapterNative* GetAdapterNative();
+ CXFA_FFApp* GetAdapterNative();
IFWL_WidgetMgr* GetWidgetMgr();
IFWL_ThemeProvider* GetThemeProvider();
- FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
- FWL_ERR Exit(int32_t iExitCode);
+ void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
+ void Exit(int32_t iExitCode);
// These call into polymorphic methods in the impl; no need to override.
void Release();
@@ -61,7 +61,7 @@ class IFWL_App {
IFWL_App* FWL_GetApp();
void FWL_SetApp(IFWL_App* pApp);
-IFWL_AdapterNative* FWL_GetAdapterNative();
-IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr();
+CXFA_FFApp* FWL_GetAdapterNative();
+CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr();
#endif // XFA_FWL_CORE_IFWL_APP_H_
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 62f7155c5d..8ec758a566 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -53,7 +53,7 @@ class IFWL_Widget {
uint32_t GetStylesEx();
FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
uint32_t GetStates();
- FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
FWL_ERR SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback);
diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index ff28b37646..96238ae348 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -15,6 +15,10 @@
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
+#define FWL_WGT_CalcHeight 2048
+#define FWL_WGT_CalcWidth 2048
+#define FWL_WGT_CalcMultiLineDefWidth 120.0f
+
IFWL_Widget* CFWL_Widget::GetWidget() {
return m_pIface;
}
@@ -42,7 +46,7 @@ static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
FWL_ERR CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return m_pIface->SetPrivateData(gs_pFWLWidget, this, NULL);
+ return m_pIface->SetPrivateData(gs_pFWLWidget, this, nullptr);
}
FWL_ERR CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
@@ -71,24 +75,22 @@ FWL_ERR CFWL_Widget::GetClientRect(CFX_RectF& rect) {
CFWL_Widget* CFWL_Widget::GetParent() {
if (!m_pIface)
- return NULL;
+ return nullptr;
+
IFWL_Widget* parent = m_pIface->GetParent();
- if (parent) {
+ if (parent)
return static_cast<CFWL_Widget*>(parent->GetPrivateData(gs_pFWLWidget));
- }
- return NULL;
+ return nullptr;
}
FWL_ERR CFWL_Widget::SetParent(CFWL_Widget* pParent) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return m_pIface->SetParent(pParent ? pParent->GetWidget() : NULL);
+ return m_pIface->SetParent(pParent ? pParent->GetWidget() : nullptr);
}
CFWL_Widget* CFWL_Widget::GetOwner() {
- if (!m_pIface)
- return NULL;
- return NULL;
+ return nullptr;
}
FWL_ERR CFWL_Widget::SetOwner(CFWL_Widget* pOwner) {
@@ -109,6 +111,7 @@ FWL_ERR CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
return FWL_ERR_Indefinite;
return m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved);
}
+
uint32_t CFWL_Widget::GetStylesEx() {
if (!m_pIface)
return 0;
@@ -126,10 +129,9 @@ uint32_t CFWL_Widget::GetStates() {
return m_pIface->GetStates();
}
-FWL_ERR CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
- if (!m_pIface)
- return FWL_ERR_Indefinite;
- return m_pIface->SetStates(dwStates, bSet);
+void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+ if (m_pIface)
+ m_pIface->SetStates(dwStates, bSet);
}
FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
@@ -142,7 +144,7 @@ FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
void* CFWL_Widget::GetPrivateData(void* module_id) {
if (!m_pIface)
- return NULL;
+ return nullptr;
return m_pIface->GetPrivateData(module_id);
}
@@ -175,13 +177,14 @@ FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
FX_FLOAT& fy) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, fx, fy);
+ return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, fx,
+ fy);
}
FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, rt);
+ return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, rt);
}
FWL_ERR CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
@@ -205,13 +208,14 @@ FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
if (!m_pIface)
- return NULL;
+ return nullptr;
+
m_pDelegate = m_pIface->SetDelegate(pDelegate);
return m_pDelegate;
}
CFWL_Widget::CFWL_Widget()
- : m_pIface(NULL), m_pDelegate(NULL), m_pProperties(NULL) {
+ : m_pIface(nullptr), m_pDelegate(nullptr), m_pProperties(nullptr) {
m_pProperties = new CFWL_WidgetProperties;
m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
ASSERT(m_pWidgetMgr);
@@ -228,6 +232,7 @@ CFWL_Widget::~CFWL_Widget() {
FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
+
CFX_RectF rect;
if (pRect) {
rect = *pRect;
@@ -254,7 +259,7 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
pDriver->SetFocus(m_pIface);
} else {
if (pDriver->GetFocus() == m_pIface) {
- pDriver->SetFocus(NULL);
+ pDriver->SetFocus(nullptr);
}
}
return FWL_ERR_Succeeded;
@@ -290,34 +295,33 @@ void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
return;
IFWL_Widget* pEventSourceImp =
- !pEventSource ? NULL : pEventSource->GetWidget();
+ !pEventSource ? nullptr : pEventSource->GetWidget();
pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter);
}
void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (!m_pIface)
return;
- if (m_pIface->GetOuter()) {
+ if (m_pIface->GetOuter())
return;
- }
+
IFWL_App* pApp = m_pIface->GetOwnerApp();
if (!pApp)
return;
+
CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver();
if (!pNoteDriver)
return;
+
pNoteDriver->SendEvent(pEvent);
}
-#define FWL_WGT_CalcHeight 2048
-#define FWL_WGT_CalcWidth 2048
-#define FWL_WGT_CalcMultiLineDefWidth 120.0f
-
CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
if (!m_pIface)
return CFX_SizeF();
+
IFWL_ThemeProvider* pTheme = m_pIface->GetThemeProvider();
if (!pTheme)
return CFX_SizeF();
diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h
index 19b22c6f29..5ec370ecea 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.h
+++ b/xfa/fwl/lightwidget/cfwl_widget.h
@@ -38,7 +38,7 @@ class CFWL_Widget {
uint32_t GetStylesEx();
FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
uint32_t GetStates();
- FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
FWL_ERR SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback);