diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-04 17:57:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 17:57:03 -0700 |
commit | c777f486f84611d2fdd2d03af661b14955f9efb6 (patch) | |
tree | 679012454d82e885f749d17f75fd12735efec29a /xfa/fwl/core | |
parent | 41aad19ba366540bd4efa20a9009ac1c70a81403 (diff) | |
download | pdfium-c777f486f84611d2fdd2d03af661b14955f9efb6.tar.xz |
Convert FWL_ERR into an enum class.
This Cl updates FWL_ERR to be an FWL_Error enum class. It removes FX_ERR and
replaces it with FWL_Error as well as the values were the same.
There were many places where we either returned other values for FWL_ERR
results.
This Cl is the same as: https://codereview.chromium.org/1943413002/ but I seem
to have messed up the base URL in that one.
TBR=tsepez@chromium.org
Review-Url: https://codereview.chromium.org/1952693003
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r-- | xfa/fwl/core/cfwl_event.h | 20 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_message.h | 22 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_appimp.cpp | 13 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_appimp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_error.h | 20 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_formimp.cpp | 99 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_formimp.h | 30 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.cpp | 81 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.h | 26 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_timerimp.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.cpp | 201 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.h | 66 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.cpp | 56 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_widgetmgrimp.h | 16 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_app.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_dataprovider.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_form.h | 6 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_themeprovider.h | 11 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_timer.h | 2 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_tooltiptarget.h | 14 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_widget.h | 50 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_widgetdelegate.h | 10 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_widgetmgr.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/include/ifwl_adaptertimermgr.h | 10 |
24 files changed, 391 insertions, 386 deletions
diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 7af8cabbb2..d9decac334 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -70,8 +70,8 @@ class CFWL_Event { : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} virtual ~CFWL_Event() {} - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { - return FWL_ERR_Succeeded; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; } @@ -90,14 +90,14 @@ class CFWL_Event { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_EVENT_DEF(classname, eventType) \ - class classname : public CFWL_Event { \ - public: \ - classname() : CFWL_Event() {} \ - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { \ - wsClass = L## #classname; \ - return FWL_ERR_Succeeded; \ - } \ +#define BEGIN_FWL_EVENT_DEF(classname, eventType) \ + class classname : public CFWL_Event { \ + public: \ + classname() : CFWL_Event() {} \ + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { \ + wsClass = L## #classname; \ + return FWL_Error::Succeeded; \ + } \ virtual CFWL_EventType GetClassID() const { return eventType; } #define END_FWL_EVENT_DEF \ diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 3a30c8fffd..74401c3e34 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -61,8 +61,8 @@ class CFWL_Message { virtual ~CFWL_Message() {} virtual CFWL_Message* Clone() { return nullptr; } - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { - return FWL_ERR_Succeeded; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } virtual CFWL_MessageType GetClassID() const { return CFWL_MessageType::None; } @@ -87,15 +87,15 @@ class CFWL_Message { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \ - class classname : public CFWL_Message { \ - public: \ - classname() : CFWL_Message() {} \ - CFWL_Message* Clone() override { return new classname(*this); } \ - FWL_ERR GetClassName(CFX_WideString& wsClass) const override { \ - wsClass = L## #classname; \ - return FWL_ERR_Succeeded; \ - } \ +#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \ + class classname : public CFWL_Message { \ + public: \ + classname() : CFWL_Message() {} \ + CFWL_Message* Clone() override { return new classname(*this); } \ + FWL_Error GetClassName(CFX_WideString& wsClass) const override { \ + wsClass = L## #classname; \ + return FWL_Error::Succeeded; \ + } \ CFWL_MessageType GetClassID() const override { return msgType; } #define END_FWL_MESSAGE_DEF \ diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp index ac00cca144..d7fa8bc1c0 100644 --- a/xfa/fwl/core/fwl_appimp.cpp +++ b/xfa/fwl/core/fwl_appimp.cpp @@ -20,11 +20,11 @@ IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) { void IFWL_App::Release() {} -FWL_ERR IFWL_App::Initialize() { +FWL_Error IFWL_App::Initialize() { return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); } -FWL_ERR IFWL_App::Finalize() { +FWL_Error IFWL_App::Finalize() { return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); } @@ -62,15 +62,15 @@ CFWL_AppImp::~CFWL_AppImp() { CFWL_ToolTipContainer::DeleteInstance(); } -FWL_ERR CFWL_AppImp::Initialize() { +FWL_Error CFWL_AppImp::Initialize() { if (!m_pWidgetMgr) { m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_AppImp::Finalize() { +FWL_Error CFWL_AppImp::Finalize() { m_pWidgetMgr.reset(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const { return m_pAdapterNative; @@ -82,6 +82,7 @@ CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { return m_pWidgetMgr.get(); } + void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pThemeProvider = pThemeProvider; } diff --git a/xfa/fwl/core/fwl_appimp.h b/xfa/fwl/core/fwl_appimp.h index 64b7922a15..b138ccb5be 100644 --- a/xfa/fwl/core/fwl_appimp.h +++ b/xfa/fwl/core/fwl_appimp.h @@ -26,8 +26,8 @@ class CFWL_AppImp { IFWL_App* GetInterface() const { return m_pIface; } CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); } - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CXFA_FFApp* GetAdapterNative() const; IFWL_WidgetMgr* GetWidgetMgr() const; IFWL_ThemeProvider* GetThemeProvider() const; diff --git a/xfa/fwl/core/fwl_error.h b/xfa/fwl/core/fwl_error.h index 92a483f4e8..e29f89e012 100644 --- a/xfa/fwl/core/fwl_error.h +++ b/xfa/fwl/core/fwl_error.h @@ -7,16 +7,14 @@ #ifndef XFA_FWL_CORE_FWL_ERROR_H_ #define XFA_FWL_CORE_FWL_ERROR_H_ -#include <stdint.h> - -typedef int32_t FWL_ERR; - -#define FWL_ERR_Succeeded 0 -#define FWL_ERR_Indefinite -1 -#define FWL_ERR_Parameter_Invalid -100 -#define FWL_ERR_Property_Invalid -200 -#define FWL_ERR_Intermediate_Value__Invalid -300 -#define FWL_ERR_Method_Not_Supported -400 -#define FWL_ERR_Out_Of_Memory -500 +enum class FWL_Error { + Succeeded = 0, + Indefinite, + ParameterInvalid, + PropertyInvalid, + IntermediateValueInvalid, + MethodNotSupported, + OutOfMemory +}; #endif // XFA_FWL_CORE_FWL_ERROR_H_ diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 78dc8b56a2..202a092395 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -48,7 +48,7 @@ IFWL_Form::IFWL_Form() {} FWL_FORMSIZE IFWL_Form::GetFormSize() { return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); } -FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { +FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); } IFWL_Widget* IFWL_Form::DoModal() { @@ -57,10 +57,10 @@ IFWL_Widget* IFWL_Form::DoModal() { IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); } -FWL_ERR IFWL_Form::EndDoModal() { +FWL_Error IFWL_Form::EndDoModal() { return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); } -FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { +FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); } @@ -99,9 +99,9 @@ CFWL_FormImp::~CFWL_FormImp() { delete m_pNoteLoop; } -FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Form; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_FormImp::GetClassID() const { @@ -114,22 +114,22 @@ FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { return CFWL_WidgetImp::IsInstance(wsClass); } -FWL_ERR CFWL_FormImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_FormImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; RegisterForm(); RegisterEventTarget(); m_pDelegate = new CFWL_FormImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormImp::Finalize() { +FWL_Error CFWL_FormImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; UnregisterEventTarget(); UnRegisterForm(); return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Reset(); FX_FLOAT fCapHeight = GetCaptionHeight(); @@ -141,23 +141,23 @@ FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) { if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } #ifdef FWL_UseMacSystemBorder rect = m_rtRelative; CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.left = 0; rect.top = 0; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #else FX_FLOAT x = 0; FX_FLOAT y = 0; @@ -176,12 +176,12 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #endif } -FWL_ERR CFWL_FormImp::Update() { +FWL_Error CFWL_FormImp::Update() { if (m_iLock > 0) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -195,7 +195,7 @@ FWL_ERR CFWL_FormImp::Update() { #endif UpdateCaption(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { GetAvailableTheme(); @@ -249,12 +249,12 @@ FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Client; } -FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; FX_BOOL bInactive = !IsActive(); int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; @@ -262,7 +262,7 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, DrawBackground(pGraphics, pTheme); } #ifdef FWL_UseMacSystemBorder - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #endif CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; @@ -365,14 +365,14 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, } } #endif - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_FORMSIZE CFWL_FormImp::GetFormSize() { return m_eFormSize; } -FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { +FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { m_eFormSize = eFormSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_FormImp::DoModal() { IFWL_App* pApp = GetOwnerApp(); @@ -399,31 +399,31 @@ IFWL_Widget* CFWL_FormImp::DoModal() { IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { return DoModal(); } -FWL_ERR CFWL_FormImp::EndDoModal() { +FWL_Error CFWL_FormImp::EndDoModal() { if (!m_pNoteLoop) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_bDoModalFlag = FALSE; #if (_FX_OS_ == _FX_MACOSX_) m_pNoteLoop->EndModalLoop(); IFWL_App* pApp = GetOwnerApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pDriver->PopNoteLoop(); SetStates(FWL_WGTSTATE_Invisible, TRUE); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #else SetStates(FWL_WGTSTATE_Invisible, TRUE); return m_pNoteLoop->EndModalLoop(); #endif } -FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { + return FWL_Error::Succeeded; } void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme) { @@ -842,9 +842,10 @@ CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) : m_pOwner(pOwner) {} #ifdef FWL_UseMacSystemBorder -int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; + switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; @@ -859,13 +860,12 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return FWL_ERR_Succeeded; } #else -int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; - int32_t iRet = 1; + return; + switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; @@ -938,7 +938,7 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return 0; + return; pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); if (!m_pOwner->m_bSetMaximize) @@ -962,24 +962,19 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } - return iRet; } #endif // FWL_UseMacSystemBorder -FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - if (!pEvent) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; -} +void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} -FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->SetGrab(TRUE); m_pOwner->m_bLButtonDown = TRUE; diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index d8bc80522e..f1bc51df37 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -69,24 +69,24 @@ class CFWL_FormImp : public CFWL_WidgetImp { public: CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_FormImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error 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(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR GetClientRect(CFX_RectF& rect); - virtual FWL_ERR Update(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error GetClientRect(CFX_RectF& rect); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual FWL_FORMSIZE GetFormSize(); - virtual FWL_ERR SetFormSize(FWL_FORMSIZE eFormSize); + virtual FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); virtual IFWL_Widget* DoModal(); virtual IFWL_Widget* DoModal(uint32_t& dwCommandID); - virtual FWL_ERR EndDoModal(); - virtual FWL_ERR SetBorderRegion(CFX_Path* pPath); + virtual FWL_Error EndDoModal(); + virtual FWL_Error SetBorderRegion(CFX_Path* pPath); virtual void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); CFWL_WidgetImp* GetSubFocus(); @@ -168,10 +168,10 @@ class CFWL_FormImp : public CFWL_WidgetImp { class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormImpDelegate(CFWL_FormImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 5d439d7f0c..560dc3c535 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -20,22 +20,22 @@ CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) : m_pForm(pForm), m_bContinueModal(TRUE) {} -FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { +FWL_Error CFWL_NoteLoop::Idle(int32_t count) { #if (_FX_OS_ == _FX_WIN32_DESKTOP_) if (count <= 0) { #endif CFWL_EvtIdle ev; IFWL_App* pApp = FWL_GetApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pDriver->SendEvent(&ev); #if (_FX_OS_ == _FX_WIN32_DESKTOP_) } #endif - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { return m_pForm; @@ -43,14 +43,14 @@ CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { FX_BOOL CFWL_NoteLoop::ContinueModal() { return m_bContinueModal; } -FWL_ERR CFWL_NoteLoop::EndModalLoop() { +FWL_Error CFWL_NoteLoop::EndModalLoop() { m_bContinueModal = FALSE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { m_pForm = pForm; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { CFWL_EvtMenuCommand ev; @@ -112,9 +112,9 @@ FX_BOOL CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { } #define FWL_NoteDriver_EventKey 1100 -FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, - IFWL_Widget* pEventSource, - uint32_t dwFilter) { +FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, + IFWL_Widget* pEventSource, + uint32_t dwFilter) { uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( (void*)(uintptr_t)FWL_NoteDriver_EventKey); if (dwkey == 0) { @@ -130,19 +130,19 @@ FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, m_eventTargets.SetAt((void*)(uintptr_t)dwkey, value); } value->SetEventSource(pEventSource, dwFilter); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { +FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( (void*)(uintptr_t)FWL_NoteDriver_EventKey); if (dwkey == 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } CFWL_EventTarget* value = NULL; if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { value->FlagInvalid(); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { ClearInvalidEventTargets(bRemoveAll); @@ -150,9 +150,9 @@ void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { IFWL_App* CFWL_NoteDriver::GetOwnerApp() const { return FWL_GetApp(); } -FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { +FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { m_noteLoopQueue.Add(pNoteLoop); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { int32_t pos = m_noteLoopQueue.GetSize(); @@ -203,10 +203,10 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { } return TRUE; } -FWL_ERR CFWL_NoteDriver::Run() { +FWL_Error CFWL_NoteDriver::Run() { CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ _FX_OS_ == _FX_WIN64_) @@ -220,7 +220,7 @@ FWL_ERR CFWL_NoteDriver::Run() { } #endif - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_NoteDriver::GetFocus() { @@ -272,31 +272,31 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { } } -FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_forms.Find(pForm) >= 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_forms.Add(pForm); if (m_forms.GetSize() == 1) { CFWL_NoteLoop* pLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); if (!pLoop) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pLoop->SetMainForm(pForm); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; int32_t nIndex = m_forms.Find(pForm); if (nIndex < 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_forms.RemoveAt(nIndex); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { pMessage->Retain(); @@ -688,7 +688,7 @@ void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { } class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { public: - FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); int32_t GetInitialDelay(IFWL_Widget* pWidget); int32_t GetAutoPopDelay(IFWL_Widget* pWidget); CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); @@ -706,10 +706,10 @@ CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { m_nAutoPopDelayTime = 50000; m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); } -FWL_ERR CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { return m_nInitDelayTime; @@ -820,20 +820,21 @@ void CFWL_ToolTipContainer::DeleteInstance() { s_pInstance = NULL; } -FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { +FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { if (m_arrWidget.Find(pTarget) < 0) { m_arrWidget.Add(pTarget); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } -FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) { +FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget( + IFWL_ToolTipTarget* pTarget) { int index = m_arrWidget.Find(pTarget); if (index >= 0) { m_arrWidget.RemoveAt(index); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) { int32_t iCount = m_arrWidget.GetSize(); @@ -881,7 +882,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, rt.height = r.height; } CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); - if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) { + if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) { rt.left = pt.x; rt.top = pt.y; m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 723d2e5742..778eae6045 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -44,11 +44,11 @@ class CFWL_NoteLoop { CFWL_NoteLoop(CFWL_WidgetImp* pForm = nullptr); ~CFWL_NoteLoop() {} - FWL_ERR Idle(int32_t count); + FWL_Error Idle(int32_t count); CFWL_WidgetImp* GetForm(); FX_BOOL ContinueModal(); - FWL_ERR EndModalLoop(); - FWL_ERR SetMainForm(CFWL_WidgetImp* pForm); + FWL_Error EndModalLoop(); + FWL_Error SetMainForm(CFWL_WidgetImp* pForm); protected: void GenerateCommondEvent(uint32_t dwCommand); @@ -63,25 +63,25 @@ class CFWL_NoteDriver { ~CFWL_NoteDriver(); FX_BOOL SendEvent(CFWL_Event* pNote); - FWL_ERR RegisterEventTarget(IFWL_Widget* pListener, - IFWL_Widget* pEventSource = nullptr, - uint32_t dwFilter = FWL_EVENT_ALL_MASK); - FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener); + FWL_Error RegisterEventTarget(IFWL_Widget* pListener, + IFWL_Widget* pEventSource = nullptr, + uint32_t dwFilter = FWL_EVENT_ALL_MASK); + FWL_Error UnregisterEventTarget(IFWL_Widget* pListener); void ClearEventTargets(FX_BOOL bRemoveAll); IFWL_App* GetOwnerApp() const; - FWL_ERR PushNoteLoop(CFWL_NoteLoop* pNoteLoop); + FWL_Error 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(); + FWL_Error Run(); IFWL_Widget* GetHover(); void SetHover(IFWL_Widget* pHover); void NotifyTargetHide(IFWL_Widget* pNoteTarget); void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); - FWL_ERR RegisterForm(CFWL_WidgetImp* pForm); - FWL_ERR UnRegisterForm(CFWL_WidgetImp* pForm); + FWL_Error RegisterForm(CFWL_WidgetImp* pForm); + FWL_Error UnRegisterForm(CFWL_WidgetImp* pForm); FX_BOOL QueueMessage(CFWL_Message* pMessage); FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* GetTopLoop(); @@ -141,8 +141,8 @@ class CFWL_ToolTipContainer { static CFWL_ToolTipContainer* getInstance(); static void DeleteInstance(); - FX_ERR AddToolTipTarget(IFWL_ToolTipTarget* pTarget); - FX_ERR RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); + FWL_Error AddToolTipTarget(IFWL_ToolTipTarget* pTarget); + FWL_Error RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); IFWL_ToolTipTarget* GetCurrentToolTipTarget(); FX_BOOL HasToolTip(IFWL_Widget* pWidget); diff --git a/xfa/fwl/core/fwl_timerimp.cpp b/xfa/fwl/core/fwl_timerimp.cpp index 5adf8e158c..ced5adeb9d 100644 --- a/xfa/fwl/core/fwl_timerimp.cpp +++ b/xfa/fwl/core/fwl_timerimp.cpp @@ -23,12 +23,14 @@ FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer, pAdapterTimerMgr->Start(pTimer, dwElapse, hTimer, bImmediately); return hTimer; } -int32_t FWL_StopTimer(FWL_HTIMER hTimer) { + +FWL_Error FWL_StopTimer(FWL_HTIMER hTimer) { CXFA_FFApp* pAdapterNative = FWL_GetAdapterNative(); if (!pAdapterNative) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr(); if (!pAdapterTimerMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return pAdapterTimerMgr->Stop(hTimer); } diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index 8863cef0f3..f45a66cc2d 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -28,7 +28,7 @@ IFWL_Widget::~IFWL_Widget() {} -FWL_ERR IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { +FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { return m_pImpl->GetClassName(wsClass); } @@ -40,37 +40,37 @@ FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { return m_pImpl->IsInstance(wsClass); } -FWL_ERR IFWL_Widget::Initialize() { +FWL_Error IFWL_Widget::Initialize() { return m_pImpl->Initialize(); } -FWL_ERR IFWL_Widget::Finalize() { +FWL_Error IFWL_Widget::Finalize() { return m_pImpl->Finalize(); } -FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->GetWidgetRect(rect, bAutoSize); } -FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { +FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); } -FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); } -FWL_ERR IFWL_Widget::GetClientRect(CFX_RectF& rect) { +FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetClientRect(rect); } IFWL_Widget* IFWL_Widget::GetParent() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetParent(); } -FWL_ERR IFWL_Widget::SetParent(IFWL_Widget* pParent) { +FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetParent(pParent); } IFWL_Widget* IFWL_Widget::GetOwner() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwner(); } -FWL_ERR IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { +FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetOwner(pOwner); } IFWL_Widget* IFWL_Widget::GetOuter() { @@ -79,16 +79,16 @@ IFWL_Widget* IFWL_Widget::GetOuter() { uint32_t IFWL_Widget::GetStyles() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStyles(); } -FWL_ERR IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->ModifyStyles(dwStylesAdded, dwStylesRemoved); } uint32_t IFWL_Widget::GetStylesEx() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStylesEx(); } -FWL_ERR IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -98,54 +98,54 @@ uint32_t IFWL_Widget::GetStates() { 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, - PD_CALLBACK_FREEDATA callback) { +FWL_Error IFWL_Widget::SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetPrivateData(module_id, pData, callback); } void* IFWL_Widget::GetPrivateData(void* module_id) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetPrivateData(module_id); } -FWL_ERR IFWL_Widget::Update() { +FWL_Error IFWL_Widget::Update() { return static_cast<CFWL_WidgetImp*>(GetImpl())->Update(); } -FWL_ERR IFWL_Widget::LockUpdate() { +FWL_Error IFWL_Widget::LockUpdate() { return static_cast<CFWL_WidgetImp*>(GetImpl())->LockUpdate(); } -FWL_ERR IFWL_Widget::UnlockUpdate() { +FWL_Error IFWL_Widget::UnlockUpdate() { return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate(); } FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy); } -FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, fx, fy); } -FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, rt); } -FWL_ERR IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetMatrix(matrix, bGlobal); } -FWL_ERR IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { +FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetMatrix(matrix); } -FWL_ERR IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->DrawWidget(pGraphics, pMatrix); } IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetThemeProvider(); } -FWL_ERR IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetThemeProvider(pThemeProvider); } -FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { +FWL_Error IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetDataProvider(pDataProvider); } @@ -159,15 +159,17 @@ CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); } -FWL_ERR CFWL_WidgetImp::Initialize() { +FWL_Error CFWL_WidgetImp::Initialize() { IFWL_App* pApp = FWL_GetApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + CXFA_FFApp* pAdapter = pApp->GetAdapterNative(); if (!pAdapter) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; SetOwnerApp(static_cast<CFWL_AppImp*>(FWL_GetApp()->GetImpl())); + IFWL_Widget* pParent = m_pProperties->m_pParent; m_pWidgetMgr->InsertWidget(pParent, m_pInterface); if (!IsChild()) { @@ -175,18 +177,18 @@ FWL_ERR CFWL_WidgetImp::Initialize() { if (pOwner) m_pWidgetMgr->SetOwner(pOwner, m_pInterface); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::Finalize() { +FWL_Error CFWL_WidgetImp::Finalize() { NotifyDriver(); m_pWidgetMgr->RemoveWidget(m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { wsClass.clear(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetClassID() const { @@ -197,7 +199,7 @@ FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { return FALSE; } -FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); @@ -210,21 +212,21 @@ FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { IFWL_Widget* pForm = m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.Set(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); if (pForm == m_pInterface) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } return TransformTo(pForm, rect); } -FWL_ERR CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { CFX_RectF rtOld = m_pProperties->m_rtWidget; m_pProperties->m_rtWidget = rect; if (IsChild()) { @@ -239,34 +241,34 @@ FWL_ERR CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { pDelegate->OnProcessEvent(&ev); } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pWidgetMgr->SetWidgetRect_Native(m_pInterface, rect); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { GetEdgeRect(rect); if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); rect.Deflate(fEdge, fEdge); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetParent() { return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Parent); } -FWL_ERR CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { +FWL_Error CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { m_pProperties->m_pParent = pParent; m_pWidgetMgr->SetParent(pParent, m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetOwner() { return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Owner); } -FWL_ERR CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { +FWL_Error CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { m_pProperties->m_pOwner = pOwner; m_pWidgetMgr->SetOwner(pOwner, m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetOuter() { return m_pOuter; @@ -274,20 +276,20 @@ IFWL_Widget* CFWL_WidgetImp::GetOuter() { uint32_t CFWL_WidgetImp::GetStyles() { return m_pProperties->m_dwStyles; } -FWL_ERR CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +FWL_Error CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { m_pProperties->m_dwStyles = (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetStylesEx() { return m_pProperties->m_dwStyleExes; } -FWL_ERR CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { m_pProperties->m_dwStyleExes = (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetStates() { return m_pProperties->m_dwStates; @@ -302,6 +304,7 @@ static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr, child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); } } + void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { bSet ? (m_pProperties->m_dwStates |= dwStates) : (m_pProperties->m_dwStates &= ~dwStates); @@ -321,32 +324,32 @@ void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { } return; } -FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { +FWL_Error CFWL_WidgetImp::SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback) { if (!m_pPrivateData) { m_pPrivateData = new CFX_PrivateData; } m_pPrivateData->SetPrivateData(module_id, pData, callback); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_WidgetImp::GetPrivateData(void* module_id) { if (!m_pPrivateData) return NULL; return m_pPrivateData->GetPrivateData(module_id); } -FWL_ERR CFWL_WidgetImp::Update() { - return FWL_ERR_Succeeded; +FWL_Error CFWL_WidgetImp::Update() { + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::LockUpdate() { +FWL_Error CFWL_WidgetImp::LockUpdate() { m_iLock++; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::UnlockUpdate() { +FWL_Error CFWL_WidgetImp::UnlockUpdate() { if (IsLocked()) { m_iLock--; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtClient; @@ -367,9 +370,9 @@ FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { if (m_pWidgetMgr->IsFormDisabled()) { CFX_SizeF szOffset; if (IsParent(pWidget)) { @@ -381,7 +384,7 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, } fx += szOffset.x; fy += szOffset.y; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_RectF r; CFX_Matrix m; @@ -396,17 +399,17 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, IFWL_Widget* form1 = m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); if (!form1) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!pWidget) { form1->GetWidgetRect(r); fx += r.left; fy += r.top; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* form2 = m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); if (!form2) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (form1 != form2) { form1->GetWidgetRect(r); fx += r.left; @@ -426,14 +429,14 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, fx -= r.left; fy -= r.top; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { +FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return TransformTo(pWidget, rt.left, rt.top); } -FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { if (!m_pProperties) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (bGlobal) { IFWL_Widget* parent = GetParent(); CFX_ArrayTemplate<IFWL_Widget*> parents; @@ -457,32 +460,32 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { } else { matrix = m_pProperties->m_ctmOnParent; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { +FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { if (!m_pProperties) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_Widget* parent = GetParent(); if (!parent) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_pProperties->m_ctmOnParent = matrix; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Indefinite; +FWL_Error CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + return FWL_Error::Indefinite; } IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { return m_pProperties->m_pThemeProvider; } -FWL_ERR CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { +FWL_Error CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { m_pProperties->m_pDataProvider = pDataProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( IFWL_WidgetDelegate* pDelegate) { @@ -499,9 +502,9 @@ IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); } -FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { +FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { m_pOwnerApp = pOwnerApp; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetInterface() const { return m_pInterface; @@ -963,9 +966,9 @@ FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) { CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} -int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage->m_pDstTarget) - return 0; + return; CFWL_WidgetImp* pWidget = static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); @@ -1030,16 +1033,12 @@ int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return 1; } -FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} +void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} -FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { CFWL_EvtDraw evt; evt.m_pGraphics = pGraphics; - return FWL_ERR_Succeeded; } diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index d20fe0d75e..4af2872f41 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -28,49 +28,51 @@ class CFWL_WidgetImp { public: virtual ~CFWL_WidgetImp(); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error 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); - virtual FWL_ERR SetWidgetRect(const CFX_RectF& rect); - virtual FWL_ERR GetClientRect(CFX_RectF& rect); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error GetGlobalRect(CFX_RectF& rect); + virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); + virtual FWL_Error GetClientRect(CFX_RectF& rect); virtual IFWL_Widget* GetParent(); - virtual FWL_ERR SetParent(IFWL_Widget* pParent); + virtual FWL_Error SetParent(IFWL_Widget* pParent); virtual IFWL_Widget* GetOwner(); - virtual FWL_ERR SetOwner(IFWL_Widget* pOwner); + virtual FWL_Error SetOwner(IFWL_Widget* pOwner); virtual IFWL_Widget* GetOuter(); virtual uint32_t GetStyles(); - virtual FWL_ERR ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved); + virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved); virtual uint32_t GetStylesEx(); - virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); virtual uint32_t GetStates(); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - virtual FWL_ERR SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); + virtual FWL_Error SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); virtual void* GetPrivateData(void* module_id); - virtual FWL_ERR Update(); - virtual FWL_ERR LockUpdate(); - virtual FWL_ERR UnlockUpdate(); + virtual FWL_Error Update(); + virtual FWL_Error LockUpdate(); + virtual FWL_Error UnlockUpdate(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); - virtual FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - virtual FWL_ERR SetMatrix(const CFX_Matrix& matrix); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy); + virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual IFWL_ThemeProvider* GetThemeProvider(); - virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); - virtual FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); virtual IFWL_App* GetOwnerApp() const; - FWL_ERR SetOwnerApp(CFWL_AppImp* pOwnerApp); + FWL_Error SetOwnerApp(CFWL_AppImp* pOwnerApp); IFWL_Widget* GetInterface() const; void SetInterface(IFWL_Widget* pInterface); CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); @@ -163,10 +165,10 @@ class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { public: CFWL_WidgetImpDelegate(); ~CFWL_WidgetImpDelegate() override {} - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; }; #endif // XFA_FWL_CORE_FWL_WIDGETIMP_H_ diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index e56c308be9..28500c2cb2 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -219,10 +219,10 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { } return TRUE; } -FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect) { +FWL_Error CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect) { if (!m_pAdapter) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_Widget* pNative = pWidget; CFX_RectF rect(*pRect); if (IsFormDisabled()) { @@ -238,7 +238,7 @@ FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, } else if (!IsAbleNative(pWidget)) { pNative = GetWidget(pWidget, FWL_WGTRELATION_SystemForm); if (!pNative) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pWidget->TransformTo(pNative, rect.left, rect.top); } AddRedrawCounts(pNative); @@ -371,8 +371,9 @@ FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) { } while (pTemp); return FALSE; } -FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, - const CFX_RectF& rect) { + +FWL_Error CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, + const CFX_RectF& rect) { if (FWL_UseOffscreen(pWidget)) { CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); pItem->iRedrawCounter++; @@ -391,8 +392,9 @@ FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, pItem->bOutsideChanged = !m_rtScreen.Contains(rect); #endif } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, FX_FLOAT x, FX_FLOAT y) { @@ -631,25 +633,26 @@ FX_BOOL CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, } CFWL_WidgetMgrDelegate::CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr) : m_pWidgetMgr(pWidgetMgr) {} -FWL_ERR CFWL_WidgetMgrDelegate::OnSetCapability(uint32_t dwCapability) { +FWL_Error CFWL_WidgetMgrDelegate::OnSetCapability(uint32_t dwCapability) { m_pWidgetMgr->m_dwCapability = dwCapability; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { + +void CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!pMessage->m_pDstTarget) - return 0; + return; IFWL_Widget* pDstWidget = pMessage->m_pDstTarget; IFWL_App* pApp = pDstWidget->GetOwnerApp(); if (!pApp) - return 0; + return; CFWL_NoteDriver* pNoteDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); if (!pNoteDriver) - return 0; + return; if (m_pWidgetMgr->IsThreadEnabled()) pMessage = static_cast<CFWL_Message*>(pMessage->Clone()); @@ -660,23 +663,21 @@ int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { #if (_FX_OS_ == _FX_MACOSX_) CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); - if (pTopLoop) { + if (pTopLoop) pNoteDriver->UnqueueMessage(pTopLoop); - } #endif - if (m_pWidgetMgr->IsThreadEnabled()) { + + if (m_pWidgetMgr->IsThreadEnabled()) pMessage->Release(); - } - return FWL_ERR_Succeeded; + + return; } -FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - if (!pWidget) - return FWL_ERR_Indefinite; - if (!pGraphics) - return FWL_ERR_Indefinite; +void CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + if (!pWidget || !pGraphics) + return; CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); CFX_RectF clipCopy; @@ -684,7 +685,7 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, clipCopy.left = clipCopy.top = 0; if (bUseOffscreenDirect(pWidget)) { DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); - return FWL_ERR_Succeeded; + return; } CFX_RectF clipBounds; @@ -718,7 +719,6 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); m_pWidgetMgr->ResetRedrawCounts(pWidget); - return FWL_ERR_Succeeded; } void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h index ff732e5cc0..fe17613364 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.h +++ b/xfa/fwl/core/fwl_widgetmgrimp.h @@ -71,8 +71,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { FWL_WGTRELATION eRelation) override; int32_t GetWidgetIndex(IFWL_Widget* pWidget) override; FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) override; - FWL_ERR RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect = NULL) override; + FWL_Error RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect = NULL) override; uint32_t GetCapability() override { return m_dwCapability; } void AddWidget(IFWL_Widget* pWidget); @@ -83,7 +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 SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); + FWL_Error SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); 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); @@ -127,11 +127,11 @@ class CFWL_WidgetMgrDelegate { CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr); ~CFWL_WidgetMgrDelegate() {} - 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); + FWL_Error OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread); + void OnProcessMessageToForm(CFWL_Message* pMessage); + void OnDrawWidget(IFWL_Widget* pWidget, + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix); protected: void DrawChild(IFWL_Widget* pParent, diff --git a/xfa/fwl/core/ifwl_app.h b/xfa/fwl/core/ifwl_app.h index af5fafe0ad..41983ef8f5 100644 --- a/xfa/fwl/core/ifwl_app.h +++ b/xfa/fwl/core/ifwl_app.h @@ -34,8 +34,8 @@ class IFWL_App { virtual ~IFWL_App() {} - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CXFA_FFApp* GetAdapterNative(); IFWL_WidgetMgr* GetWidgetMgr(); IFWL_ThemeProvider* GetThemeProvider(); diff --git a/xfa/fwl/core/ifwl_dataprovider.h b/xfa/fwl/core/ifwl_dataprovider.h index 271edb7ac8..5643a3d079 100644 --- a/xfa/fwl/core/ifwl_dataprovider.h +++ b/xfa/fwl/core/ifwl_dataprovider.h @@ -15,8 +15,8 @@ class IFWL_Widget; class IFWL_DataProvider { public: virtual ~IFWL_DataProvider() {} - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) = 0; }; #endif // XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 185e059826..22d6ecea12 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -53,11 +53,11 @@ class IFWL_Form : public IFWL_Widget { IFWL_Widget* pOuter); FWL_FORMSIZE GetFormSize(); - FWL_ERR SetFormSize(FWL_FORMSIZE eFormSize); + FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); IFWL_Widget* DoModal(); IFWL_Widget* DoModal(uint32_t& dwCommandID); - FWL_ERR EndDoModal(); - FWL_ERR SetBorderRegion(CFX_Path* pPath); + FWL_Error EndDoModal(); + FWL_Error SetBorderRegion(CFX_Path* pPath); protected: IFWL_Form(); diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index c790da5f4e..66e7e0c4fd 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -25,16 +25,17 @@ class IFWL_ThemeProvider { virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) = 0; - virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; - virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) = 0; + virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, + CFX_Matrix& matrix) = 0; + virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) = 0; virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) = 0; virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) = 0; + virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) = 0; virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy) = 0; diff --git a/xfa/fwl/core/ifwl_timer.h b/xfa/fwl/core/ifwl_timer.h index 5f113bc021..0143560410 100644 --- a/xfa/fwl/core/ifwl_timer.h +++ b/xfa/fwl/core/ifwl_timer.h @@ -19,6 +19,6 @@ class IFWL_Timer { FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer, uint32_t dwElapse, FX_BOOL bImmediately = TRUE); -int32_t FWL_StopTimer(FWL_HTIMER hTimer); +FWL_Error FWL_StopTimer(FWL_HTIMER hTimer); #endif // XFA_FWL_CORE_IFWL_TIMER_H_ diff --git a/xfa/fwl/core/ifwl_tooltiptarget.h b/xfa/fwl/core/ifwl_tooltiptarget.h index 0b364f2754..7489e73efd 100644 --- a/xfa/fwl/core/ifwl_tooltiptarget.h +++ b/xfa/fwl/core/ifwl_tooltiptarget.h @@ -20,13 +20,15 @@ class IFWL_ToolTipTarget { virtual ~IFWL_ToolTipTarget() {} virtual IFWL_Widget* GetWidget() = 0; virtual FX_BOOL IsShowed() = 0; - virtual FWL_ERR DrawToolTip(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix, - IFWL_Widget* pToolTip) = 0; + virtual FWL_Error DrawToolTip(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix, + IFWL_Widget* pToolTip) = 0; virtual FX_BOOL UseDefaultTheme() = 0; - virtual FWL_ERR GetCaption(CFX_WideString& wsCaption) = 0; - virtual FWL_ERR GetToolTipSize(CFX_SizeF& sz) = 0; - virtual FWL_ERR GetToolTipPos(CFX_PointF& pt) { return FWL_ERR_Indefinite; } + virtual FWL_Error GetCaption(CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetToolTipSize(CFX_SizeF& sz) = 0; + virtual FWL_Error GetToolTipPos(CFX_PointF& pt) { + return FWL_Error::Indefinite; + } }; #endif // XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_ diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 8ec758a566..691e4606c5 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -39,48 +39,50 @@ class IFWL_Widget { 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); - FWL_ERR GetClientRect(CFX_RectF& rect); + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error GetGlobalRect(CFX_RectF& rect); + FWL_Error SetWidgetRect(const CFX_RectF& rect); + FWL_Error GetClientRect(CFX_RectF& rect); IFWL_Widget* GetParent(); - FWL_ERR SetParent(IFWL_Widget* pParent); + FWL_Error SetParent(IFWL_Widget* pParent); IFWL_Widget* GetOwner(); - FWL_ERR SetOwner(IFWL_Widget* pOwner); + FWL_Error SetOwner(IFWL_Widget* pOwner); IFWL_Widget* GetOuter(); uint32_t GetStyles(); - FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); + FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); uint32_t GetStylesEx(); - FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); + FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); uint32_t GetStates(); void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - FWL_ERR SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); + FWL_Error SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); void* GetPrivateData(void* module_id); - FWL_ERR Update(); - FWL_ERR LockUpdate(); - FWL_ERR UnlockUpdate(); + FWL_Error Update(); + FWL_Error LockUpdate(); + FWL_Error UnlockUpdate(); FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); - FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - FWL_ERR SetMatrix(const CFX_Matrix& matrix); - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); + FWL_Error TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); + FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + FWL_Error SetMatrix(const CFX_Matrix& matrix); + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); IFWL_ThemeProvider* GetThemeProvider(); - FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); - FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); + FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); 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; + FWL_Error GetClassName(CFX_WideString& wsClass) const; uint32_t GetClassID() const; FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } diff --git a/xfa/fwl/core/ifwl_widgetdelegate.h b/xfa/fwl/core/ifwl_widgetdelegate.h index 7fb56d3ba1..820fb6b1c4 100644 --- a/xfa/fwl/core/ifwl_widgetdelegate.h +++ b/xfa/fwl/core/ifwl_widgetdelegate.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ #define XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ +#include <stdint.h> + #include "xfa/fwl/core/fwl_error.h" class CFWL_Event; @@ -17,10 +19,10 @@ class CFX_Matrix; class IFWL_WidgetDelegate { public: virtual ~IFWL_WidgetDelegate() {} - virtual int32_t OnProcessMessage(CFWL_Message* pMessage) = 0; - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent) = 0; - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) = 0; + virtual void OnProcessMessage(CFWL_Message* pMessage) = 0; + virtual void OnProcessEvent(CFWL_Event* pEvent) = 0; + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) = 0; }; #endif // XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ diff --git a/xfa/fwl/core/ifwl_widgetmgr.h b/xfa/fwl/core/ifwl_widgetmgr.h index 3924ba8a29..6e25b72290 100644 --- a/xfa/fwl/core/ifwl_widgetmgr.h +++ b/xfa/fwl/core/ifwl_widgetmgr.h @@ -37,8 +37,8 @@ class IFWL_WidgetMgr { FWL_WGTRELATION eRelation) = 0; virtual int32_t GetWidgetIndex(IFWL_Widget* pWidget) = 0; virtual FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) = 0; - virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect = NULL) = 0; + virtual FWL_Error RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect = NULL) = 0; virtual uint32_t GetCapability() = 0; }; diff --git a/xfa/fwl/core/include/ifwl_adaptertimermgr.h b/xfa/fwl/core/include/ifwl_adaptertimermgr.h index 64fc260ce5..7859e31fd8 100644 --- a/xfa/fwl/core/include/ifwl_adaptertimermgr.h +++ b/xfa/fwl/core/include/ifwl_adaptertimermgr.h @@ -15,11 +15,11 @@ class IFWL_Timer; class IFWL_AdapterTimerMgr { public: virtual ~IFWL_AdapterTimerMgr() {} - virtual FWL_ERR Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - FWL_HTIMER& hTimer, - FX_BOOL bImmediately = TRUE) = 0; - virtual FWL_ERR Stop(FWL_HTIMER hTimer) = 0; + virtual FWL_Error Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + FWL_HTIMER& hTimer, + FX_BOOL bImmediately = TRUE) = 0; + virtual FWL_Error Stop(FWL_HTIMER hTimer) = 0; }; #endif // XFA_FWL_CORE_INCLUDE_IFWL_ADAPTERTIMERMGR_H_ |