diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-10 09:40:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-10 09:40:14 -0800 |
commit | 98329fe75b9c3e5422344a37d787fb22c89c2ca2 (patch) | |
tree | a1e7f3d35bc97695b074756ab7ef531c17c6262d /xfa/fwl | |
parent | 50feafc7f367a87b7e4e689421eb7ae1484660d9 (diff) | |
download | pdfium-98329fe75b9c3e5422344a37d787fb22c89c2ca2.tar.xz |
Cleanup IFWL_Widget visibility and virtual parameters
This Cl cleans up the IFWL_Widget class including:
* Making members and methods private where possible
* Removing virtual methods that are never overridden
* Removing methods that do nothing
* Removing unchecked FWL_Error return codes
Review-Url: https://codereview.chromium.org/2488953003
Diffstat (limited to 'xfa/fwl')
39 files changed, 433 insertions, 637 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 9b2cf7fe41..825d66382e 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -91,9 +91,9 @@ FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { : FWL_Error::Indefinite; } -FWL_Error CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { - return GetWidget() ? ToComboBox(GetWidget())->SetEditText(wsText) - : FWL_Error::Indefinite; +void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { + if (GetWidget()) + ToComboBox(GetWidget())->SetEditText(wsText); } int32_t CFWL_ComboBox::GetEditTextLength() const { @@ -160,8 +160,8 @@ void* CFWL_ComboBox::GetItemData(int32_t iIndex) { return pItem ? pItem->m_pData : nullptr; } -FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { - return ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); +void CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { + ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); } bool CFWL_ComboBox::AfterFocusShowDropList() { @@ -229,12 +229,12 @@ FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { : FWL_Error::Indefinite; } -FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { - return GetWidget() - ? ToComboBox(GetWidget()) - ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved) - : FWL_Error::Indefinite; +void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { + if (GetWidget()) { + ToComboBox(GetWidget()) + ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); + } } FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 4b544b4530..e2d35d24b5 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -28,7 +28,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { FWL_Error GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); int32_t GetCurSel(); FWL_Error SetCurSel(int32_t iSel); - FWL_Error SetEditText(const CFX_WideString& wsText); + void SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; FWL_Error GetEditText(CFX_WideString& wsText, int32_t nStart = 0, @@ -43,7 +43,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight); FWL_Error SetItemData(int32_t iIndex, void* pData); void* GetItemData(int32_t iIndex); - FWL_Error SetListTheme(IFWL_ThemeProvider* pTheme); + void SetListTheme(IFWL_ThemeProvider* pTheme); bool AfterFocusShowDropList(); FWL_Error OpenDropDownList(bool bActivate); @@ -61,8 +61,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { bool EditDelete(); bool EditDeSelect(); FWL_Error GetBBox(CFX_RectF& rect); - FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); // IFWL_DataProvider FWL_Error GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 554a16b258..fb4a39fe35 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -148,8 +148,8 @@ FWL_Error CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { return ToDateTimePicker(GetWidget())->SetEditLimit(nLimit); } -FWL_Error CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { - return ToDateTimePicker(GetWidget()) +void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { + ToDateTimePicker(GetWidget()) ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 2b5277f495..9227c7b889 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -39,8 +39,7 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { bool DeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error SetEditLimit(int32_t nLimit); - FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); // IFWL_DataProvider FWL_Error GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index 98f73cf40e..1dbe4451c7 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -38,35 +38,30 @@ const IFWL_Widget* CFWL_Widget::GetWidget() const { return m_pIface.get(); } -FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->GetWidgetRect(rect, bAutoSize); +void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { + if (m_pIface) + m_pIface->GetWidgetRect(rect, bAutoSize); } -FWL_Error CFWL_Widget::GetGlobalRect(CFX_RectF& rect) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->GetGlobalRect(rect); +void CFWL_Widget::GetGlobalRect(CFX_RectF& rect) { + if (m_pIface) + m_pIface->GetGlobalRect(rect); } -FWL_Error CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->SetWidgetRect(rect); +void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { + if (m_pIface) + m_pIface->SetWidgetRect(rect); } -FWL_Error CFWL_Widget::GetClientRect(CFX_RectF& rect) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->GetClientRect(rect); +void CFWL_Widget::GetClientRect(CFX_RectF& rect) { + if (m_pIface) + m_pIface->GetClientRect(rect); } -FWL_Error CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved); +void CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { + if (m_pIface) + m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved); } uint32_t CFWL_Widget::GetStylesEx() { @@ -75,9 +70,9 @@ uint32_t CFWL_Widget::GetStylesEx() { return m_pIface->GetStylesEx(); } -FWL_Error CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { - return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); +void CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { + m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } uint32_t CFWL_Widget::GetStates() { @@ -118,11 +113,10 @@ FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return m_pIface->HitTest(fx, fy); } -FWL_Error CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->DrawWidget(pGraphics, pMatrix); +void CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + if (m_pIface) + m_pIface->DrawWidget(pGraphics, pMatrix); } IFWL_WidgetDelegate* CFWL_Widget::GetDelegate() const { diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index b3c09f9738..d41de2694d 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -26,15 +26,14 @@ class CFWL_Widget { IFWL_Widget* GetWidget(); const IFWL_Widget* GetWidget() const; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); - FWL_Error SetWidgetRect(const CFX_RectF& rect); - FWL_Error GetGlobalRect(CFX_RectF& rect); - FWL_Error GetClientRect(CFX_RectF& rtClient); + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); + void SetWidgetRect(const CFX_RectF& rect); + void GetGlobalRect(CFX_RectF& rect); + void GetClientRect(CFX_RectF& rtClient); - FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); + void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); uint32_t GetStylesEx(); - FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + void ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); uint32_t GetStates(); void SetStates(uint32_t dwStates, bool bSet = true); @@ -47,8 +46,7 @@ class CFWL_Widget { FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr); + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); IFWL_WidgetDelegate* GetDelegate() const; void SetDelegate(IFWL_WidgetDelegate*); diff --git a/xfa/fwl/core/cfwl_widgetproperties.h b/xfa/fwl/core/cfwl_widgetproperties.h index 21040b9ee9..9963b5f357 100644 --- a/xfa/fwl/core/cfwl_widgetproperties.h +++ b/xfa/fwl/core/cfwl_widgetproperties.h @@ -21,7 +21,6 @@ class CFWL_WidgetProperties { CFWL_WidgetProperties(IFWL_DataProvider* dataProvider); ~CFWL_WidgetProperties(); - CFX_Matrix m_ctmOnParent; CFX_RectF m_rtWidget; uint32_t m_dwStyles; uint32_t m_dwStyleExes; @@ -44,7 +43,6 @@ inline CFWL_WidgetProperties::CFWL_WidgetProperties( m_pDataProvider(dataProvider), m_pParent(nullptr), m_pOwner(nullptr) { - m_ctmOnParent.SetIdentity(); m_rtWidget.Set(0, 0, 0, 0); } diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp index 3fb430d71b..518ed4a599 100644 --- a/xfa/fwl/core/ifwl_barcode.cpp +++ b/xfa/fwl/core/ifwl_barcode.cpp @@ -25,25 +25,24 @@ FWL_Type IFWL_Barcode::GetClassID() const { return FWL_Type::Barcode; } -FWL_Error IFWL_Barcode::Update() { +void IFWL_Barcode::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } - FWL_Error ret = IFWL_Edit::Update(); + IFWL_Edit::Update(); GenerateBarcodeImageCache(); - return ret; } -FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { GenerateBarcodeImageCache(); if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) { - return FWL_Error::Succeeded; + return; } CFX_Matrix mt; mt.e = m_rtClient.left; @@ -52,13 +51,11 @@ FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics, mt.Concat(*pMatrix); } int32_t errorCode = 0; - if (!m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix, - errorCode)) { - return FWL_Error::Indefinite; - } - return FWL_Error::Succeeded; + m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix, + errorCode); + return; } - return IFWL_Edit::DrawWidget(pGraphics, pMatrix); + IFWL_Edit::DrawWidget(pGraphics, pMatrix); } void IFWL_Barcode::GenerateBarcodeImageCache() { if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0) diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index a0bdc75342..28025fc8bc 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -63,9 +63,9 @@ class IFWL_Barcode : public IFWL_Edit { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; FWL_Error SetText(const CFX_WideString& wsText) override; void OnProcessEvent(CFWL_Event* pEvent) override; diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index 8971c2ee8c..78ac4e5727 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -35,17 +35,16 @@ FWL_Type IFWL_Caret::GetClassID() const { return FWL_Type::Caret; } -FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); - return FWL_Error::Succeeded; } void IFWL_Caret::ShowCaret(bool bFlag) { diff --git a/xfa/fwl/core/ifwl_caret.h b/xfa/fwl/core/ifwl_caret.h index 5a02d4266c..dc1d5806ad 100644 --- a/xfa/fwl/core/ifwl_caret.h +++ b/xfa/fwl/core/ifwl_caret.h @@ -27,8 +27,8 @@ class IFWL_Caret : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index a8f4936b29..3aac3598c2 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -43,15 +43,15 @@ FWL_Type IFWL_CheckBox::GetClassID() const { return FWL_Type::CheckBox; } -FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, 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_Error::Indefinite; + return; if (!m_pProperties->m_pDataProvider) - return FWL_Error::Indefinite; + return; CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(this, wsCaption); if (wsCaption.GetLength() > 0) { @@ -72,27 +72,25 @@ FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_CheckBox::Update() { +void IFWL_CheckBox::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } UpdateTextOutStyles(); Layout(); - return FWL_Error::Succeeded; } -FWL_Error IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, @@ -121,13 +119,14 @@ FWL_Error IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } if (!m_pProperties->m_pDataProvider) - return FWL_Error::Indefinite; + return; + { CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(this, wsCaption); int32_t iLen = wsCaption.GetLength(); if (iLen <= 0) - return FWL_Error::Indefinite; + return; CFWL_ThemeText textParam; textParam.m_pWidget = this; textParam.m_iPart = CFWL_Part::Caption; @@ -142,7 +141,6 @@ FWL_Error IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics, textParam.m_iTTOAlign = m_iTTOAlign; pTheme->DrawText(&textParam); } - return FWL_Error::Succeeded; } int32_t IFWL_CheckBox::GetCheckState() { diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 19ab626175..d3dfd2680d 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -62,10 +62,10 @@ class IFWL_CheckBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index ad42ce23eb..1c1f826e92 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -66,7 +66,7 @@ FWL_Type IFWL_ComboBox::GetClassID() const { return FWL_Type::ComboBox; } -FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Reset(); bool bIsDropDown = IsDropDownStyle(); @@ -82,19 +82,19 @@ FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_Error::Indefinite; + return; rect.Inflate(0, 0, *pFWidth, 0); IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +void IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); + DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); + return; } bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); @@ -106,15 +106,16 @@ FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, } else if (bRemoveDropDown && m_pEdit) { m_pEdit->SetStates(FWL_WGTSTATE_Invisible, true); } - return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); + IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_Error IFWL_ComboBox::Update() { +void IFWL_ComboBox::Update() { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_Update(); + DisForm_Update(); + return; } if (IsLocked()) { - return FWL_Error::Indefinite; + return; } ReSetTheme(); bool bDropDown = IsDropDownStyle(); @@ -130,7 +131,6 @@ FWL_Error IFWL_ComboBox::Update() { m_fComboFormHandler = *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( &part, CFWL_WidgetCapacity::ComboFormHandler)); - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_ComboBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -140,15 +140,16 @@ FWL_WidgetHit IFWL_ComboBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return IFWL_Widget::HitTest(fx, fy); } -FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_DrawWidget(pGraphics, pMatrix); + DisForm_DrawWidget(pGraphics, pMatrix); + return; } if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; bool bIsDropDown = IsDropDownStyle(); if (HasBorder()) { @@ -188,7 +189,7 @@ FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); if (m_iCurSel >= 0) { if (!m_pListBox) - return FWL_Error::Indefinite; + return; CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); @@ -222,18 +223,16 @@ FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = m_rtBtn; pTheme->DrawBackground(¶m); } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +void IFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_Error::Indefinite; + return; m_pProperties->m_pThemeProvider = pThemeProvider; if (m_pListBox) m_pListBox->SetThemeProvider(pThemeProvider); if (m_pEdit) m_pEdit->SetThemeProvider(pThemeProvider); - return FWL_Error::Succeeded; } int32_t IFWL_ComboBox::GetCurSel() { @@ -270,11 +269,11 @@ void IFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) { IFWL_Widget::SetStates(dwStates, bSet); } -FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { +void IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_Error::Indefinite; + return; m_pEdit->SetText(wsText); - return m_pEdit->Update(); + m_pEdit->Update(); } int32_t IFWL_ComboBox::GetEditTextLength() const { @@ -427,11 +426,10 @@ FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { return FWL_Error::Succeeded; } -FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { - if (!m_pEdit) - return FWL_Error::ParameterInvalid; - return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); +void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { + if (m_pEdit) + m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } FX_FLOAT IFWL_ComboBox::GetListHeight() { @@ -777,8 +775,8 @@ bool IFWL_ComboBox::DisForm_IsDropListShowed() { return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); } -FWL_Error IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +void IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (!m_pEdit) DisForm_InitComboEdit(); @@ -791,19 +789,18 @@ FWL_Error IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, } else if (bDelDropDown) { m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); } - return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); + IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_Error IFWL_ComboBox::DisForm_Update() { +void IFWL_ComboBox::DisForm_Update() { if (m_iLock) { - return FWL_Error::Indefinite; + return; } if (m_pEdit) { ReSetEditAlignment(); } ReSetTheme(); Layout(); - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -822,8 +819,8 @@ FWL_WidgetHit IFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FWL_Error IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ComboBox::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); @@ -859,7 +856,6 @@ FWL_Error IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, mt.Concat(mtOrg); m_pListBox->DrawWidget(pGraphics, &mt); } - return FWL_Error::Succeeded; } FWL_Error IFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) { diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index 8de93a62f6..e5065dbbc3 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -85,15 +85,15 @@ class IFWL_ComboBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) override; void SetStates(uint32_t dwStates, bool bSet = true) override; - FWL_Error Update() override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, @@ -101,7 +101,7 @@ class IFWL_ComboBox : public IFWL_Widget { int32_t GetCurSel(); FWL_Error SetCurSel(int32_t iSel); - FWL_Error SetEditText(const CFX_WideString& wsText); + void SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; FWL_Error GetEditText(CFX_WideString& wsText, int32_t nStart = 0, @@ -130,8 +130,7 @@ class IFWL_ComboBox : public IFWL_Widget { bool EditDelete(); bool EditDeSelect(); FWL_Error GetBBox(CFX_RectF& rect); - FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); bool IsDropListShowed(); @@ -155,12 +154,12 @@ class IFWL_ComboBox : public IFWL_Widget { void DisForm_InitComboEdit(); void DisForm_ShowDropList(bool bActivate); bool DisForm_IsDropListShowed(); - FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); - FWL_Error DisForm_Update(); + void DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); + void DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr); + void DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr); FWL_Error DisForm_GetBBox(CFX_RectF& rect); void DisForm_Layout(); diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index 915449aa79..4ac43ea114 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -70,9 +70,10 @@ FWL_Type IFWL_DateTimePicker::GetClassID() const { return FWL_Type::DateTimePicker; } -FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_GetWidgetRect(rect, bAutoSize); + DisForm_GetWidgetRect(rect, bAutoSize); + return; } if (bAutoSize) { rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); @@ -80,15 +81,15 @@ FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::Update() { +void IFWL_DateTimePicker::Update() { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_Update(); + DisForm_Update(); + return; } if (m_iLock) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -98,7 +99,7 @@ FWL_Error IFWL_DateTimePicker::Update() { FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_Error::Indefinite; + return; FX_FLOAT fBtn = *pFWidth; m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, m_rtClient.height - 1); @@ -123,7 +124,7 @@ FWL_Error IFWL_DateTimePicker::Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_Error::Succeeded; + return; } int32_t IFWL_DateTimePicker::CountSelRanges() { @@ -148,12 +149,12 @@ FWL_WidgetHit IFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FWL_Error IFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -165,15 +166,14 @@ FWL_Error IFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics, DrawDropDownButton(pGraphics, pTheme, pMatrix); } if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_DrawWidget(pGraphics, pMatrix); + DisForm_DrawWidget(pGraphics, pMatrix); + return; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::SetThemeProvider(IFWL_ThemeProvider* pTP) { +void IFWL_DateTimePicker::SetThemeProvider(IFWL_ThemeProvider* pTP) { m_pProperties->m_pThemeProvider = pTP; m_pMonthCal->SetThemeProvider(pTP); - return FWL_Error::Succeeded; } FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear, @@ -298,9 +298,9 @@ FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { return m_pEdit->SetLimit(nLimit); } -FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { - return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); +void IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { + m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } void IFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, @@ -559,9 +559,9 @@ bool IFWL_DateTimePicker::DisForm_IsNeedShowButton() { return bFocus; } -FWL_Error IFWL_DateTimePicker::DisForm_Update() { +void IFWL_DateTimePicker::DisForm_Update() { if (m_iLock) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -581,7 +581,7 @@ FWL_Error IFWL_DateTimePicker::DisForm_Update() { FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pWidth) - return FWL_Error::Succeeded; + return; m_fBtn = *pWidth; CFX_RectF rtMonthCal; @@ -591,16 +591,14 @@ FWL_Error IFWL_DateTimePicker::DisForm_Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect, - bool bAutoSize) { +void IFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect, + bool bAutoSize) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; } - return FWL_Error::Succeeded; } FWL_Error IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) { @@ -618,10 +616,10 @@ FWL_Error IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) { return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (m_pEdit) { CFX_RectF rtEdit; m_pEdit->GetWidgetRect(rtEdit); @@ -642,7 +640,7 @@ FWL_Error IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, } m_pMonthCal->DrawWidget(pGraphics, &mt); } - return FWL_Error::Succeeded; + return; } void IFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) { diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index 5e4ca5eeb7..a7464e78e6 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -69,12 +69,12 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + void SetThemeProvider(IFWL_ThemeProvider* pTP) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; @@ -103,8 +103,7 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { bool DeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error SetEditLimit(int32_t nLimit); - FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); IFWL_DateTimeEdit* GetDataTimeEdit(); bool IsMonthCalendarShowed(); @@ -153,11 +152,11 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { void DisForm_ShowMonthCalendar(bool bActivate); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); bool DisForm_IsNeedShowButton(); - FWL_Error DisForm_Update(); - FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); + void DisForm_Update(); + void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); FWL_Error DisForm_GetBBox(CFX_RectF& rect); - FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr); + void DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr); void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index 7b3d083c3e..aa18d2f576 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -92,7 +92,7 @@ FWL_Type IFWL_Edit::GetClassID() const { return FWL_Type::Edit; } -FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pEdtEngine) { @@ -124,7 +124,6 @@ FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } } } - return FWL_Error::Succeeded; } void IFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { @@ -135,25 +134,21 @@ void IFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { IFWL_Widget::SetStates(dwStates, bSet); } -FWL_Error IFWL_Edit::SetWidgetRect(const CFX_RectF& rect) { - return IFWL_Widget::SetWidgetRect(rect); -} -FWL_Error IFWL_Edit::Update() { +void IFWL_Edit::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); if (m_rtClient.IsEmpty()) { - return FWL_Error::Indefinite; + return; } UpdateEditEngine(); UpdateVAlignment(); UpdateScroll(); InitCaret(); - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -322,14 +317,13 @@ void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, } pGraphics->RestoreGraphState(); } -FWL_Error IFWL_Edit::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_Edit::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; if (m_rtClient.IsEmpty()) { - return FWL_Error::Indefinite; + return; } IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (!m_pWidgetMgr->IsFormDisabled()) { @@ -348,11 +342,10 @@ FWL_Error IFWL_Edit::DrawWidget(CFX_Graphics* pGraphics, if (HasEdge()) { DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } - return FWL_Error::Succeeded; } -FWL_Error IFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +void IFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_Error::Indefinite; + return; if (m_pHorzScrollBar) { m_pHorzScrollBar->SetThemeProvider(pThemeProvider); } @@ -363,7 +356,6 @@ FWL_Error IFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pCaret->SetThemeProvider(pThemeProvider); } m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_Error::Succeeded; } FWL_Error IFWL_Edit::SetText(const CFX_WideString& wsText) { diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h index 8ff69d0324..9dc8d01fbc 100644 --- a/xfa/fwl/core/ifwl_edit.h +++ b/xfa/fwl/core/ifwl_edit.h @@ -110,14 +110,13 @@ class IFWL_Edit : public IFWL_Widget { // IFWL_Widget: FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error SetWidgetRect(const CFX_RectF& rect) override; - FWL_Error Update() override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; void SetStates(uint32_t dwStates, bool bSet = true) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index 82148a07cf..e256a135f9 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -86,7 +86,7 @@ bool IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { return IFWL_Widget::IsInstance(wsClass); } -FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_Form::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Reset(); FX_FLOAT fCapHeight = GetCaptionHeight(); @@ -98,23 +98,21 @@ FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) { +void IFWL_Form::GetClientRect(CFX_RectF& rect) { if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); - return FWL_Error::Succeeded; + return; } #ifdef FWL_UseMacSystemBorder rect = m_rtRelative; CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); if (!pWidgetMgr) - return FWL_Error::Indefinite; + return; rect.left = 0; rect.top = 0; - return FWL_Error::Succeeded; #else FX_FLOAT x = 0; FX_FLOAT y = 0; @@ -133,12 +131,11 @@ FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_Error::Succeeded; #endif } -FWL_Error IFWL_Form::Update() { +void IFWL_Form::Update() { if (m_iLock > 0) { - return FWL_Error::Succeeded; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -152,7 +149,6 @@ FWL_Error IFWL_Form::Update() { #endif UpdateCaption(); Layout(); - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) { GetAvailableTheme(); @@ -206,12 +202,11 @@ FWL_WidgetHit IFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Client; } -FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; bool bInactive = !IsActive(); int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; @@ -219,7 +214,7 @@ FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, DrawBackground(pGraphics, pTheme); } #ifdef FWL_UseMacSystemBorder - return FWL_Error::Succeeded; + return; #endif CFWL_ThemeBackground param; param.m_pWidget = this; @@ -322,7 +317,6 @@ FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, } } #endif - return FWL_Error::Succeeded; } FWL_FORMSIZE IFWL_Form::GetFormSize() { diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 8042bb57bd..08211fe213 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -91,12 +91,12 @@ class IFWL_Form : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; bool IsInstance(const CFX_WideStringC& wsClass) const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error GetClientRect(CFX_RectF& rect) override; - FWL_Error Update() override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetClientRect(CFX_RectF& rect) override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp index 8bb1091326..56194d8c15 100644 --- a/xfa/fwl/core/ifwl_formproxy.cpp +++ b/xfa/fwl/core/ifwl_formproxy.cpp @@ -28,14 +28,10 @@ bool IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { return IFWL_Form::IsInstance(wsClass); } -FWL_Error IFWL_FormProxy::Update() { - return FWL_Error::Succeeded; -} +void IFWL_FormProxy::Update() {} -FWL_Error IFWL_FormProxy::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_Error::Succeeded; -} +void IFWL_FormProxy::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) {} void IFWL_FormProxy::OnProcessMessage(CFWL_Message* pMessage) { m_pOuter->GetDelegate()->OnProcessMessage(pMessage); diff --git a/xfa/fwl/core/ifwl_formproxy.h b/xfa/fwl/core/ifwl_formproxy.h index 4eaeb5ab2f..3a981df127 100644 --- a/xfa/fwl/core/ifwl_formproxy.h +++ b/xfa/fwl/core/ifwl_formproxy.h @@ -21,9 +21,9 @@ class IFWL_FormProxy : public IFWL_Form { // IFWL_Widget FWL_Type GetClassID() const override; bool IsInstance(const CFX_WideStringC& wsClass) const override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; protected: diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index f54c089a9a..aef74ae746 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -42,7 +42,7 @@ FWL_Type IFWL_ListBox::GetClassID() const { return FWL_Type::ListBox; } -FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -54,12 +54,11 @@ FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ListBox::Update() { +void IFWL_ListBox::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -83,7 +82,6 @@ FWL_Error IFWL_ListBox::Update() { m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; m_fScorllBarWidth = GetScrollWidth(); CalcSize(); - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -104,12 +102,12 @@ FWL_WidgetHit IFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FWL_Error IFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; pGraphics->SaveGraphState(); if (HasBorder()) { @@ -134,14 +132,11 @@ FWL_Error IFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, } DrawItems(pGraphics, pTheme, pMatrix); pGraphics->RestoreGraphState(); - return FWL_Error::Succeeded; } -FWL_Error IFWL_ListBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { - if (!pThemeProvider) - return FWL_Error::Indefinite; - m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_Error::Succeeded; +void IFWL_ListBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { + if (pThemeProvider) + m_pProperties->m_pThemeProvider = pThemeProvider; } int32_t IFWL_ListBox::CountSelItems() { if (!m_pProperties->m_pDataProvider) diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h index 943c064afe..fed3337a99 100644 --- a/xfa/fwl/core/ifwl_listbox.h +++ b/xfa/fwl/core/ifwl_listbox.h @@ -107,12 +107,12 @@ class IFWL_ListBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index 28d529787d..7351e7e29a 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -157,7 +157,7 @@ FWL_Type IFWL_MonthCalendar::GetClassID() const { return FWL_Type::MonthCalendar; } -FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { CFX_SizeF fs = CalcSize(true); rect.Set(0, 0, fs.x, fs.y); @@ -165,12 +165,11 @@ FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_MonthCalendar::Update() { +void IFWL_MonthCalendar::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -182,13 +181,12 @@ FWL_Error IFWL_MonthCalendar::Update() { ClearDateItem(); ReSetDateItem(); LayOut(); - return FWL_Error::Succeeded; } -FWL_Error IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } @@ -215,7 +213,6 @@ FWL_Error IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, DrawWeekNumberSep(pGraphics, pTheme, pMatrix); DrawWeekNumber(pGraphics, pTheme, pMatrix); } - return FWL_Error::Succeeded; } int32_t IFWL_MonthCalendar::CountSelect() { diff --git a/xfa/fwl/core/ifwl_monthcalendar.h b/xfa/fwl/core/ifwl_monthcalendar.h index ec8cdcda85..60679e27c8 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.h +++ b/xfa/fwl/core/ifwl_monthcalendar.h @@ -57,10 +57,10 @@ class IFWL_MonthCalendar : public IFWL_Widget { // FWL_WidgetImp FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index f97ee709c3..17a87ed835 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -28,11 +28,11 @@ FWL_Type IFWL_PictureBox::GetClassID() const { return FWL_Type::PictureBox; } -FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pDataProvider) - return FWL_Error::Indefinite; + return; CFX_DIBitmap* pBitmap = static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider) ->GetPicture(this); @@ -44,26 +44,24 @@ FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_PictureBox::Update() { +void IFWL_PictureBox::Update() { if (IsLocked()) { - return FWL_Error::Succeeded; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } GetClientRect(m_rtClient); - return FWL_Error::Succeeded; } -FWL_Error IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -72,7 +70,6 @@ FWL_Error IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawBkground(pGraphics, pTheme, pMatrix); - return FWL_Error::Succeeded; } void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 2eeacae3af..3aab27d02a 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -48,10 +48,10 @@ class IFWL_PictureBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index c03b26a9b6..da36e71b01 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -32,7 +32,7 @@ FWL_Type IFWL_PushButton::GetClassID() const { return FWL_Type::PushButton; } -FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -56,7 +56,6 @@ FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } void IFWL_PushButton::SetStates(uint32_t dwStates, bool bSet) { @@ -67,9 +66,9 @@ void IFWL_PushButton::SetStates(uint32_t dwStates, bool bSet) { IFWL_Widget::SetStates(dwStates, bSet); } -FWL_Error IFWL_PushButton::Update() { +void IFWL_PushButton::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -80,15 +79,14 @@ FWL_Error IFWL_PushButton::Update() { FX_FLOAT* fcaption = static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); m_rtCaption.Inflate(-*fcaption, -*fcaption); - return FWL_Error::Succeeded; } -FWL_Error IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_PushButtonDP* pData = static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); CFX_DIBitmap* pPicture = nullptr; @@ -269,7 +267,6 @@ FWL_Error IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); break; } - return FWL_Error::Succeeded; } void IFWL_PushButton::DrawBkground(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h index 94078bbfdc..6fb81f0811 100644 --- a/xfa/fwl/core/ifwl_pushbutton.h +++ b/xfa/fwl/core/ifwl_pushbutton.h @@ -44,11 +44,11 @@ class IFWL_PushButton : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; void SetStates(uint32_t dwStates, bool bSet = true) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 777ca593e9..949458a7c8 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -61,13 +61,13 @@ FWL_Type IFWL_ScrollBar::GetClassID() const { return FWL_Type::ScrollBar; } -FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfMinWidth) - return FWL_Error::Indefinite; + return; if (IsVertical()) { rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); } else { @@ -77,26 +77,24 @@ FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ScrollBar::Update() { +void IFWL_ScrollBar::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); - return FWL_Error::Succeeded; } -FWL_Error IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; if (!m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -109,7 +107,6 @@ FWL_Error IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, DrawArrowBtn(pGraphics, pTheme, true, pMatrix); DrawArrowBtn(pGraphics, pTheme, false, pMatrix); DrawThumb(pGraphics, pTheme, pMatrix); - return FWL_Error::Succeeded; } inline bool IFWL_ScrollBar::IsVertical() { diff --git a/xfa/fwl/core/ifwl_scrollbar.h b/xfa/fwl/core/ifwl_scrollbar.h index 15b1b95f0e..07393a9040 100644 --- a/xfa/fwl/core/ifwl_scrollbar.h +++ b/xfa/fwl/core/ifwl_scrollbar.h @@ -43,10 +43,10 @@ class IFWL_ScrollBar : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index a669493574..716f56c629 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -46,19 +46,18 @@ FWL_Type IFWL_SpinButton::GetClassID() const { return FWL_Type::SpinButton; } -FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, kMinWidth, kMinHeight); IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_SpinButton::Update() { +void IFWL_SpinButton::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } GetClientRect(m_rtClient); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) { @@ -72,7 +71,6 @@ FWL_Error IFWL_SpinButton::Update() { m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, m_rtClient.width / 2, m_rtClient.height); } - return FWL_Error::Succeeded; } FWL_WidgetHit IFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -93,10 +91,10 @@ FWL_WidgetHit IFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FWL_Error IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_Error::Indefinite; + return; CFX_RectF rtClip(m_rtClient); if (pMatrix) @@ -110,7 +108,6 @@ FWL_Error IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, DrawUpButton(pGraphics, pTheme, pMatrix); DrawDownButton(pGraphics, pTheme, pMatrix); - return FWL_Error::Succeeded; } FWL_Error IFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { diff --git a/xfa/fwl/core/ifwl_spinbutton.h b/xfa/fwl/core/ifwl_spinbutton.h index 73c2fc0639..f2d3c0203a 100644 --- a/xfa/fwl/core/ifwl_spinbutton.h +++ b/xfa/fwl/core/ifwl_spinbutton.h @@ -27,11 +27,11 @@ class IFWL_SpinButton : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index 99d3b98e95..35718228c3 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -40,7 +40,7 @@ FWL_Type IFWL_ToolTip::GetClassID() const { return FWL_Type::ToolTip; } -FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -63,12 +63,11 @@ FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::Update() { +void IFWL_ToolTip::Update() { if (IsLocked()) { - return FWL_Error::Indefinite; + return; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -76,10 +75,9 @@ FWL_Error IFWL_ToolTip::Update() { UpdateTextOutStyles(); GetClientRect(m_rtClient); m_rtCaption = m_rtClient; - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { +void IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { FX_FLOAT x = 0; FX_FLOAT y = 0; FX_FLOAT t = 0; @@ -95,18 +93,16 @@ FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics || !m_pProperties->m_pThemeProvider) - return FWL_Error::Indefinite; + return; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; DrawBkground(pGraphics, pTheme, pMatrix); DrawText(pGraphics, pTheme, pMatrix); - return FWL_Error::Succeeded; } void IFWL_ToolTip::DrawBkground(CFX_Graphics* pGraphics, @@ -206,14 +202,12 @@ void IFWL_ToolTip::RefreshToolTipPos() { FX_FLOAT fx = rtAnchor.Center().x + 20; FX_FLOAT fy = rtAnchor.Center().y + 20; rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height()); - FX_FLOAT fScreenWidth = 0; - FX_FLOAT fScreenHeight = 0; - GetScreenSize(fScreenWidth, fScreenHeight); - if (rtPopup.bottom() > fScreenHeight) { - rtPopup.Offset(0, fScreenHeight - rtPopup.bottom()); + + if (rtPopup.bottom() > 0.0f) { + rtPopup.Offset(0, 0.0f - rtPopup.bottom()); } - if (rtPopup.right() > fScreenWidth) { - rtPopup.Offset(fScreenWidth - rtPopup.right(), 0); + if (rtPopup.right() > 0.0f) { + rtPopup.Offset(0.0f - rtPopup.right(), 0); } if (rtPopup.left < 0) { rtPopup.Offset(0 - rtPopup.left, 0); diff --git a/xfa/fwl/core/ifwl_tooltip.h b/xfa/fwl/core/ifwl_tooltip.h index 78b7535ebf..14430f420e 100644 --- a/xfa/fwl/core/ifwl_tooltip.h +++ b/xfa/fwl/core/ifwl_tooltip.h @@ -41,12 +41,12 @@ class IFWL_ToolTip : public IFWL_Form { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - FWL_Error Update() override; - FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void Update() override; + void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; void SetStates(uint32_t dwStates, bool bSet) override; - FWL_Error GetClientRect(CFX_RectF& rect) override; + void GetClientRect(CFX_RectF& rect) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index a041f4e2d0..1399799668 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -23,6 +23,9 @@ #include "xfa/fxfa/xfa_ffapp.h" #define FWL_STYLEEXT_MNU_Vert (1L << 0) +#define FWL_WGT_CalcHeight 2048 +#define FWL_WGT_CalcWidth 2048 +#define FWL_WGT_CalcMultiLineDefWidth 120.0f IFWL_Widget::IFWL_Widget(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, @@ -31,9 +34,9 @@ IFWL_Widget::IFWL_Widget(const IFWL_App* app, m_pWidgetMgr(app->GetWidgetMgr()), m_pProperties(std::move(properties)), m_pOuter(pOuter), + m_iLock(0), m_pLayoutItem(nullptr), m_pAssociate(nullptr), - m_iLock(0), m_nEventKey(0), m_pDelegate(nullptr) { ASSERT(m_pWidgetMgr); @@ -57,7 +60,7 @@ bool IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { return false; } -FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { +void IFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); @@ -70,23 +73,22 @@ FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { +void IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this); if (!pForm) - return FWL_Error::Indefinite; + return; rect.Set(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); if (pForm == this) - return FWL_Error::Succeeded; + return; - return TransformTo(pForm, rect); + TransformTo(pForm, rect.left, rect.top); } -FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { +void IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { CFX_RectF rtOld = m_pProperties->m_rtWidget; m_pProperties->m_rtWidget = rect; if (IsChild()) { @@ -100,69 +102,34 @@ FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { if (IFWL_WidgetDelegate* pDelegate = GetDelegate()) pDelegate->OnProcessEvent(&ev); } - return FWL_Error::Succeeded; + return; } m_pWidgetMgr->SetWidgetRect_Native(this, rect); - return FWL_Error::Succeeded; } -FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) { +void IFWL_Widget::GetClientRect(CFX_RectF& rect) { GetEdgeRect(rect); if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); rect.Deflate(fEdge, fEdge); } - return FWL_Error::Succeeded; } -IFWL_Widget* IFWL_Widget::GetParent() { - return m_pWidgetMgr->GetParentWidget(this); -} - -FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) { +void IFWL_Widget::SetParent(IFWL_Widget* pParent) { m_pProperties->m_pParent = pParent; m_pWidgetMgr->SetParent(pParent, this); - return FWL_Error::Succeeded; } -IFWL_Widget* IFWL_Widget::GetOwner() { - return m_pWidgetMgr->GetOwnerWidget(this); -} - -FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { - m_pProperties->m_pOwner = pOwner; - m_pWidgetMgr->SetOwner(pOwner, this); - return FWL_Error::Succeeded; -} - -IFWL_Widget* IFWL_Widget::GetOuter() { - return m_pOuter; -} - -uint32_t IFWL_Widget::GetStyles() { - return m_pProperties->m_dwStyles; -} - -FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +void IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { m_pProperties->m_dwStyles = (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; - return FWL_Error::Succeeded; } -uint32_t IFWL_Widget::GetStylesEx() { - return m_pProperties->m_dwStyleExes; -} - -FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +void IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { m_pProperties->m_dwStyleExes = (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; - return FWL_Error::Succeeded; -} - -uint32_t IFWL_Widget::GetStates() { - return m_pProperties->m_dwStates; } static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr, @@ -195,21 +162,7 @@ void IFWL_Widget::SetStates(uint32_t dwStates, bool bSet) { return; } -FWL_Error IFWL_Widget::Update() { - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Widget::LockUpdate() { - m_iLock++; - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Widget::UnlockUpdate() { - if (IsLocked()) { - m_iLock--; - } - return FWL_Error::Succeeded; -} +void IFWL_Widget::Update() {} FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtClient; @@ -231,9 +184,9 @@ FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +void IFWL_Widget::TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { if (m_pWidgetMgr->IsFormDisabled()) { CFX_SizeF szOffset; if (IsParent(pWidget)) { @@ -245,7 +198,7 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, } fx += szOffset.x; fy += szOffset.y; - return FWL_Error::Succeeded; + return; } CFX_RectF r; CFX_Matrix m; @@ -259,16 +212,16 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, } IFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this); if (!form1) - return FWL_Error::Indefinite; + return; if (!pWidget) { form1->GetWidgetRect(r); fx += r.left; fy += r.top; - return FWL_Error::Succeeded; + return; } IFWL_Widget* form2 = m_pWidgetMgr->GetSystemFormWidget(pWidget); if (!form2) - return FWL_Error::Indefinite; + return; if (form1 != form2) { form1->GetWidgetRect(r); fx += r.left; @@ -288,16 +241,11 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, fx -= r.left; fy -= r.top; } - return FWL_Error::Succeeded; } -FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { - return TransformTo(pWidget, rt.left, rt.top); -} - -FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { +void IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { if (!m_pProperties) - return FWL_Error::Indefinite; + return; if (bGlobal) { IFWL_Widget* parent = GetParent(); CFX_ArrayTemplate<IFWL_Widget*> parents; @@ -316,100 +264,20 @@ FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { matrix.Concat(ctmOnParent, true); matrix.Translate(rect.left, rect.top, true); } - matrix.Concat(m_pProperties->m_ctmOnParent, true); + CFX_Matrix m; + m.SetIdentity(); + matrix.Concat(m, true); parents.RemoveAll(); } else { - matrix = m_pProperties->m_ctmOnParent; - } - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { - if (!m_pProperties) - return FWL_Error::Indefinite; - IFWL_Widget* parent = GetParent(); - if (!parent) { - return FWL_Error::Indefinite; + matrix.SetIdentity(); } - m_pProperties->m_ctmOnParent = matrix; - return FWL_Error::Succeeded; } -FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_Error::Indefinite; -} +void IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) {} -IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { - return m_pProperties->m_pThemeProvider; -} -FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +void IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_Error::Succeeded; -} - -const IFWL_App* IFWL_Widget::GetOwnerApp() const { - return m_pOwnerApp; -} - -uint32_t IFWL_Widget::GetEventKey() const { - return m_nEventKey; -} - -void IFWL_Widget::SetEventKey(uint32_t key) { - m_nEventKey = key; -} - -void* IFWL_Widget::GetLayoutItem() const { - return m_pLayoutItem; -} - -void IFWL_Widget::SetLayoutItem(void* pItem) { - m_pLayoutItem = pItem; -} - -void IFWL_Widget::SetAssociateWidget(CFWL_Widget* pAssociate) { - m_pAssociate = pAssociate; -} -bool IFWL_Widget::IsEnabled() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; -} - -bool IFWL_Widget::IsVisible() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; -} - -bool IFWL_Widget::IsActive() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; -} - -bool IFWL_Widget::IsOverLapper() const { - return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == - FWL_WGTSTYLE_OverLapper; -} - -bool IFWL_Widget::IsPopup() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); -} - -bool IFWL_Widget::IsChild() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); -} - -bool IFWL_Widget::IsLocked() const { - return m_iLock > 0; -} - -bool IFWL_Widget::IsOffscreen() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); -} - -bool IFWL_Widget::HasBorder() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); -} - -bool IFWL_Widget::HasEdge() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); } void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { @@ -495,10 +363,6 @@ IFWL_Widget* IFWL_Widget::GetRootOuter() { return pRet; } -#define FWL_WGT_CalcHeight 2048 -#define FWL_WGT_CalcWidth 2048 -#define FWL_WGT_CalcMultiLineDefWidth 120.0f - CFX_SizeF IFWL_Widget::CalcTextSize(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, bool bMultiLine, @@ -590,14 +454,12 @@ bool IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; - FX_FLOAT fScreenWidth = 0; - FX_FLOAT fScreenHeight = 0; - GetScreenSize(fScreenWidth, fScreenHeight); + if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { bool bLeft = m_pProperties->m_rtWidget.left < 0; FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; TransformTo(nullptr, fx, fy); - if (fRight + fx > fScreenWidth || bLeft) { + if (fRight + fx > 0.0f || bLeft) { rtPopup.Set(rtAnchor.left - rtPopup.width, rtAnchor.top, rtPopup.width, rtPopup.height); } else { @@ -607,7 +469,7 @@ bool IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, } else { FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; TransformTo(nullptr, fx, fy); - if (fBottom + fy > fScreenHeight) { + if (fBottom + fy > 0.0f) { rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, rtPopup.height); } else { @@ -625,9 +487,7 @@ bool IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; - FX_FLOAT fScreenWidth = 0; - FX_FLOAT fScreenHeight = 0; - GetScreenSize(fScreenWidth, fScreenHeight); + FX_FLOAT fPopHeight = rtPopup.height; if (rtPopup.height > fMaxHeight) { fPopHeight = fMaxHeight; @@ -637,7 +497,7 @@ bool IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width); FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight; TransformTo(nullptr, fx, fy); - if (fBottom + fy > fScreenHeight) { + if (fBottom + fy > 0.0f) { rtPopup.Set(rtAnchor.left, rtAnchor.top - fPopHeight, fWidth, fPopHeight); } else { rtPopup.Set(rtAnchor.left, rtAnchor.bottom(), fWidth, fPopHeight); @@ -652,11 +512,9 @@ bool IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; - FX_FLOAT fScreenWidth = 0; - FX_FLOAT fScreenHeight = 0; - GetScreenSize(fScreenWidth, fScreenHeight); + TransformTo(nullptr, fx, fy); - if (rtAnchor.bottom() + fy > fScreenHeight) { + if (rtAnchor.bottom() + fy > 0.0f) { rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, rtPopup.height); } else { @@ -667,10 +525,6 @@ bool IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, return true; } -bool IFWL_Widget::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { - return false; -} - void IFWL_Widget::RegisterEventTarget(IFWL_Widget* pEventSource, uint32_t dwFilter) { const IFWL_App* pApp = GetOwnerApp(); diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 862f357f7e..2792951b36 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -13,6 +13,8 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_themepart.h" +#include "xfa/fwl/core/cfwl_widgetmgr.h" +#include "xfa/fwl/core/cfwl_widgetproperties.h" #include "xfa/fwl/core/fwl_widgethit.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" #include "xfa/fwl/theme/cfwl_widgettp.h" @@ -68,49 +70,47 @@ class IFWL_Widget : public IFWL_WidgetDelegate { virtual FWL_Type GetClassID() const = 0; virtual bool IsInstance(const CFX_WideStringC& wsClass) const; - - virtual FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); - virtual FWL_Error GetGlobalRect(CFX_RectF& rect); - virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); - virtual FWL_Error GetClientRect(CFX_RectF& rect); - - virtual IFWL_Widget* GetParent(); - virtual FWL_Error SetParent(IFWL_Widget* pParent); - - virtual IFWL_Widget* GetOwner(); - virtual FWL_Error SetOwner(IFWL_Widget* pOwner); - - virtual IFWL_Widget* GetOuter(); - - virtual uint32_t GetStyles(); - virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved); - virtual uint32_t GetStylesEx(); - virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); - - virtual uint32_t GetStates(); + virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); + virtual void GetClientRect(CFX_RectF& rect); + virtual void ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); virtual void SetStates(uint32_t dwStates, bool bSet = true); + virtual void Update(); + virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual void DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr); + virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); - virtual FWL_Error Update(); - virtual FWL_Error LockUpdate(); - virtual FWL_Error UnlockUpdate(); + // IFWL_WidgetDelegate. + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; - virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); + void SetWidgetRect(const CFX_RectF& rect); + void GetGlobalRect(CFX_RectF& rect); - virtual FWL_Error TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy); - virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + void SetParent(IFWL_Widget* pParent); - virtual FWL_Error GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); - virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); + IFWL_Widget* GetOwner() { return m_pWidgetMgr->GetOwnerWidget(this); } + IFWL_Widget* GetOuter() const { return m_pOuter; } - virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr); + uint32_t GetStyles() const { return m_pProperties->m_dwStyles; } + void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); + uint32_t GetStylesEx() const { return m_pProperties->m_dwStyleExes; } + uint32_t GetStates() const { return m_pProperties->m_dwStates; } - virtual IFWL_ThemeProvider* GetThemeProvider(); - virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + void LockUpdate() { m_iLock++; } + void UnlockUpdate() { + if (IsLocked()) + m_iLock--; + } + + void TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); + void GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); + IFWL_ThemeProvider* GetThemeProvider() const { + return m_pProperties->m_pThemeProvider; + } void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } IFWL_WidgetDelegate* GetDelegate() { @@ -120,51 +120,44 @@ class IFWL_Widget : public IFWL_WidgetDelegate { return m_pDelegate ? m_pDelegate : this; } - // IFWL_WidgetDelegate. - void OnProcessMessage(CFWL_Message* pMessage) override; - void OnProcessEvent(CFWL_Event* pEvent) override; - void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + const IFWL_App* GetOwnerApp() const { return m_pOwnerApp; } + uint32_t GetEventKey() const { return m_nEventKey; } + void SetEventKey(uint32_t key) { m_nEventKey = key; } - const IFWL_App* GetOwnerApp() const; + void* GetLayoutItem() const { return m_pLayoutItem; } + void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } - CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); - - uint32_t GetEventKey() const; - void SetEventKey(uint32_t key); - - void* GetLayoutItem() const; - void SetLayoutItem(void* pItem); - - void SetAssociateWidget(CFWL_Widget* pAssociate); + void SetAssociateWidget(CFWL_Widget* pAssociate) { + m_pAssociate = pAssociate; + } void SetFocus(bool bFocus); void Repaint(const CFX_RectF* pRect = nullptr); protected: - friend class CFWL_WidgetImpDelegate; - IFWL_Widget(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, IFWL_Widget* pOuter); - bool IsEnabled() const; - bool IsVisible() const; - bool IsActive() const; - bool IsOverLapper() const; - bool IsPopup() const; - bool IsChild() const; - bool IsLocked() const; - bool IsOffscreen() const; - bool HasBorder() const; - bool HasEdge() const; + bool IsEnabled() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; + } + bool IsActive() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; + } + bool IsLocked() const { return m_iLock > 0; } + bool HasBorder() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); + } + bool HasEdge() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); + } void GetEdgeRect(CFX_RectF& rtEdge); FX_FLOAT GetBorderSize(bool bCX = true); FX_FLOAT GetEdgeWidth(); void GetRelativeRect(CFX_RectF& rect); void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); IFWL_ThemeProvider* GetAvailableTheme(); - IFWL_Widget* GetRootOuter(); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, bool bMultiLine = false, @@ -179,6 +172,47 @@ class IFWL_Widget : public IFWL_WidgetDelegate { FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); + void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, + uint32_t dwFilter = FWL_EVENT_ALL_MASK); + void UnregisterEventTarget(); + void DispatchKeyEvent(CFWL_MsgKey* pNote); + void DispatchEvent(CFWL_Event* pEvent); + void DrawBorder(CFX_Graphics* pGraphics, + CFWL_Part iPartBorder, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix = nullptr); + void DrawEdge(CFX_Graphics* pGraphics, + CFWL_Part iPartEdge, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix = nullptr); + + const IFWL_App* const m_pOwnerApp; + CFWL_WidgetMgr* const m_pWidgetMgr; + std::unique_ptr<CFWL_WidgetProperties> m_pProperties; + IFWL_Widget* m_pOuter; + int32_t m_iLock; + + private: + IFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } + CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); + + bool IsVisible() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; + } + bool IsOverLapper() const { + return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == + FWL_WGTSTYLE_OverLapper; + } + bool IsPopup() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); + } + bool IsChild() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); + } + bool IsOffscreen() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); + } + IFWL_Widget* GetRootOuter(); bool GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, @@ -192,37 +226,16 @@ class IFWL_Widget : public IFWL_WidgetDelegate { const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); - void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, - uint32_t dwFilter = FWL_EVENT_ALL_MASK); - void UnregisterEventTarget(); - void DispatchKeyEvent(CFWL_MsgKey* pNote); - void DispatchEvent(CFWL_Event* pEvent); void DrawBackground(CFX_Graphics* pGraphics, CFWL_Part iPartBk, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = nullptr); - void DrawBorder(CFX_Graphics* pGraphics, - CFWL_Part iPartBorder, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = nullptr); - void DrawEdge(CFX_Graphics* pGraphics, - CFWL_Part iPartEdge, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix = nullptr); void NotifyDriver(); - bool IsParent(IFWL_Widget* pParent); - const IFWL_App* const m_pOwnerApp; - CFWL_WidgetMgr* const m_pWidgetMgr; - std::unique_ptr<CFWL_WidgetProperties> m_pProperties; - IFWL_Widget* m_pOuter; void* m_pLayoutItem; CFWL_Widget* m_pAssociate; - int32_t m_iLock; uint32_t m_nEventKey; - - private: IFWL_WidgetDelegate* m_pDelegate; // Not owned. }; |