From c777f486f84611d2fdd2d03af661b14955f9efb6 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 4 May 2016 17:57:03 -0700 Subject: 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 --- xfa/fwl/basewidget/fwl_barcodeimp.cpp | 42 ++-- xfa/fwl/basewidget/fwl_barcodeimp.h | 16 +- xfa/fwl/basewidget/fwl_caretimp.cpp | 77 +++---- xfa/fwl/basewidget/fwl_caretimp.h | 28 +-- xfa/fwl/basewidget/fwl_checkboximp.cpp | 63 +++--- xfa/fwl/basewidget/fwl_checkboximp.h | 22 +- xfa/fwl/basewidget/fwl_comboboximp.cpp | 253 +++++++++++---------- xfa/fwl/basewidget/fwl_comboboximp.h | 82 +++---- xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 248 +++++++++++---------- xfa/fwl/basewidget/fwl_datetimepickerimp.h | 76 +++---- xfa/fwl/basewidget/fwl_editimp.cpp | 321 +++++++++++++++------------ xfa/fwl/basewidget/fwl_editimp.h | 72 +++--- xfa/fwl/basewidget/fwl_formproxyimp.cpp | 30 +-- xfa/fwl/basewidget/fwl_formproxyimp.h | 14 +- xfa/fwl/basewidget/fwl_listboximp.cpp | 122 +++++----- xfa/fwl/basewidget/fwl_listboximp.h | 32 ++- xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 48 ++-- xfa/fwl/basewidget/fwl_monthcalendarimp.h | 20 +- xfa/fwl/basewidget/fwl_pictureboximp.cpp | 45 ++-- xfa/fwl/basewidget/fwl_pictureboximp.h | 19 +- xfa/fwl/basewidget/fwl_pushbuttonimp.cpp | 56 +++-- xfa/fwl/basewidget/fwl_pushbuttonimp.h | 22 +- xfa/fwl/basewidget/fwl_scrollbarimp.cpp | 92 ++++---- xfa/fwl/basewidget/fwl_scrollbarimp.h | 34 +-- xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 58 +++-- xfa/fwl/basewidget/fwl_spinbuttonimp.h | 24 +- xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp | 92 ++++---- xfa/fwl/basewidget/fwl_tooltipctrlimp.h | 30 +-- xfa/fwl/basewidget/ifwl_caret.h | 6 +- xfa/fwl/basewidget/ifwl_checkbox.h | 2 +- xfa/fwl/basewidget/ifwl_combobox.h | 24 +- xfa/fwl/basewidget/ifwl_datetimepicker.h | 28 +-- xfa/fwl/basewidget/ifwl_edit.h | 46 ++-- xfa/fwl/basewidget/ifwl_listbox.h | 54 +++-- xfa/fwl/basewidget/ifwl_picturebox.h | 2 +- xfa/fwl/basewidget/ifwl_scrollbar.h | 12 +- xfa/fwl/basewidget/ifwl_spinbutton.h | 2 +- xfa/fwl/basewidget/ifwl_tooltip.h | 10 +- 38 files changed, 1129 insertions(+), 1095 deletions(-) (limited to 'xfa/fwl/basewidget') diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index d4589e39c1..ce9d083d83 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -38,45 +38,45 @@ CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties, CFWL_BarcodeImp::~CFWL_BarcodeImp() { ReleaseBarcodeEngine(); } -FWL_ERR CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Barcode; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_BarcodeImp::GetClassID() const { return FWL_CLASSHASH_Barcode; } -FWL_ERR CFWL_BarcodeImp::Initialize() { +FWL_Error CFWL_BarcodeImp::Initialize() { if (!m_pDelegate) { m_pDelegate = new CFWL_BarcodeImpDelegate(this); } - if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; + if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_BarcodeImp::Finalize() { +FWL_Error CFWL_BarcodeImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; ReleaseBarcodeEngine(); return CFWL_EditImp::Finalize(); } -FWL_ERR CFWL_BarcodeImp::Update() { +FWL_Error CFWL_BarcodeImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } - FWL_ERR ret = CFWL_EditImp::Update(); + FWL_Error ret = CFWL_EditImp::Update(); GenerateBarcodeImageCache(); return ret; } -FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_BarcodeImp::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; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { GenerateBarcodeImageCache(); if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_Matrix mt; mt.e = m_rtClient.left; @@ -87,9 +87,9 @@ FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, int32_t errorCode = 0; if (!m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix, errorCode)) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } return CFWL_EditImp::DrawWidget(pGraphics, pMatrix); } @@ -105,7 +105,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { if (!m_pBarcodeEngine) return; CFX_WideString wsText; - if (GetText(wsText) != FWL_ERR_Succeeded) + if (GetText(wsText) != FWL_Error::Succeeded) return; CFWL_ThemePart part; part.m_pWidget = m_pInterface; @@ -200,7 +200,7 @@ void CFWL_BarcodeImp::SetType(BC_TYPE type) { m_type = type; m_dwStatus = XFA_BCS_NeedUpdate; } -FWL_ERR CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) { +FWL_Error CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) { ReleaseBarcodeEngine(); m_dwStatus = XFA_BCS_NeedUpdate; return CFWL_EditImp::SetText(wsText); @@ -220,11 +220,11 @@ FX_BOOL CFWL_BarcodeImp::IsProtectedType() { CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) : CFWL_EditImpDelegate(pOwner) {} -FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { CFWL_BarcodeImp* pOwner = static_cast(m_pOwner); pOwner->ReleaseBarcodeEngine(); pOwner->m_dwStatus = XFA_BCS_NeedUpdate; } - return CFWL_EditImpDelegate::OnProcessEvent(pEvent); + CFWL_EditImpDelegate::OnProcessEvent(pEvent); } diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.h b/xfa/fwl/basewidget/fwl_barcodeimp.h index eacecc3c4e..68c017e63e 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.h +++ b/xfa/fwl/basewidget/fwl_barcodeimp.h @@ -25,14 +25,14 @@ class CFWL_BarcodeImp : public CFWL_EditImp { IFWL_Widget* pOuter); ~CFWL_BarcodeImp() override; - FWL_ERR GetClassName(CFX_WideString& wsClass) const override; + FWL_Error GetClassName(CFX_WideString& wsClass) const override; uint32_t GetClassID() const override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; - FWL_ERR Update() override; - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_ERR SetText(const CFX_WideString& wsText) override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + FWL_Error SetText(const CFX_WideString& wsText) override; void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); @@ -51,7 +51,7 @@ class CFWL_BarcodeImp : public CFWL_EditImp { class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { public: CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner); - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + void OnProcessEvent(CFWL_Event* pEvent) override; }; #endif // XFA_FWL_BASEWIDGET_FWL_BARCODEIMP_H_ diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index 23a5213a4d..2b4a67cb1a 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -25,13 +25,13 @@ IFWL_Caret::IFWL_Caret() {} void IFWL_Caret::ShowCaret(FX_BOOL bFlag) { static_cast(GetImpl())->ShowCaret(bFlag); } -FWL_ERR IFWL_Caret::GetFrequency(uint32_t& elapse) { +FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) { return static_cast(GetImpl())->GetFrequency(elapse); } -FWL_ERR IFWL_Caret::SetFrequency(uint32_t elapse) { +FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) { return static_cast(GetImpl())->SetFrequency(elapse); } -FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) { +FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { return static_cast(GetImpl())->SetColor(crFill); } @@ -49,20 +49,20 @@ CFWL_CaretImp::~CFWL_CaretImp() { delete m_pTimer; } -FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Caret; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_CaretImp::GetClassID() const { return FWL_CLASSHASH_Caret; } -FWL_ERR CFWL_CaretImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_CaretImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_CaretImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::Finalize() { +FWL_Error CFWL_CaretImp::Finalize() { if (m_hTimer) { FWL_StopTimer(m_hTimer); m_hTimer = NULL; @@ -71,16 +71,17 @@ FWL_ERR CFWL_CaretImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) { @@ -93,22 +94,23 @@ void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) { SetStates(FWL_WGTSTATE_Invisible, !bFlag); } -FWL_ERR CFWL_CaretImp::GetFrequency(uint32_t& elapse) { +FWL_Error CFWL_CaretImp::GetFrequency(uint32_t& elapse) { elapse = m_dwElapse; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::SetFrequency(uint32_t elapse) { +FWL_Error CFWL_CaretImp::SetFrequency(uint32_t elapse) { m_dwElapse = elapse; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::SetColor(CFX_Color crFill) { +FWL_Error CFWL_CaretImp::SetColor(CFX_Color crFill) { m_bSetColor = TRUE; m_crFill = crFill; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_BOOL CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix) { + +void CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix) { CFX_RectF rect; GetWidgetRect(rect); rect.Set(0, 0, rect.width, rect.height); @@ -116,19 +118,17 @@ FX_BOOL CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, param.m_pWidget = m_pInterface; param.m_pGraphics = pGraphics; param.m_rtPart = rect; - if (m_bSetColor) { + if (m_bSetColor) param.m_pData = &m_crFill; - } - if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) { - return FWL_ERR_Succeeded; - } + if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) + return; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = CFWL_PartState_HightLight; - if (pMatrix) { + if (pMatrix) param.m_matrix.Concat(*pMatrix); - } + pTheme->DrawBackground(¶m); - return FWL_ERR_Succeeded; } CFWL_CaretImp::CFWL_CaretTimer::CFWL_CaretTimer(CFWL_CaretImp* pCaret) @@ -146,12 +146,13 @@ int32_t CFWL_CaretImp::CFWL_CaretTimer::Run(FWL_HTIMER hTimer) { m_pCaret->Repaint(&rt); return 1; } + CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - return 1; -} -FWL_ERR CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {} + +void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h index 81d6e45449..c579beeed3 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.h +++ b/xfa/fwl/basewidget/fwl_caretimp.h @@ -21,24 +21,24 @@ class CFWL_CaretImp : public CFWL_WidgetImp { IFWL_Widget* pOuter); virtual ~CFWL_CaretImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); - 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 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); + virtual FWL_Error GetFrequency(uint32_t& elapse); + virtual FWL_Error SetFrequency(uint32_t elapse); + virtual FWL_Error SetColor(CFX_Color crFill); protected: - FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix); + void DrawCaretBK(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix); class CFWL_CaretTimer : public IFWL_Timer { public: explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret); @@ -57,9 +57,9 @@ class CFWL_CaretImp : public CFWL_WidgetImp { class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_CaretImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index ba63e2f663..a45c639450 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -37,7 +37,7 @@ IFWL_CheckBox::IFWL_CheckBox() {} int32_t IFWL_CheckBox::GetCheckState() { return static_cast(GetImpl())->GetCheckState(); } -FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) { +FWL_Error IFWL_CheckBox::SetCheckState(int32_t iCheck) { return static_cast(GetImpl())->SetCheckState(iCheck); } @@ -53,33 +53,33 @@ CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, m_rtFocus.Reset(); } CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} -FWL_ERR CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_CheckBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_CheckBoxImp::GetClassID() const { return FWL_CLASSHASH_CheckBox; } -FWL_ERR CFWL_CheckBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_CheckBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_CheckBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::Finalize() { +FWL_Error CFWL_CheckBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption); if (wsCaption.GetLength() > 0) { @@ -100,25 +100,25 @@ FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::Update() { +FWL_Error CFWL_CheckBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } UpdateTextOutStyles(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_CheckBoxImp::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; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, @@ -147,13 +147,13 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; { CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption); int32_t iLen = wsCaption.GetLength(); if (iLen <= 0) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; textParam.m_iPart = CFWL_Part::Caption; @@ -168,7 +168,7 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, textParam.m_iTTOAlign = m_iTTOAlign; pTheme->DrawText(&textParam); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_CheckBoxImp::GetCheckState() { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) && @@ -182,7 +182,7 @@ int32_t CFWL_CheckBoxImp::GetCheckState() { } return 0; } -FWL_ERR CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { +FWL_Error CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask; switch (iCheck) { case 0: { @@ -201,7 +201,7 @@ FWL_ERR CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { default: {} } Repaint(&m_rtClient); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_CheckBoxImp::Layout() { int32_t width = int32_t(m_pProperties->m_rtWidget.width + 0.5f); @@ -413,11 +413,10 @@ void CFWL_CheckBoxImp::NextStates() { CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { OnActivate(pMessage); @@ -462,18 +461,18 @@ int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; m_pOwner->Repaint(&(m_pOwner->m_rtClient)); diff --git a/xfa/fwl/basewidget/fwl_checkboximp.h b/xfa/fwl/basewidget/fwl_checkboximp.h index fe0ebb05cb..cc5474db9a 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.h +++ b/xfa/fwl/basewidget/fwl_checkboximp.h @@ -19,16 +19,16 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_CheckBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual int32_t GetCheckState(); - virtual FWL_ERR SetCheckState(int32_t iCheck); + virtual FWL_Error SetCheckState(int32_t iCheck); protected: void Layout(); @@ -47,9 +47,9 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 5b3e7c7c35..7368f7bbbd 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -37,22 +37,22 @@ IFWL_ComboBox::IFWL_ComboBox() {} int32_t IFWL_ComboBox::GetCurSel() { return static_cast(GetImpl())->GetCurSel(); } -FWL_ERR IFWL_ComboBox::SetCurSel(int32_t iSel) { +FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) { return static_cast(GetImpl())->SetCurSel(iSel); } -FWL_ERR IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { +FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { return static_cast(GetImpl())->SetEditText(wsText); } int32_t IFWL_ComboBox::GetEditTextLength() const { return static_cast(GetImpl())->GetEditTextLength(); } -FWL_ERR IFWL_ComboBox::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast(GetImpl()) ->GetEditText(wsText, nStart, nCount); } -FWL_ERR IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { return static_cast(GetImpl()) ->SetEditSelRange(nStart, nCount); } @@ -63,10 +63,10 @@ int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { int32_t IFWL_ComboBox::GetEditLimit() { return static_cast(GetImpl())->GetEditLimit(); } -FWL_ERR IFWL_ComboBox::SetEditLimit(int32_t nLimit) { +FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { return static_cast(GetImpl())->SetEditLimit(nLimit); } -FWL_ERR IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { +FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { return static_cast(GetImpl())->EditDoClipboard(iCmd); } FX_BOOL IFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { @@ -81,7 +81,7 @@ IFWL_ListBox* IFWL_ComboBox::GetListBoxt() { FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() { return static_cast(GetImpl())->AfterFocusShowDropList(); } -FX_ERR IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { return static_cast(GetImpl())->OpenDropDownList(bActivate); } FX_BOOL IFWL_ComboBox::EditCanUndo() { @@ -123,11 +123,11 @@ FX_BOOL IFWL_ComboBox::EditDelete() { FX_BOOL IFWL_ComboBox::EditDeSelect() { return static_cast(GetImpl())->EditDeSelect(); } -FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { +FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { return static_cast(GetImpl())->GetBBox(rect); } -FWL_ERR IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast(GetImpl()) ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -141,9 +141,9 @@ CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; FX_BOOL backDefault = TRUE; switch (pMessage->GetClassID()) { @@ -169,9 +169,8 @@ int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - if (!backDefault) - return 1; - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_EditImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboEditImp::ClearSelected() { @@ -202,14 +201,14 @@ CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { ASSERT(pOuter != NULL); } -FWL_ERR CFWL_ComboListImp::Initialize() { - if (CFWL_ListBoxImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ComboListImp::Initialize() { + if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; delete m_pDelegate; m_pDelegate = new CFWL_ComboListImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboListImp::Finalize() { +FWL_Error CFWL_ComboListImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_ListBoxImp::Finalize(); @@ -286,9 +285,9 @@ void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwHashCode = pMessage->GetClassID(); FX_BOOL backDefault = TRUE; @@ -305,7 +304,8 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { pMsg->m_fy -= rect.top; IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pVertScrollBar->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMsg); + pDelegate->OnProcessMessage(pMsg); + return; } } switch (pMsg->m_dwCmd) { @@ -330,9 +330,8 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } else if (dwHashCode == CFWL_MessageType::Key) { backDefault = !OnDropListKey(static_cast(pMessage)); } - if (!backDefault) - return 1; - return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, @@ -483,27 +482,31 @@ CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, m_rtBtn.Reset(); m_rtHandler.Reset(); } + CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} -FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { + +FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ComboBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + uint32_t CFWL_ComboBoxImp::GetClassID() const { return FWL_CLASSHASH_ComboBox; } -FWL_ERR CFWL_ComboBoxImp::Initialize() { - if (m_pWidgetMgr->IsFormDisabled()) { + +FWL_Error CFWL_ComboBoxImp::Initialize() { + if (m_pWidgetMgr->IsFormDisabled()) return DisForm_Initialize(); - } - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); CFWL_WidgetImpProperties prop; prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; - } + prop.m_pDataProvider = m_pProperties->m_pDataProvider; m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); m_pListBox->Initialize(); @@ -513,13 +516,14 @@ FWL_ERR CFWL_ComboBoxImp::Initialize() { m_pEdit->Initialize(); static_cast(m_pEdit->GetImpl())->SetOuter(m_pInterface); } - if (m_pEdit) { + if (m_pEdit) m_pEdit->SetParent(m_pInterface); - } + SetStates(m_pProperties->m_dwStates); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::Finalize() { + +FWL_Error CFWL_ComboBoxImp::Finalize() { if (m_pEdit) { m_pEdit->Finalize(); } @@ -528,7 +532,7 @@ FWL_ERR CFWL_ComboBoxImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Reset(); FX_BOOL bIsDropDown = IsDropDownStyle(); @@ -544,16 +548,16 @@ FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { FX_FLOAT* pFWidth = static_cast( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.Inflate(0, 0, *pFWidth, 0); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -570,12 +574,12 @@ FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, } return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_ERR CFWL_ComboBoxImp::Update() { +FWL_Error CFWL_ComboBoxImp::Update() { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_Update(); } if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } ReSetTheme(); FX_BOOL bDropDown = IsDropDownStyle(); @@ -591,7 +595,7 @@ FWL_ERR CFWL_ComboBoxImp::Update() { m_fComboFormHandler = *static_cast(m_pProperties->m_pThemeProvider->GetCapacity( &part, CFWL_WidgetCapacity::ComboFormHandler)); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pWidgetMgr->IsFormDisabled()) { @@ -599,15 +603,15 @@ FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return CFWL_WidgetImp::HitTest(fx, fy); } -FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_DrawWidget(pGraphics, 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 bIsDropDown = IsDropDownStyle(); if (HasBorder()) { @@ -648,7 +652,7 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); if (m_iCurSel >= 0) { if (!m_pListBox) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); @@ -683,11 +687,12 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = m_rtBtn; pTheme->DrawBackground(¶m); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_ComboBoxImp::SetThemeProvider( + IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_pProperties->m_pThemeProvider = pThemeProvider; if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { m_pListBox->SetThemeProvider(pThemeProvider); @@ -695,12 +700,12 @@ FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { m_pEdit->SetThemeProvider(pThemeProvider); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBoxImp::GetCurSel() { return m_iCurSel; } -FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { +FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { int32_t iCount = static_cast(m_pListBox->GetImpl())->CountItems(); FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; @@ -720,7 +725,7 @@ FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { m_pEdit->Update(); } m_iCurSel = bClearSel ? -1 : iSel; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -732,9 +737,9 @@ void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { +FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_pEdit->SetText(wsText); return m_pEdit->Update(); } @@ -743,9 +748,9 @@ int32_t CFWL_ComboBoxImp::GetEditTextLength() const { return -1; return m_pEdit->GetTextLength(); } -FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (m_pEdit) { return m_pEdit->GetText(wsText, nStart, nCount); } else if (m_pListBox) { @@ -754,14 +759,14 @@ FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); return m_pListBox->GetItemText(hItem, wsText); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } -FWL_ERR CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { +FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; static_cast(m_pEdit->GetImpl())->ClearSelected(); m_pEdit->AddSelRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) { if (!m_pEdit) @@ -773,14 +778,14 @@ int32_t CFWL_ComboBoxImp::GetEditLimit() { return -1; return m_pEdit->GetLimit(); } -FWL_ERR CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pEdit->SetLimit(nLimit); } -FWL_ERR CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { +FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pEdit->DoClipboard(iCmd); } FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) { @@ -807,9 +812,9 @@ FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() { m_bNeedShowList = FALSE; return TRUE; } -FX_ERR CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { ShowDropList(bActivate); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditCanUndo() { return m_pEdit->CanUndo(); @@ -845,15 +850,15 @@ FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } FX_BOOL CFWL_ComboBoxImp::EditSelectAll() { - return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; + return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditDelete() { - return m_pEdit->ClearText() == FWL_ERR_Succeeded; + return m_pEdit->ClearText() == FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditDeSelect() { - return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; + return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetBBox(rect); } @@ -864,14 +869,14 @@ FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { rtList.Offset(rect.left, rect.top); rect.Union(rtList); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (m_pEdit != NULL) { return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } else { - return FWL_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } } FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { @@ -1129,11 +1134,13 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { Repaint(&m_rtClient); } } + void CFWL_ComboBoxImp::InitProxyForm() { if (m_pForm) return; if (!m_pListBox) return; + CFWL_WidgetImpProperties propForm; propForm.m_pOwner = m_pInterface; propForm.m_dwStyles = FWL_WGTSTYLE_Popup; @@ -1146,18 +1153,21 @@ void CFWL_ComboBoxImp::InitProxyForm() { m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); m_pProxy->SetDelegate(m_pListProxyDelegate); } -FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_WGTSTATE_Invisible; // Ditto. + +FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); DisForm_InitComboList(); DisForm_InitComboEdit(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + void CFWL_ComboBoxImp::DisForm_InitComboList() { - if (m_pListBox) { + if (m_pListBox) return; - } + CFWL_WidgetImpProperties prop; prop.m_pParent = m_pInterface; prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; @@ -1227,8 +1237,8 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) { FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); } -FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (!m_pEdit) { DisForm_InitComboEdit(); } @@ -1243,16 +1253,16 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, } return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { +FWL_Error CFWL_ComboBoxImp::DisForm_Update() { if (m_iLock) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (m_pEdit) { ReSetEditAlignment(); } ReSetTheme(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rect; @@ -1269,8 +1279,8 @@ FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; CFX_Matrix mtOrg; mtOrg.Set(1, 0, 0, 1, 0, 0); @@ -1306,9 +1316,9 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, mt.Concat(mtOrg); m_pListBox->DrawWidget(pGraphics, &mt); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; if (m_pListBox && DisForm_IsDropListShowed()) { CFX_RectF rtList; @@ -1316,7 +1326,7 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { rtList.Offset(rect.left, rect.top); rect.Union(rtList); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ComboBoxImp::DisForm_Layout() { GetClientRect(m_rtClient); @@ -1361,14 +1371,14 @@ void CFWL_ComboBoxImp::DisForm_Layout() { CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) - return DisForm_OnProcessMessage(pMessage); - +void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + DisForm_OnProcessMessage(pMessage); + return; + } if (!pMessage) - return 0; + return; - FX_BOOL iRet = 1; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1407,16 +1417,14 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { CFWL_EventType dwFlag = pEvent->GetClassID(); if (dwFlag == CFWL_EventType::DrawItem) { CFWL_EvtLtbDrawItem* pDrawItemEvent = @@ -1444,13 +1452,13 @@ FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { pTemp.nChangeType = pTextChangedEvent->nChangeType; m_pOwner->DispatchEvent(&pTemp); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; @@ -1594,10 +1602,10 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { pDelegate->OnProcessMessage(pMsg); } } -int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( +void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; FX_BOOL backDefault = TRUE; switch (pMessage->GetClassID()) { @@ -1652,9 +1660,8 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( default: break; } - if (!backDefault) - return 1; - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { @@ -1750,9 +1757,9 @@ CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( m_pForm(pForm), m_pComboBox(pComboBox) {} -int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; switch (pMessage->GetClassID()) { case CFWL_MessageType::Mouse: { @@ -1790,14 +1797,14 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); - return FWL_ERR_Succeeded; } + void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { IFWL_App* pApp = m_pForm->GetOwnerApp(); if (!pApp) diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h index 202ba7cae2..6fa097a4c0 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.h +++ b/xfa/fwl/basewidget/fwl_comboboximp.h @@ -44,7 +44,7 @@ class CFWL_ComboEditImp : public CFWL_EditImp { class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_ComboEditImp* m_pOwner; @@ -53,8 +53,8 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { public: CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); int32_t MatchItem(const CFX_WideString& wsMatch); void ChangeSelected(int32_t iSel); int32_t CountItems(); @@ -68,7 +68,7 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { public: CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -84,36 +84,36 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_ComboBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - virtual FWL_ERR Update(); + 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_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual int32_t GetCurSel(); - virtual FWL_ERR SetCurSel(int32_t iSel); - virtual FWL_ERR SetEditText(const CFX_WideString& wsText); + virtual FWL_Error SetCurSel(int32_t iSel); + virtual FWL_Error SetEditText(const CFX_WideString& wsText); virtual int32_t GetEditTextLength() const; - virtual FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - virtual FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + virtual FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); virtual int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); virtual int32_t GetEditLimit(); - virtual FWL_ERR SetEditLimit(int32_t nLimit); - virtual FWL_ERR EditDoClipboard(int32_t iCmd); + virtual FWL_Error SetEditLimit(int32_t nLimit); + virtual FWL_Error EditDoClipboard(int32_t iCmd); virtual FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); virtual FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); virtual IFWL_ListBox* GetListBoxt(); virtual FX_BOOL AfterFocusShowDropList(); - virtual FX_ERR OpenDropDownList(FX_BOOL bActivate); + virtual FWL_Error OpenDropDownList(FX_BOOL bActivate); virtual FX_BOOL EditCanUndo(); virtual FX_BOOL EditCanRedo(); virtual FX_BOOL EditUndo(); @@ -127,9 +127,9 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { virtual FX_BOOL EditSelectAll(); virtual FX_BOOL EditDelete(); virtual FX_BOOL EditDeSelect(); - virtual FWL_ERR GetBBox(CFX_RectF& rect); - virtual FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error GetBBox(CFX_RectF& rect); + virtual FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); @@ -145,18 +145,18 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { void ReSetListItemAlignment(); void ProcessSelChanged(FX_BOOL bLButtonUp); void InitProxyForm(); - FWL_ERR DisForm_Initialize(); + FWL_Error DisForm_Initialize(); void DisForm_InitComboList(); void DisForm_InitComboEdit(); void DisForm_ShowDropList(FX_BOOL bActivate); FX_BOOL DisForm_IsDropListShowed(); - FWL_ERR DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); - FWL_ERR DisForm_Update(); + FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); + FWL_Error DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - FWL_ERR DisForm_GetBBox(CFX_RectF& rect); + FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + FWL_Error DisForm_GetBBox(CFX_RectF& rect); void DisForm_Layout(); CFX_RectF m_rtClient; @@ -188,10 +188,10 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -203,7 +203,7 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { void DoSubCtrlKey(CFWL_MsgKey* pMsg); protected: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); void DisForm_OnKey(CFWL_MsgKey* pMsg); @@ -216,9 +216,9 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; void Reset() { m_bLButtonUpSelf = FALSE; } protected: diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 7cefdc3477..e65b5bfb3d 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -83,24 +83,24 @@ int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { ->GetDataTimeEdit() ->GetSelRange(nIndex, nStart); } -FWL_ERR IFWL_DateTimePicker::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { return static_cast(GetImpl()) ->GetCurSel(iYear, iMonth, iDay); } -FWL_ERR IFWL_DateTimePicker::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { return static_cast(GetImpl()) ->SetCurSel(iYear, iMonth, iDay); } -FWL_ERR IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { +FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { return static_cast(GetImpl())->SetEditText(wsText); } -FWL_ERR IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast(GetImpl()) ->GetEditText(wsText, nStart, nCount); } @@ -143,27 +143,27 @@ FX_BOOL IFWL_DateTimePicker::Delete() { FX_BOOL IFWL_DateTimePicker::DeSelect() { return static_cast(GetImpl())->DeSelect(); } -FWL_ERR IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { +FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { return static_cast(GetImpl())->GetBBox(rect); } -FWL_ERR IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { +FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { return static_cast(GetImpl())->SetEditLimit(nLimit); } -FWL_ERR IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast(GetImpl()) ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_EditImp(properties, pOuter) {} -FWL_ERR CFWL_DateTimeEdit::Initialize() { +FWL_Error CFWL_DateTimeEdit::Initialize() { m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); - if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; + if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimeEdit::Finalize() { +FWL_Error CFWL_DateTimeEdit::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_EditImp::Finalize(); @@ -173,9 +173,11 @@ CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( CFWL_DateTimeEdit* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) - return DisForm_OnProcessMessage(pMessage); +void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + DisForm_OnProcessMessage(pMessage); + return; + } CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (dwHashCode == CFWL_MessageType::SetFocus || @@ -184,10 +186,9 @@ int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); pDelegate->OnProcessMessage(pMessage); } - return 1; } -int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( +void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { @@ -208,25 +209,23 @@ int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( pDateTime->Repaint(&rtInvalidate); } } - } else if (dwHashCode == CFWL_MessageType::Key) { - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); } } - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); + CFWL_EditImpDelegate::OnProcessMessage(pMessage); } CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_MonthCalendarImp(properties, pOuter) {} -FWL_ERR CFWL_DateTimeCalendar::Initialize() { - if (CFWL_MonthCalendarImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_DateTimeCalendar::Initialize() { + if (CFWL_MonthCalendarImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; delete m_pDelegate; m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimeCalendar::Finalize() { +FWL_Error CFWL_DateTimeCalendar::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_MonthCalendarImp::Finalize(); @@ -238,25 +237,25 @@ CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( m_bFlag = FALSE; } -int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( +void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { CFWL_MessageType dwCode = pMessage->GetClassID(); if (dwCode == CFWL_MessageType::SetFocus || dwCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); - } else if (dwCode == CFWL_MessageType::Mouse) { + pDelegate->OnProcessMessage(pMessage); + return; + } + if (dwCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast(pMessage); - if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { + if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) OnLButtonDownEx(pMsg); - return 1; - } else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { + else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) OnLButtonUpEx(pMsg); - return 1; - } + return; } - return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); + CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) { @@ -375,16 +374,16 @@ void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { } } -int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( +void CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (pMessage->GetClassID() == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast(pMessage); if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { DisForm_OnLButtonUpEx(pMsg); - return 1; + return; } } - return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); + CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( @@ -437,16 +436,16 @@ CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( m_rtBtn.Set(0, 0, 0, 0); } CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} -FWL_ERR CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_DateTimePicker; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_DateTimePickerImp::GetClassID() const { return FWL_CLASSHASH_DateTimePicker; } -FWL_ERR CFWL_DateTimePickerImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_DateTimePickerImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; CFWL_WidgetImpProperties propMonth; @@ -468,9 +467,9 @@ FWL_ERR CFWL_DateTimePickerImp::Initialize() { m_pEdit->Initialize(); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::Finalize() { +FWL_Error CFWL_DateTimePickerImp::Finalize() { if (m_pEdit) { m_pEdit->Finalize(); } @@ -485,8 +484,8 @@ FWL_ERR CFWL_DateTimePickerImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetWidgetRect(rect, bAutoSize); } @@ -496,14 +495,14 @@ FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::Update() { +FWL_Error CFWL_DateTimePickerImp::Update() { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_Update(); } if (m_iLock) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -513,7 +512,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { FX_FLOAT* pFWidth = static_cast( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; FX_FLOAT fBtn = *pFWidth; m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, m_rtClient.height - 1); @@ -539,7 +538,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pWidgetMgr->IsFormDisabled()) @@ -554,12 +553,12 @@ FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_DateTimePickerImp::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; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -573,53 +572,56 @@ FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_DrawWidget(pGraphics, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { +FWL_Error CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { m_pProperties->m_pThemeProvider = pTP; m_pMonthCal->SetThemeProvider(pTP); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +FWL_Error CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_iYear; iMonth = m_iMonth; iDay = m_iDay; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { if (iYear <= 0 || iYear >= 3000) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (iMonth <= 0 || iMonth >= 13) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (iDay <= 0 || iDay >= 32) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_iYear = iYear; m_iMonth = iMonth; m_iDay = iDay; m_pMonthCal->SetSelect(iYear, iMonth, iDay); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { + +FWL_Error CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_ERR_Indefinite; - int32_t iRet = m_pEdit->SetText(wsText); + return FWL_Error::Indefinite; + + FWL_Error iRet = m_pEdit->SetText(wsText); Repaint(&m_rtClient); CFWL_Event_DtpEditChanged ev; ev.m_wsText = wsText; DispatchEvent(&ev); return iRet; } -FWL_ERR CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { + +FWL_Error CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (m_pEdit) { return m_pEdit->GetText(wsText, nStart, nCount); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } FX_BOOL CFWL_DateTimePickerImp::CanUndo() { return m_pEdit->CanUndo(); @@ -657,15 +659,15 @@ FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } FX_BOOL CFWL_DateTimePickerImp::SelectAll() { - return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; + return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } FX_BOOL CFWL_DateTimePickerImp::Delete() { - return m_pEdit->ClearText() == FWL_ERR_Succeeded; + return m_pEdit->ClearText() == FWL_Error::Succeeded; } FX_BOOL CFWL_DateTimePickerImp::DeSelect() { - return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; + return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetBBox(rect); } @@ -677,13 +679,14 @@ FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { return m_pEdit->SetLimit(nLimit); } -FWL_ERR CFWL_DateTimePickerImp::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_DateTimePickerImp::ModifyEditStylesEx( + uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics, @@ -830,13 +833,13 @@ void CFWL_DateTimePickerImp::InitProxyForm() { IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() { return m_pEdit.get(); } -FWL_ERR CFWL_DateTimePickerImp::DisForm_Initialize() { +FWL_Error CFWL_DateTimePickerImp::DisForm_Initialize() { m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; DisForm_InitDateTimeCalendar(); DisForm_InitDateTimeEdit(); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() { if (m_pMonthCal) { @@ -932,21 +935,21 @@ FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { m_pEdit->GetStates() & FWL_WGTSTATE_Focused; return bFocus; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { - if (m_iLock) { - return FWL_ERR_Indefinite; - } - if (!m_pProperties->m_pThemeProvider) { + +FWL_Error CFWL_DateTimePickerImp::DisForm_Update() { + if (m_iLock) + return FWL_Error::Indefinite; + if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); - } + m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); GetClientRect(m_rtClient); m_pEdit->SetWidgetRect(m_rtClient); ReSetEditAlignment(); m_pEdit->Update(); - if (m_pMonthCal->GetThemeProvider() == NULL) { + if (!m_pMonthCal->GetThemeProvider()) m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); - } + if (m_pProperties->m_pDataProvider) { IFWL_DateTimePickerDP* pData = static_cast(m_pProperties->m_pDataProvider); @@ -956,7 +959,8 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { FX_FLOAT* pWidth = static_cast( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pWidth) - return 0; + return FWL_Error::Succeeded; + m_fBtn = *pWidth; CFX_RectF rtMonthCal; m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); @@ -965,17 +969,18 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { + +FWL_Error CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; @@ -987,12 +992,13 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_DateTimePickerImp::DisForm_DrawWidget( + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pEdit) { CFX_RectF rtEdit; m_pEdit->GetWidgetRect(rtEdit); @@ -1013,17 +1019,16 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, } m_pMonthCal->DrawWidget(pGraphics, &mt); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( CFWL_DateTimePickerImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( - CFWL_Message* pMessage) { +void CFWL_DateTimePickerImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { @@ -1061,7 +1066,8 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( case CFWL_MessageType::Key: { if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); + pDelegate->OnProcessMessage(pMessage); + return; } break; } @@ -1069,14 +1075,14 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( break; } - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_DateTimePickerImpDelegate::OnDrawWidget( - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_DateTimePickerImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (!pMsg) diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h index 7276928332..3fd86bed05 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h @@ -58,8 +58,8 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { public: CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: friend class CFWL_DateTimeEditImpDelegate; @@ -67,10 +67,10 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; private: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); protected: CFWL_DateTimeEdit* m_pOwner; @@ -79,8 +79,8 @@ class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { public: CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: friend class CFWL_DateTimeCalendarImpDelegate; @@ -88,14 +88,14 @@ class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { public: CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; void OnLButtonDownEx(CFWL_MsgMouse* pMsg); void OnLButtonUpEx(CFWL_MsgMouse* pMsg); void OnMouseMoveEx(CFWL_MsgMouse* pMsg); private: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); protected: @@ -107,22 +107,22 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_DateTimePickerImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + 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_ERR SetThemeProvider(IFWL_ThemeProvider* pTP); - virtual FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - virtual FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - virtual FWL_ERR SetEditText(const CFX_WideString& wsText); - virtual FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP); + virtual FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + virtual FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + virtual FWL_Error SetEditText(const CFX_WideString& wsText); + virtual FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; public: virtual FX_BOOL CanUndo(); @@ -138,10 +138,10 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { virtual FX_BOOL SelectAll(); virtual FX_BOOL Delete(); virtual FX_BOOL DeSelect(); - virtual FWL_ERR GetBBox(CFX_RectF& rect); - virtual FWL_ERR SetEditLimit(int32_t nLimit); - virtual FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error GetBBox(CFX_RectF& rect); + virtual FWL_Error SetEditLimit(int32_t nLimit); + virtual FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); public: IFWL_DateTimeEdit* GetDataTimeEdit(); @@ -161,18 +161,18 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); private: - FWL_ERR DisForm_Initialize(); + FWL_Error DisForm_Initialize(); void DisForm_InitDateTimeCalendar(); void DisForm_InitDateTimeEdit(); FX_BOOL DisForm_IsMonthCalendarShowed(); void DisForm_ShowMonthCalendar(FX_BOOL bActivate); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); FX_BOOL DisForm_IsNeedShowButton(); - FWL_ERR DisForm_Update(); - FWL_ERR DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - FWL_ERR DisForm_GetBBox(CFX_RectF& rect); - FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + FWL_Error DisForm_Update(); + FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error DisForm_GetBBox(CFX_RectF& rect); + FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: CFX_RectF m_rtBtn; @@ -193,9 +193,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { m_iCurMonth = 3; m_iCurDay = 29; } - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_ERR_Succeeded; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; } virtual int32_t GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; } virtual int32_t GetCurMonth(IFWL_Widget* pWidget) { return m_iCurMonth; } @@ -214,9 +214,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index bf4f911ea8..563519a475 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -74,18 +74,18 @@ IFWL_Edit* IFWL_Edit::CreateComboEdit( return pEdit; } IFWL_Edit::IFWL_Edit() {} -FWL_ERR IFWL_Edit::SetText(const CFX_WideString& wsText) { +FWL_Error IFWL_Edit::SetText(const CFX_WideString& wsText) { return static_cast(GetImpl())->SetText(wsText); } int32_t IFWL_Edit::GetTextLength() const { return static_cast(GetImpl())->GetTextLength(); } -FWL_ERR IFWL_Edit::GetText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_Edit::GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast(GetImpl())->GetText(wsText, nStart, nCount); } -FWL_ERR IFWL_Edit::ClearText() { +FWL_Error IFWL_Edit::ClearText() { return static_cast(GetImpl())->ClearText(); } int32_t IFWL_Edit::GetCaretPos() const { @@ -94,7 +94,7 @@ int32_t IFWL_Edit::GetCaretPos() const { int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { return static_cast(GetImpl())->SetCaretPos(nIndex, bBefore); } -FWL_ERR IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { return static_cast(GetImpl())->AddSelRange(nStart, nCount); } int32_t IFWL_Edit::CountSelRanges() { @@ -103,39 +103,39 @@ int32_t IFWL_Edit::CountSelRanges() { int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { return static_cast(GetImpl())->GetSelRange(nIndex, nStart); } -FWL_ERR IFWL_Edit::ClearSelections() { +FWL_Error IFWL_Edit::ClearSelections() { return static_cast(GetImpl())->ClearSelections(); } int32_t IFWL_Edit::GetLimit() { return static_cast(GetImpl())->GetLimit(); } -FWL_ERR IFWL_Edit::SetLimit(int32_t nLimit) { +FWL_Error IFWL_Edit::SetLimit(int32_t nLimit) { return static_cast(GetImpl())->SetLimit(nLimit); } -FWL_ERR IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { +FWL_Error IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { return static_cast(GetImpl())->SetAliasChar(wAlias); } -FWL_ERR IFWL_Edit::Insert(int32_t nStart, - const FX_WCHAR* lpText, - int32_t nLen) { +FWL_Error IFWL_Edit::Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen) { return static_cast(GetImpl())->Insert(nStart, lpText, nLen); } -FWL_ERR IFWL_Edit::DeleteSelections() { +FWL_Error IFWL_Edit::DeleteSelections() { return static_cast(GetImpl())->DeleteSelections(); } -FWL_ERR IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { return static_cast(GetImpl())->DeleteRange(nStart, nCount); } -FWL_ERR IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { +FWL_Error IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { return static_cast(GetImpl())->ReplaceSelections(wsReplace); } -FWL_ERR IFWL_Edit::Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace) { +FWL_Error IFWL_Edit::Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace) { return static_cast(GetImpl()) ->Replace(nStart, nLen, wsReplace); } -FWL_ERR IFWL_Edit::DoClipboard(int32_t iCmd) { +FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) { return static_cast(GetImpl())->DoClipboard(iCmd); } FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { @@ -168,20 +168,20 @@ FX_BOOL IFWL_Edit::CanUndo() { FX_BOOL IFWL_Edit::CanRedo() { return static_cast(GetImpl())->CanRedo(); } -FWL_ERR IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { return static_cast(GetImpl()) ->SetTabWidth(fTabWidth, bEquidistant); } -FWL_ERR IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { +FWL_Error IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { return static_cast(GetImpl())->SetOuter(pOuter); } -FWL_ERR IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { +FWL_Error IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { return static_cast(GetImpl())->SetNumberRange(iMin, iMax); } -FWL_ERR IFWL_Edit::SetBackColor(uint32_t dwColor) { +FWL_Error IFWL_Edit::SetBackColor(uint32_t dwColor) { return static_cast(GetImpl())->SetBackgroundColor(dwColor); } -FWL_ERR IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { +FWL_Error IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { return static_cast(GetImpl())->SetFont(wsFont, fSize); } void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { @@ -229,16 +229,16 @@ CFWL_EditImp::~CFWL_EditImp() { } ClearRecord(); } -FWL_ERR CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Edit; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_EditImp::GetClassID() const { return FWL_CLASSHASH_Edit; } -FWL_ERR CFWL_EditImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_EditImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; if (!m_pDelegate) { m_pDelegate = new CFWL_EditImpDelegate(this); } @@ -246,9 +246,9 @@ FWL_ERR CFWL_EditImp::Initialize() { if (!m_pEdtEngine) { InitEngine(); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Finalize() { +FWL_Error CFWL_EditImp::Finalize() { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { ShowCaret(FALSE); } @@ -262,7 +262,7 @@ FWL_ERR CFWL_EditImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pEdtEngine) { @@ -294,7 +294,7 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -305,25 +305,25 @@ void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) { return CFWL_WidgetImp::SetWidgetRect(rect); } -FWL_ERR CFWL_EditImp::Update() { +FWL_Error CFWL_EditImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); if (m_rtClient.IsEmpty()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } UpdateEditEngine(); UpdateVAlignment(); UpdateScroll(); InitCaret(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -492,14 +492,14 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, } pGraphics->RestoreGraphState(); } -FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_EditImp::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; if (m_rtClient.IsEmpty()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (!m_pWidgetMgr->IsFormDisabled()) { @@ -518,11 +518,11 @@ FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, if (HasEdge()) { DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pHorzScrollBar) { m_pHorzScrollBar->SetThemeProvider(pThemeProvider); } @@ -533,142 +533,173 @@ FWL_ERR CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pCaret->SetThemeProvider(pThemeProvider); } m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetText(const CFX_WideString& wsText) { + +FWL_Error CFWL_EditImp::SetText(const CFX_WideString& wsText) { m_pEdtEngine->SetText(wsText); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetTextLength() const { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetTextLength(); } -FWL_ERR CFWL_EditImp::GetText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { + +FWL_Error CFWL_EditImp::GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->GetText(wsText, nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::ClearText() { + +FWL_Error CFWL_EditImp::ClearText() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->ClearText(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetCaretPos() const { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetCaretPos(); } + int32_t CFWL_EditImp::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { if (!m_pEdtEngine) return -1; return m_pEdtEngine->SetCaretPos(nIndex, bBefore); } -FWL_ERR CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) { + +FWL_Error CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->AddSelRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::CountSelRanges() { if (!m_pEdtEngine) return 0; return m_pEdtEngine->CountSelRanges(); - return FWL_ERR_Succeeded; } + int32_t CFWL_EditImp::GetSelRange(int32_t nIndex, int32_t& nStart) { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetSelRange(nIndex, nStart); } -FWL_ERR CFWL_EditImp::ClearSelections() { + +FWL_Error CFWL_EditImp::ClearSelections() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->ClearSelection(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetLimit() { return m_nLimit; } -FWL_ERR CFWL_EditImp::SetLimit(int32_t nLimit) { + +FWL_Error CFWL_EditImp::SetLimit(int32_t nLimit) { m_nLimit = nLimit; if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->SetLimit(nLimit); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) { + +FWL_Error CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) { if (!m_pEdtEngine) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + m_pEdtEngine->SetAliasChar(wAlias); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Insert(int32_t nStart, - const FX_WCHAR* lpText, - int32_t nLen) { + +FWL_Error CFWL_EditImp::Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_pEdtEngine->Insert(nStart, lpText, nLen); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DeleteSelections() { + +FWL_Error CFWL_EditImp::DeleteSelections() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + int32_t iCount = m_pEdtEngine->CountSelRanges(); - if (iCount > 0) { + if (iCount > 0) m_pEdtEngine->Delete(-1); - } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { + +FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->DeleteRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { + +FWL_Error CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + int32_t iCount = m_pEdtEngine->CountSelRanges(); for (int i = 0; i < iCount; i++) { int32_t nStart; int32_t nCount = m_pEdtEngine->GetSelRange(i, nStart); m_pEdtEngine->Replace(nStart, nCount, wsReplace); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace) { + +FWL_Error CFWL_EditImp::Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->Replace(nStart, nLen, wsReplace); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) { + +FWL_Error CFWL_EditImp::DoClipboard(int32_t iCmd) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } + FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount == 0) { + if (nCount == 0) return FALSE; - } + wsCopy.clear(); CFX_WideString wsTemp; int32_t nStart, nLength; @@ -680,13 +711,15 @@ FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { } return TRUE; } + FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount == 0) { + if (nCount == 0) return FALSE; - } + wsCut.clear(); CFX_WideString wsTemp; int32_t nStart, nLength; @@ -699,9 +732,11 @@ FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { m_pEdtEngine->Delete(0); return TRUE; } + FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { if (!m_pEdtEngine) return FALSE; + int32_t nCaret = m_pEdtEngine->GetCaretPos(); int32_t iError = m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength()); @@ -711,79 +746,89 @@ FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { } return TRUE; } + FX_BOOL CFWL_EditImp::Delete() { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount < 1) { + if (nCount < 1) return FALSE; - } + m_pEdtEngine->Delete(0); return TRUE; } + FX_BOOL CFWL_EditImp::Redo(const CFX_ByteStringC& bsRecord) { if (!m_pEdtEngine) return FALSE; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) return TRUE; - } return m_pEdtEngine->Redo(bsRecord); } + FX_BOOL CFWL_EditImp::Undo(const CFX_ByteStringC& bsRecord) { if (!m_pEdtEngine) return FALSE; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) return TRUE; - } return m_pEdtEngine->Undo(bsRecord); } + FX_BOOL CFWL_EditImp::Undo() { - if (!CanUndo()) { + if (!CanUndo()) return FALSE; - } + CFX_ByteString bsRecord = m_RecordArr[m_iCurRecord--]; return Undo(bsRecord.AsStringC()); } + FX_BOOL CFWL_EditImp::Redo() { - if (!CanRedo()) { + if (!CanRedo()) return FALSE; - } + CFX_ByteString bsRecord = m_RecordArr[++m_iCurRecord]; return Redo(bsRecord.AsStringC()); } + FX_BOOL CFWL_EditImp::CanUndo() { return m_iCurRecord >= 0; } + FX_BOOL CFWL_EditImp::CanRedo() { return m_iCurRecord < m_RecordArr.GetSize() - 1; } -FWL_ERR CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { + +FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + FDE_TXTEDTPARAMS* pParams = m_pEdtEngine->GetEditParams(); pParams->fTabWidth = fTabWidth; pParams->bTabEquidistant = bEquidistant; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetOuter(IFWL_Widget* pOuter) { + +FWL_Error CFWL_EditImp::SetOuter(IFWL_Widget* pOuter) { m_pOuter = pOuter; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetNumberRange(int32_t iMin, int32_t iMax) { + +FWL_Error CFWL_EditImp::SetNumberRange(int32_t iMin, int32_t iMax) { m_iMin = iMin; m_iMax = iMax; m_bSetRange = TRUE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, FX_BOOL bVisible) { - if (m_rtEngine.IsEmpty()) { + if (m_rtEngine.IsEmpty()) return; - } - if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { + if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) return; - } + FX_BOOL bRepaintContent = UpdateOffset(); UpdateCaret(); CFX_RectF rtInvalid; @@ -803,12 +848,13 @@ void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, Repaint(&rtInvalid); } } + void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit, FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) { uint32_t dwStyleEx = m_pProperties->m_dwStyleExes; - if (dwStyleEx & FWL_STYLEEXT_EDT_VAlignMask) { + if (dwStyleEx & FWL_STYLEEXT_EDT_VAlignMask) UpdateVAlignment(); - } + IFDE_TxtEdtPage* page = m_pEdtEngine->GetPage(0); FX_FLOAT fContentWidth = page->GetContentsBox().width; FX_FLOAT fContentHeight = page->GetContentsBox().height; @@ -913,15 +959,15 @@ FX_BOOL CFWL_EditImp::On_Validate(CFDE_TxtEdtEngine* pEdit, DispatchEvent(&event); return event.bValidate; } -FWL_ERR CFWL_EditImp::SetBackgroundColor(uint32_t color) { +FWL_Error CFWL_EditImp::SetBackgroundColor(uint32_t color) { m_backColor = color; m_updateBackColor = TRUE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { +FWL_Error CFWL_EditImp::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { m_wsFont = wsFont; m_fFontSize = fSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_EditImp::SetScrollOffset(FX_FLOAT fScrollOffset) { m_fScrollOffsetY = fScrollOffset; @@ -1718,12 +1764,11 @@ void CFWL_EditImp::ProcessInsertError(int32_t iError) { CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::Activate: { DoActivate(static_cast(pMessage)); @@ -1775,19 +1820,17 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) - return FWL_ERR_Indefinite; + return; if (pEvent->GetClassID() != CFWL_EventType::Scroll) - return FWL_ERR_Succeeded; + return; IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && @@ -1798,13 +1841,13 @@ FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { OnScroll(static_cast(pSrcTarget), pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_EditImpDelegate::DoActivate(CFWL_MsgActivate* pMsg) { m_pOwner->m_pProperties->m_dwStates |= ~FWL_WGTSTATE_Deactivated; m_pOwner->Repaint(&m_pOwner->m_rtClient); diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h index 72f2ad03e4..96e56d0c33 100644 --- a/xfa/fwl/basewidget/fwl_editimp.h +++ b/xfa/fwl/basewidget/fwl_editimp.h @@ -30,42 +30,44 @@ class CFWL_EditImp : public CFWL_WidgetImp { ~CFWL_EditImp() override; // CFWL_WidgetImp: - FWL_ERR GetClassName(CFX_WideString& wsClass) const override; + FWL_Error GetClassName(CFX_WideString& wsClass) const override; uint32_t GetClassID() const override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; - FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; - FWL_ERR SetWidgetRect(const CFX_RectF& rect) override; - FWL_ERR Update() override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error SetWidgetRect(const CFX_RectF& rect) override; + FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) 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; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; + FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; - virtual FWL_ERR SetText(const CFX_WideString& wsText); + virtual FWL_Error SetText(const CFX_WideString& wsText); virtual int32_t GetTextLength() const; - virtual FWL_ERR GetText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - virtual FWL_ERR ClearText(); + virtual FWL_Error GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + virtual FWL_Error ClearText(); virtual int32_t GetCaretPos() const; virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); - virtual FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); virtual int32_t CountSelRanges(); virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - virtual FWL_ERR ClearSelections(); + virtual FWL_Error ClearSelections(); virtual int32_t GetLimit(); - virtual FWL_ERR SetLimit(int32_t nLimit); - virtual FWL_ERR SetAliasChar(FX_WCHAR wAlias); - virtual FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); - virtual FWL_ERR DeleteSelections(); - virtual FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); - virtual FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); - virtual FWL_ERR Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace); - virtual FWL_ERR DoClipboard(int32_t iCmd); + virtual FWL_Error SetLimit(int32_t nLimit); + virtual FWL_Error SetAliasChar(FX_WCHAR wAlias); + virtual FWL_Error Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen); + virtual FWL_Error DeleteSelections(); + virtual FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); + virtual FWL_Error Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace); + virtual FWL_Error DoClipboard(int32_t iCmd); virtual FX_BOOL Copy(CFX_WideString& wsCopy); virtual FX_BOOL Cut(CFX_WideString& wsCut); virtual FX_BOOL Paste(const CFX_WideString& wsPaste); @@ -76,11 +78,11 @@ class CFWL_EditImp : public CFWL_WidgetImp { virtual FX_BOOL Redo(); virtual FX_BOOL CanUndo(); virtual FX_BOOL CanRedo(); - virtual FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); - virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); - virtual FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); - virtual FWL_ERR SetBackgroundColor(uint32_t color); - virtual FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); + virtual FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + virtual FWL_Error SetOuter(IFWL_Widget* pOuter); + virtual FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); + virtual FWL_Error SetBackgroundColor(uint32_t color); + virtual FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, @@ -174,10 +176,10 @@ class CFWL_EditImp : public CFWL_WidgetImp { class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_EditImpDelegate(CFWL_EditImp* 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 DoActivate(CFWL_MsgActivate* pMsg); diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp index 0a5bb67aec..1e70da64ad 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp +++ b/xfa/fwl/basewidget/fwl_formproxyimp.cpp @@ -14,9 +14,9 @@ CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_FormImp(properties, pOuter) {} CFWL_FormProxyImp::~CFWL_FormProxyImp() {} -FWL_ERR CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_FormProxy; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_FormProxyImp::GetClassID() const { return FWL_CLASSHASH_FormProxy; @@ -27,27 +27,29 @@ FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { } return CFWL_FormImp::IsInstance(wsClass); } -FWL_ERR CFWL_FormProxyImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_FormProxyImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_FormProxyImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormProxyImp::Finalize() { +FWL_Error CFWL_FormProxyImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_FormProxyImp::Update() { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormProxyImp::Update() { + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + return FWL_Error::Succeeded; } + CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + +void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); + pDelegate->OnProcessMessage(pMessage); } diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.h b/xfa/fwl/basewidget/fwl_formproxyimp.h index 4e5e807507..1fbff200ba 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.h +++ b/xfa/fwl/basewidget/fwl_formproxyimp.h @@ -18,14 +18,14 @@ class CFWL_FormProxyImp : public CFWL_FormImp { CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_FormProxyImp(); - 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_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: friend class CFWL_FormProxyImpDelegate; @@ -33,7 +33,7 @@ class CFWL_FormProxyImp : public CFWL_FormImp { class CFWL_FormProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_FormProxyImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 3a0df152c2..e585a17d7d 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -52,18 +52,16 @@ FWL_HLISTITEM IFWL_ListBox::GetSelItem(int32_t nIndexSel) { int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) { return static_cast(GetImpl())->GetSelIndex(nIndex); } -FWL_ERR IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +FWL_Error IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { return static_cast(GetImpl())->SetSelItem(hItem, bSelect); } -FWL_ERR IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) { +FWL_Error IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { return static_cast(GetImpl())->GetItemText(hItem, wsText); } -FWL_ERR IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { +FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { return static_cast(GetImpl())->GetScrollPos(fPos, bVert); } -FWL_ERR* IFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) { - return static_cast(GetImpl())->Sort(pCom); -} CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) @@ -79,20 +77,20 @@ CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, m_rtStatic.Reset(); } CFWL_ListBoxImp::~CFWL_ListBoxImp() {} -FWL_ERR CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ListBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ListBoxImp::GetClassID() const { return FWL_CLASSHASH_ListBox; } -FWL_ERR CFWL_ListBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ListBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ListBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::Finalize() { +FWL_Error CFWL_ListBoxImp::Finalize() { if (m_pVertScrollBar) { m_pVertScrollBar->Finalize(); } @@ -103,7 +101,7 @@ FWL_ERR CFWL_ListBoxImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -115,11 +113,11 @@ FWL_ERR CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::Update() { +FWL_Error CFWL_ListBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -142,9 +140,8 @@ FWL_ERR CFWL_ListBoxImp::Update() { } m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; m_fScorllBarWidth = GetScrollWidth(); - SortItem(); CalcSize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (IsShowScrollBar(FALSE)) { @@ -163,12 +160,12 @@ FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Client; return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ListBoxImp::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; pGraphics->SaveGraphState(); if (HasBorder()) { @@ -193,17 +190,18 @@ FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, } DrawItems(pGraphics, pTheme, pMatrix); pGraphics->RestoreGraphState(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_ListBoxImp::SetThemeProvider( + IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!pThemeProvider->IsValidWidget(m_pInterface)) { m_pScrollBarTP = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ListBoxImp::CountSelItems() { if (!m_pProperties->m_pDataProvider) @@ -270,9 +268,9 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { } return -1; } -FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +FWL_Error CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!hItem) { if (bSelect) { SelectAll(); @@ -280,52 +278,37 @@ FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { ClearSelection(); SetFocusItem(NULL); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { SetSelectionDirect(hItem, bSelect); } else { SetSelection(hItem, hItem, bSelect); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, - CFX_WideString& wsText) { +FWL_Error CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ListBoxDP* pData = static_cast(m_pProperties->m_pDataProvider); if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pData->GetItemText(m_pInterface, hItem, wsText); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { + +FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { if ((bVert && IsShowScrollBar(TRUE)) || (!bVert && IsShowScrollBar(FALSE))) { IFWL_ScrollBar* pScrollBar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); fPos = pScrollBar->GetPos(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; -} -FWL_ERR* CFWL_ListBoxImp::Sort(IFWL_ListBoxCompare* pCom) { - FWL_HLISTITEM hTemp; - IFWL_ListBoxDP* pData = - static_cast(m_pProperties->m_pDataProvider); - int32_t sz = pData->CountItems(m_pInterface); - for (int32_t i = 0; i < sz - 1; i++) { - for (int32_t j = i + 1; j < sz; j++) { - if (pCom->Compare(pData->GetItem(m_pInterface, i), - pData->GetItem(m_pInterface, j)) > 0) { - hTemp = pData->GetItem(m_pInterface, i); - pData->SetItemIndex(m_pInterface, pData->GetItem(m_pInterface, j), i); - pData->SetItemIndex(m_pInterface, hTemp, j); - } - } - } - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; } + FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode) { FWL_HLISTITEM hRet = NULL; @@ -951,7 +934,7 @@ void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) { pScrollBar->Initialize(); (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); } -void CFWL_ListBoxImp::SortItem() {} + FX_BOOL CFWL_ListBoxImp::IsShowScrollBar(FX_BOOL bVert) { IFWL_ScrollBar* pScrollbar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); @@ -980,14 +963,13 @@ void CFWL_ListBoxImp::ProcessSelChanged() { CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!m_pOwner->IsEnabled()) - return 1; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1024,19 +1006,17 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) - return FWL_ERR_Indefinite; + return; if (pEvent->GetClassID() != CFWL_EventType::Scroll) - return FWL_ERR_Succeeded; + return; IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && @@ -1047,13 +1027,13 @@ FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { OnScroll(static_cast(pSrcTarget), pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (m_pOwner->GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { if (m_pOwner->m_pVertScrollBar) { diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h index 65fbf6a45a..0d938fe778 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.h +++ b/xfa/fwl/basewidget/fwl_listboximp.h @@ -25,23 +25,22 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_ListBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + 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_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual int32_t CountSelItems(); virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel); virtual int32_t GetSelIndex(int32_t nIndex); - virtual FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - virtual FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); - virtual FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); - virtual FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); + virtual FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); + virtual FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + virtual FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); protected: FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); @@ -82,7 +81,6 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FX_FLOAT GetScrollWidth(); FX_FLOAT GetItemHeigt(); void InitScrollBar(FX_BOOL bVert = TRUE); - void SortItem(); FX_BOOL IsShowScrollBar(FX_BOOL bVert); void ProcessSelChanged(); @@ -104,10 +102,10 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 3feb1122a7..2d495d1fd5 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -180,26 +180,26 @@ CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() { delete m_pDateTime; m_arrSelDays.RemoveAll(); } -FWL_ERR CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_MonthCalendar; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_MonthCalendarImp::GetClassID() const { return FWL_CLASSHASH_MonthCalendar; } -FWL_ERR CFWL_MonthCalendarImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_MonthCalendarImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::Finalize() { +FWL_Error CFWL_MonthCalendarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { CFX_SizeF fs = CalcSize(TRUE); rect.Set(0, 0, fs.x, fs.y); @@ -207,11 +207,11 @@ FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::Update() { +FWL_Error CFWL_MonthCalendarImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -223,12 +223,12 @@ FWL_ERR CFWL_MonthCalendarImp::Update() { ClearDateItem(); ReSetDateItem(); LayOut(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pProperties->m_pThemeProvider == NULL) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } @@ -255,7 +255,7 @@ FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, DrawWeekNumberSep(pGraphics, pTheme, pMatrix); DrawWeekNumber(pGraphics, pTheme, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_MonthCalendarImp::CountSelect() { return m_arrSelDays.GetSize(); @@ -1017,13 +1017,11 @@ CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( CFWL_MonthCalendarImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( - CFWL_Message* pMessage) { +void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1061,17 +1059,15 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index a7deb9a098..d1096b40ce 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -24,14 +24,14 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_MonthCalendarImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual int32_t CountSelect(); virtual FX_BOOL GetSelect(int32_t& iYear, int32_t& iMonth, @@ -229,9 +229,9 @@ struct FWL_DATEINFO { class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp index 4495a495ba..c2cd09d342 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp +++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp @@ -35,29 +35,30 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp( m_matrix.SetIdentity(); } CFWL_PictureBoxImp::~CFWL_PictureBoxImp() {} -FWL_ERR CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PictureBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_PictureBoxImp::GetClassID() const { return FWL_CLASSHASH_PictureBox; } -FWL_ERR CFWL_PictureBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_PictureBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_PictureBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::Finalize() { +FWL_Error CFWL_PictureBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_DIBitmap* pBitmap = static_cast(m_pProperties->m_pDataProvider) ->GetPicture(m_pInterface); @@ -69,24 +70,24 @@ FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::Update() { +FWL_Error CFWL_PictureBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } GetClientRect(m_rtClient); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_PictureBoxImp::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 = GetAvailableTheme(); if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -95,7 +96,7 @@ FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawBkground(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -141,10 +142,12 @@ FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) { } return FALSE; } + CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate( CFWL_PictureBoxImp* pOwner) : m_pOwner(pOwner) {} -FWL_ERR CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.h b/xfa/fwl/basewidget/fwl_pictureboximp.h index f2e67124f6..d6f0ccc935 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.h +++ b/xfa/fwl/basewidget/fwl_pictureboximp.h @@ -18,14 +18,14 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { CFWL_PictureBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_PictureBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -40,11 +40,12 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { FX_BOOL m_bButton; friend class CFWL_PictureBoxImpDelegate; }; + class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PictureBoxImpDelegate(CFWL_PictureBoxImp* pOwner); - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_PictureBoxImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 6fab925c91..3b18ad0fa0 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -39,25 +39,26 @@ CFWL_PushButtonImp::CFWL_PushButtonImp( m_rtCaption.Set(0, 0, 0, 0); } CFWL_PushButtonImp::~CFWL_PushButtonImp() {} -FWL_ERR CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PushButton; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_PushButtonImp::GetClassID() const { return FWL_CLASSHASH_PushButton; } -FWL_ERR CFWL_PushButtonImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_PushButtonImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_PushButtonImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButtonImp::Finalize() { +FWL_Error CFWL_PushButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pProperties->m_pThemeProvider == NULL) { @@ -81,7 +82,7 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -92,9 +93,9 @@ void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_PushButtonImp::Update() { +FWL_Error CFWL_PushButtonImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -105,14 +106,14 @@ FWL_ERR CFWL_PushButtonImp::Update() { FX_FLOAT* fcaption = static_cast(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); m_rtCaption.Inflate(-*fcaption, -*fcaption); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_PushButtonImp::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_PushButtonDP* pData = static_cast(m_pProperties->m_pDataProvider); CFX_DIBitmap* pPicture = NULL; @@ -293,7 +294,7 @@ FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); break; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -404,13 +405,12 @@ CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( CFWL_PushButtonImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!m_pOwner->IsEnabled()) - return 1; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { @@ -452,21 +452,19 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (bSet) { diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/basewidget/fwl_pushbuttonimp.h index 50a984f5c1..89913be6c1 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.h @@ -19,15 +19,15 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_PushButtonImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); 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); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -49,10 +49,10 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 0db7c29e9d..b03846da91 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -31,34 +31,34 @@ IFWL_ScrollBar::IFWL_ScrollBar() {} FX_BOOL IFWL_ScrollBar::IsVertical() { return static_cast(GetImpl())->IsVertical(); } -FWL_ERR IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { +FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { return static_cast(GetImpl())->GetRange(fMin, fMax); } -FWL_ERR IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { +FWL_Error IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { return static_cast(GetImpl())->SetRange(fMin, fMax); } FX_FLOAT IFWL_ScrollBar::GetPageSize() { return static_cast(GetImpl())->GetPageSize(); } -FWL_ERR IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { +FWL_Error IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { return static_cast(GetImpl())->SetPageSize(fPageSize); } FX_FLOAT IFWL_ScrollBar::GetStepSize() { return static_cast(GetImpl())->GetStepSize(); } -FWL_ERR IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { +FWL_Error IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { return static_cast(GetImpl())->SetStepSize(fStepSize); } FX_FLOAT IFWL_ScrollBar::GetPos() { return static_cast(GetImpl())->GetPos(); } -FWL_ERR IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { +FWL_Error IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { return static_cast(GetImpl())->SetPos(fPos); } FX_FLOAT IFWL_ScrollBar::GetTrackPos() { return static_cast(GetImpl())->GetTrackPos(); } -FWL_ERR IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { +FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { return static_cast(GetImpl())->SetTrackPos(fTrackPos); } FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { @@ -99,31 +99,31 @@ CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, m_rtMaxTrack.Reset(); } CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {} -FWL_ERR CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ScrollBar; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ScrollBarImp::GetClassID() const { return FWL_CLASSHASH_ScrollBar; } -FWL_ERR CFWL_ScrollBarImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ScrollBarImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ScrollBarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::Finalize() { +FWL_Error CFWL_ScrollBarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); FX_FLOAT* pfMinWidth = static_cast( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfMinWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (IsVertical()) { rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); } else { @@ -133,24 +133,24 @@ FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::Update() { +FWL_Error CFWL_ScrollBarImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ScrollBarImp::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; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -163,51 +163,51 @@ FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, DrawArrowBtn(pGraphics, pTheme, TRUE, pMatrix); DrawArrowBtn(pGraphics, pTheme, FALSE, pMatrix); DrawThumb(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } inline FX_BOOL CFWL_ScrollBarImp::IsVertical() { return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert; } -FWL_ERR CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { +FWL_Error CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { fMin = m_fRangeMin; fMax = m_fRangeMax; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { +FWL_Error CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { m_fRangeMin = fMin; m_fRangeMax = fMax; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetPageSize() { return m_fPageSize; } -FWL_ERR CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) { +FWL_Error CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) { m_fPageSize = fPageSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetStepSize() { return m_fStepSize; } -FWL_ERR CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) { +FWL_Error CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) { m_fStepSize = fStepSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetPos() { return m_fPos; } -FWL_ERR CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) { +FWL_Error CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) { m_fPos = fPos; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetTrackPos() { return m_fTrackPos; } -FWL_ERR CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) { +FWL_Error CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) { m_fTrackPos = fTrackPos; CalcThumbButtonRect(m_rtThumb); CalcMinTrackRect(m_rtMinTrack); CalcMaxTrackRect(m_rtMaxTrack); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { switch (dwCode) { @@ -236,9 +236,9 @@ int32_t CFWL_ScrollBarImp::Run(FWL_HTIMER hTimer) { } return 1; } -FWL_ERR CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) { +FWL_Error CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) { m_pOuter = pOuter; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -628,11 +628,10 @@ FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); if (dwMsgCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast(pMessage); @@ -654,7 +653,6 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } @@ -662,16 +660,14 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MsgMouseWheel* pMsg = static_cast(pMessage); OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, pMsg->m_fDeltaY); - } else { - iRet = 0; } - return iRet; } -FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/basewidget/fwl_scrollbarimp.h index 08f7c69bf7..6cee702f5c 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.h +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.h @@ -19,27 +19,27 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_ScrollBarImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual FX_BOOL IsVertical(); - virtual FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - virtual FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + virtual FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + virtual FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); virtual FX_FLOAT GetPageSize(); - virtual FWL_ERR SetPageSize(FX_FLOAT fPageSize); + virtual FWL_Error SetPageSize(FX_FLOAT fPageSize); virtual FX_FLOAT GetStepSize(); - virtual FWL_ERR SetStepSize(FX_FLOAT fStepSize); + virtual FWL_Error SetStepSize(FX_FLOAT fStepSize); virtual FX_FLOAT GetPos(); - virtual FWL_ERR SetPos(FX_FLOAT fPos); + virtual FWL_Error SetPos(FX_FLOAT fPos); virtual FX_FLOAT GetTrackPos(); - virtual FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); + virtual FWL_Error SetTrackPos(FX_FLOAT fTrackPos); virtual FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); - virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); + virtual FWL_Error SetOuter(IFWL_Widget* pOuter); virtual int32_t Run(FWL_HTIMER hTimer); protected: @@ -101,9 +101,9 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 9a70d7187d..27b84bae92 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -36,7 +36,7 @@ IFWL_SpinButton* IFWL_SpinButton::Create( return pSpinButton; } IFWL_SpinButton::IFWL_SpinButton() {} -FWL_ERR IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { +FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { return static_cast(GetImpl()) ->EnableButton(bEnable, bUp); } @@ -59,36 +59,37 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp( m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; } CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {} -FWL_ERR CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_SpinButton; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_SpinButtonImp::GetClassID() const { return FWL_CLASSHASH_SpinButton; } -FWL_ERR CFWL_SpinButtonImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_SpinButtonImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_SpinButtonImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_SpinButtonImp::Finalize() { +FWL_Error CFWL_SpinButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, kMinWidth, kMinHeight); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_SpinButtonImp::Update() { +FWL_Error CFWL_SpinButtonImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } GetClientRect(m_rtClient); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) { @@ -102,7 +103,7 @@ FWL_ERR CFWL_SpinButtonImp::Update() { m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, m_rtClient.width / 2, m_rtClient.height); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_rtClient.Contains(fx, fy)) @@ -121,10 +122,10 @@ FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::DownButton; return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_RectF rtClip(m_rtClient); if (pMatrix != NULL) { pMatrix->TransformRect(rtClip); @@ -138,7 +139,7 @@ FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, } DrawUpButton(pGraphics, pTheme, pMatrix); DrawDownButton(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { if (m_hTimer) { @@ -149,7 +150,7 @@ int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { } return 1; } -FWL_ERR CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { +FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { if (bUp) { if (bEnable) { m_dwUpState = CFWL_PartState_Normal; @@ -163,7 +164,7 @@ FWL_ERR CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { m_dwDnState = CFWL_PartState_Disabled; } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_SpinButtonImp::IsButtonEnable(FX_BOOL bUp) { if (bUp) { @@ -204,11 +205,10 @@ CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( CFWL_SpinButtonImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { @@ -250,21 +250,19 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (bSet) { diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h index 3f9dc77c4e..aa963c9da4 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h @@ -20,17 +20,17 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_SpinButtonImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + 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 int32_t Run(FWL_HTIMER hTimer); - FWL_ERR EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); + FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); protected: @@ -53,10 +53,10 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp index 0a8d343cef..f1878edee8 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp @@ -27,16 +27,21 @@ IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties, pToolTipImpl->SetInterface(pToolTip); return pToolTip; } -FWL_ERR IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { - return static_cast(GetImpl())->SetAnchor(rtAnchor); + +void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { + static_cast(GetImpl())->SetAnchor(rtAnchor); } -FWL_ERR IFWL_ToolTip::Show() { - return static_cast(GetImpl())->Show(); + +void IFWL_ToolTip::Show() { + static_cast(GetImpl())->Show(); } -FWL_ERR IFWL_ToolTip::Hide() { - return static_cast(GetImpl())->Hide(); + +void IFWL_ToolTip::Hide() { + static_cast(GetImpl())->Hide(); } + IFWL_ToolTip::IFWL_ToolTip() {} + CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_FormImp(properties, pOuter), @@ -58,27 +63,27 @@ CFWL_ToolTipImp::~CFWL_ToolTipImp() { m_pTimer = NULL; } } -FWL_ERR CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ToolTip; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ToolTipImp::GetClassID() const { return FWL_CLASSHASH_ToolTip; } -FWL_ERR CFWL_ToolTipImp::Initialize() { +FWL_Error CFWL_ToolTipImp::Initialize() { m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ToolTipImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::Finalize() { +FWL_Error CFWL_ToolTipImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pProperties->m_pThemeProvider == NULL) { @@ -101,11 +106,11 @@ FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::Update() { +FWL_Error CFWL_ToolTipImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -113,9 +118,9 @@ FWL_ERR CFWL_ToolTipImp::Update() { UpdateTextOutStyles(); GetClientRect(m_rtClient); m_rtCaption = m_rtClient; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { FX_FLOAT x = 0; FX_FLOAT y = 0; FX_FLOAT t = 0; @@ -131,23 +136,23 @@ FWL_ERR CFWL_ToolTipImp::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; } -FWL_ERR CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { IFWL_ToolTipTarget* toolTipTarget = CFWL_ToolTipContainer::getInstance()->GetCurrentToolTipTarget(); if (toolTipTarget && !toolTipTarget->UseDefaultTheme()) { return toolTipTarget->DrawToolTip(pGraphics, pMatrix, m_pInterface); } 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; DrawBkground(pGraphics, pTheme, pMatrix); DrawText(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -200,30 +205,29 @@ void CFWL_ToolTipImp::UpdateTextOutStyles() { m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine; } } -FWL_ERR CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { + +void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { m_rtAnchor = rtAnchor; - return TRUE; } -FWL_ERR CFWL_ToolTipImp::Show() { + +void CFWL_ToolTipImp::Show() { IFWL_ToolTipDP* pData = static_cast(m_pProperties->m_pDataProvider); int32_t nInitDelay = pData->GetInitialDelay(m_pInterface); - if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) { + if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE); - } - return TRUE; } -FWL_ERR CFWL_ToolTipImp::Hide() { + +void CFWL_ToolTipImp::Hide() { SetStates(FWL_WGTSTATE_Invisible, TRUE); if (m_hTimerHide) { FWL_StopTimer(m_hTimerHide); - m_hTimerHide = NULL; + m_hTimerHide = nullptr; } if (m_hTimerShow) { FWL_StopTimer(m_hTimerShow); - m_hTimerShow = NULL; + m_hTimerShow = nullptr; } - return TRUE; } void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -284,15 +288,17 @@ int32_t CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(FWL_HTIMER hTimer) { } return TRUE; } + CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); -} -FWL_ERR CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; + +void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h index 0c053869ed..16ff424c7c 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h @@ -20,19 +20,19 @@ class CFWL_ToolTipImp : public CFWL_FormImp { CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_ToolTipImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); 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(); - FWL_ERR Hide(); + virtual FWL_Error GetClientRect(CFX_RectF& rect); + void SetAnchor(const CFX_RectF& rtAnchor); + void Show(); + void Hide(); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -68,10 +68,10 @@ class CFWL_ToolTipImp : public CFWL_FormImp { class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* 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 OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h index 9d0c8a70f9..c7481bdb3c 100644 --- a/xfa/fwl/basewidget/ifwl_caret.h +++ b/xfa/fwl/basewidget/ifwl_caret.h @@ -20,9 +20,9 @@ class IFWL_Caret : public IFWL_Widget { IFWL_Widget* pOuter); void ShowCaret(FX_BOOL bFlag = TRUE); - FWL_ERR GetFrequency(uint32_t& elapse); - FWL_ERR SetFrequency(uint32_t elapse); - FWL_ERR SetColor(CFX_Color crFill); + FWL_Error GetFrequency(uint32_t& elapse); + FWL_Error SetFrequency(uint32_t elapse); + FWL_Error SetColor(CFX_Color crFill); protected: IFWL_Caret(); diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 0f4b42c2c8..83c0dd4724 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -59,7 +59,7 @@ class IFWL_CheckBox : public IFWL_Widget { static IFWL_CheckBox* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); int32_t GetCheckState(); - FWL_ERR SetCheckState(int32_t iCheck); + FWL_Error SetCheckState(int32_t iCheck); protected: IFWL_CheckBox(); diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index b76724811b..92e213f9d0 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -80,22 +80,22 @@ class IFWL_ComboBox : public IFWL_Widget { static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties); int32_t GetCurSel(); - FWL_ERR SetCurSel(int32_t iSel); - FWL_ERR SetEditText(const CFX_WideString& wsText); + FWL_Error SetCurSel(int32_t iSel); + FWL_Error SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; - FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); + FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); int32_t GetEditLimit(); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR EditDoClipboard(int32_t iCmd); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error EditDoClipboard(int32_t iCmd); FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); IFWL_ListBox* GetListBoxt(); FX_BOOL AfterFocusShowDropList(); - FX_ERR OpenDropDownList(FX_BOOL bActivate); + FWL_Error OpenDropDownList(FX_BOOL bActivate); FX_BOOL EditCanUndo(); FX_BOOL EditCanRedo(); FX_BOOL EditUndo(); @@ -109,9 +109,9 @@ class IFWL_ComboBox : public IFWL_Widget { FX_BOOL EditSelectAll(); FX_BOOL EditDelete(); FX_BOOL EditDeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: IFWL_ComboBox(); diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index 3d1188eead..446f988fd3 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -53,10 +53,10 @@ END_FWL_EVENT_DEF class IFWL_DateTimePickerDP : public IFWL_DataProvider { public: - virtual FWL_ERR GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) = 0; + virtual FWL_Error GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) = 0; }; class IFWL_DateTimePicker : public IFWL_Widget { @@ -64,12 +64,12 @@ class IFWL_DateTimePicker : public IFWL_Widget { static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - FWL_ERR SetEditText(const CFX_WideString& wsText); - FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; + FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + FWL_Error SetEditText(const CFX_WideString& wsText); + FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); FX_BOOL CanUndo(); @@ -85,10 +85,10 @@ class IFWL_DateTimePicker : public IFWL_Widget { FX_BOOL SelectAll(); FX_BOOL Delete(); FX_BOOL DeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: IFWL_DateTimePicker(); diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index 3b25eaf548..87f55d7d1e 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -102,30 +102,30 @@ class IFWL_Edit : public IFWL_Widget { static IFWL_Edit* CreateComboEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR SetText(const CFX_WideString& wsText); + FWL_Error SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; - FWL_ERR GetText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR ClearText(); + FWL_Error GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error ClearText(); int32_t GetCaretPos() const; int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); - FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); + FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FWL_ERR ClearSelections(); + FWL_Error ClearSelections(); int32_t GetLimit(); - FWL_ERR SetLimit(int32_t nLimit); - FWL_ERR SetAliasChar(FX_WCHAR wAlias); - FWL_ERR SetFormatString(const CFX_WideString& wsFormat); - FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); - FWL_ERR DeleteSelections(); - FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); - FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); - FWL_ERR Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace); - FWL_ERR DoClipboard(int32_t iCmd); + FWL_Error SetLimit(int32_t nLimit); + FWL_Error SetAliasChar(FX_WCHAR wAlias); + FWL_Error SetFormatString(const CFX_WideString& wsFormat); + FWL_Error Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); + FWL_Error DeleteSelections(); + FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); + FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); + FWL_Error Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace); + FWL_Error DoClipboard(int32_t iCmd); FX_BOOL Copy(CFX_WideString& wsCopy); FX_BOOL Cut(CFX_WideString& wsCut); FX_BOOL Paste(const CFX_WideString& wsPaste); @@ -136,11 +136,11 @@ class IFWL_Edit : public IFWL_Widget { FX_BOOL Redo(); FX_BOOL CanUndo(); FX_BOOL CanRedo(); - FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); - FWL_ERR SetOuter(IFWL_Widget* pOuter); - FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); - FWL_ERR SetBackColor(uint32_t dwColor); - FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); + FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + FWL_Error SetOuter(IFWL_Widget* pOuter); + FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); + FWL_Error SetBackColor(uint32_t dwColor); + FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); void SetScrollOffset(FX_FLOAT fScrollOffset); FX_BOOL GetSuggestWords(CFX_PointF pointf, std::vector& sSuggest); diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index d32b020810..8b1e20b28f 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -15,7 +15,6 @@ #define FWL_CLASS_ListBox L"FWL_LISTBOX" #define FWL_CLASSHASH_ListBox 1777358317 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) -#define FWL_STYLEEXT_LTB_Sort (1L << 1) #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) @@ -55,36 +54,36 @@ class IFWL_ListBoxDP : public IFWL_DataProvider { FWL_HLISTITEM hItem, int32_t nIndex) = 0; virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText) = 0; - virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem) = 0; + virtual FWL_Error GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText) = 0; + virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem) = 0; virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget, + virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle) = 0; + virtual FWL_Error SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText) = 0; + virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, FWL_HLISTITEM hItem, - uint32_t dwStyle) = 0; - virtual FWL_ERR SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText) = 0; - virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem) = 0; + const CFX_RectF& rtItem) = 0; virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck) = 0; - virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtCheck) = 0; + virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck) = 0; + virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtCheck) = 0; virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwCheckState) = 0; + virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwCheckState) = 0; }; class IFWL_ListBoxCompare { @@ -104,10 +103,9 @@ class IFWL_ListBox : public IFWL_Widget { int32_t CountSelItems(); FWL_HLISTITEM GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); - FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); - FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); + FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); + FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); protected: IFWL_ListBox(); diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/basewidget/ifwl_picturebox.h index e663f23432..d039a8a1b2 100644 --- a/xfa/fwl/basewidget/ifwl_picturebox.h +++ b/xfa/fwl/basewidget/ifwl_picturebox.h @@ -39,7 +39,7 @@ class IFWL_PictureBoxDP : public IFWL_DataProvider { virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) = 0; virtual int32_t GetOpacity(IFWL_Widget* pWidget) = 0; virtual int32_t GetFlipMode(IFWL_Widget* pWidget) = 0; - virtual FWL_ERR GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; + virtual FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; }; class IFWL_PictureBox : public IFWL_Widget { diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h index e199713686..176b997a3d 100644 --- a/xfa/fwl/basewidget/ifwl_scrollbar.h +++ b/xfa/fwl/basewidget/ifwl_scrollbar.h @@ -40,16 +40,16 @@ class IFWL_ScrollBar : public IFWL_Widget { IFWL_Widget* pOuter); FX_BOOL IsVertical(); - FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); FX_FLOAT GetPageSize(); - FWL_ERR SetPageSize(FX_FLOAT fPageSize); + FWL_Error SetPageSize(FX_FLOAT fPageSize); FX_FLOAT GetStepSize(); - FWL_ERR SetStepSize(FX_FLOAT fStepSize); + FWL_Error SetStepSize(FX_FLOAT fStepSize); FX_FLOAT GetPos(); - FWL_ERR SetPos(FX_FLOAT fPos); + FWL_Error SetPos(FX_FLOAT fPos); FX_FLOAT GetTrackPos(); - FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); + FWL_Error SetTrackPos(FX_FLOAT fTrackPos); FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); protected: diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 2894d08197..5f032d9e7e 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -22,7 +22,7 @@ class IFWL_SpinButton : public IFWL_Widget { static IFWL_SpinButton* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); + FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); protected: diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h index b9a07613a8..1a4280fccf 100644 --- a/xfa/fwl/basewidget/ifwl_tooltip.h +++ b/xfa/fwl/basewidget/ifwl_tooltip.h @@ -22,8 +22,8 @@ class IFWL_ToolTip; class IFWL_ToolTipDP : public IFWL_DataProvider { public: - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) = 0; virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; @@ -35,9 +35,9 @@ class IFWL_ToolTip : public IFWL_Form { static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); - FWL_ERR Show(); - FWL_ERR Hide(); + void SetAnchor(const CFX_RectF& rtAnchor); + void Show(); + void Hide(); protected: IFWL_ToolTip(); -- cgit v1.2.3