From b4d40ffae3f955fab2fac838430c89aca452c45f Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 5 May 2016 10:28:02 -0700 Subject: Remove CLASSHASH defines in favour of an enum class. This Cl updates all the CLASSHASH defines to use an enum class. A few defines where unabled and were either updated or removed if the number no longer exists in the code base. Review-Url: https://codereview.chromium.org/1946213003 --- xfa/fwl/basewidget/fwl_barcodeimp.cpp | 7 +- xfa/fwl/basewidget/fwl_barcodeimp.h | 4 +- xfa/fwl/basewidget/fwl_caretimp.cpp | 8 +- xfa/fwl/basewidget/fwl_caretimp.h | 40 +++++---- xfa/fwl/basewidget/fwl_checkboximp.cpp | 10 ++- xfa/fwl/basewidget/fwl_checkboximp.h | 32 ++++--- xfa/fwl/basewidget/fwl_comboboximp.cpp | 5 +- xfa/fwl/basewidget/fwl_comboboximp.h | 120 ++++++++++++++------------- xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 11 ++- xfa/fwl/basewidget/fwl_datetimepickerimp.h | 71 ++++++++-------- xfa/fwl/basewidget/fwl_editimp.cpp | 19 +++-- xfa/fwl/basewidget/fwl_editimp.h | 2 +- xfa/fwl/basewidget/fwl_formproxyimp.cpp | 8 +- xfa/fwl/basewidget/fwl_formproxyimp.h | 21 +++-- xfa/fwl/basewidget/fwl_listboximp.cpp | 10 ++- xfa/fwl/basewidget/fwl_listboximp.h | 42 +++++----- xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 10 ++- xfa/fwl/basewidget/fwl_monthcalendarimp.h | 33 ++++---- xfa/fwl/basewidget/fwl_pictureboximp.cpp | 10 ++- xfa/fwl/basewidget/fwl_pictureboximp.h | 25 +++--- xfa/fwl/basewidget/fwl_pushbuttonimp.cpp | 10 ++- xfa/fwl/basewidget/fwl_pushbuttonimp.h | 27 +++--- xfa/fwl/basewidget/fwl_scrollbarimp.cpp | 10 ++- xfa/fwl/basewidget/fwl_scrollbarimp.h | 56 +++++++------ xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 10 ++- xfa/fwl/basewidget/fwl_spinbuttonimp.h | 31 ++++--- xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp | 10 ++- xfa/fwl/basewidget/fwl_tooltipctrlimp.h | 51 +++++++----- xfa/fwl/basewidget/ifwl_barcode.h | 1 - xfa/fwl/basewidget/ifwl_caret.h | 1 - xfa/fwl/basewidget/ifwl_checkbox.h | 1 - xfa/fwl/basewidget/ifwl_combobox.h | 1 - xfa/fwl/basewidget/ifwl_datetimepicker.h | 1 - xfa/fwl/basewidget/ifwl_edit.h | 1 - xfa/fwl/basewidget/ifwl_listbox.h | 1 - xfa/fwl/basewidget/ifwl_monthcalendar.h | 1 - xfa/fwl/basewidget/ifwl_picturebox.h | 1 - xfa/fwl/basewidget/ifwl_pushbutton.h | 1 - xfa/fwl/basewidget/ifwl_scrollbar.h | 1 - xfa/fwl/basewidget/ifwl_spinbutton.h | 1 - xfa/fwl/basewidget/ifwl_tooltip.h | 1 - xfa/fwl/core/fwl_formimp.cpp | 4 +- xfa/fwl/core/fwl_formimp.h | 44 +++++----- xfa/fwl/core/fwl_noteimp.cpp | 11 +-- xfa/fwl/core/fwl_widgetimp.cpp | 33 +++----- xfa/fwl/core/fwl_widgetimp.h | 3 +- xfa/fwl/core/fwl_widgetmgrimp.cpp | 51 ++---------- xfa/fwl/core/ifwl_form.h | 2 - xfa/fwl/core/ifwl_themeprovider.h | 2 +- xfa/fwl/core/ifwl_widget.h | 22 ++++- xfa/fwl/lightwidget/cfwl_theme.cpp | 2 +- xfa/fwl/lightwidget/cfwl_theme.h | 2 +- xfa/fwl/lightwidget/cfwl_widget.cpp | 4 +- xfa/fwl/lightwidget/cfwl_widget.h | 3 +- xfa/fwl/theme/cfwl_barcodetp.cpp | 6 +- xfa/fwl/theme/cfwl_barcodetp.h | 8 +- xfa/fwl/theme/cfwl_carettp.cpp | 7 +- xfa/fwl/theme/cfwl_carettp.h | 8 +- xfa/fwl/theme/cfwl_checkboxtp.cpp | 5 +- xfa/fwl/theme/cfwl_checkboxtp.h | 20 +++-- xfa/fwl/theme/cfwl_comboboxtp.cpp | 9 +- xfa/fwl/theme/cfwl_comboboxtp.h | 12 +-- xfa/fwl/theme/cfwl_datetimepickedtp.cpp | 9 +- xfa/fwl/theme/cfwl_datetimepickertp.h | 9 +- xfa/fwl/theme/cfwl_edittp.cpp | 7 +- xfa/fwl/theme/cfwl_edittp.h | 12 +-- xfa/fwl/theme/cfwl_formtp.cpp | 8 +- xfa/fwl/theme/cfwl_formtp.h | 3 +- xfa/fwl/theme/cfwl_listboxtp.cpp | 8 +- xfa/fwl/theme/cfwl_listboxtp.h | 12 +-- xfa/fwl/theme/cfwl_monthcalendartp.cpp | 8 +- xfa/fwl/theme/cfwl_monthcalendartp.h | 4 +- xfa/fwl/theme/cfwl_pictureboxtp.cpp | 11 +-- xfa/fwl/theme/cfwl_pictureboxtp.h | 8 +- xfa/fwl/theme/cfwl_pushbuttontp.cpp | 4 +- xfa/fwl/theme/cfwl_pushbuttontp.h | 3 +- xfa/fwl/theme/cfwl_scrollbartp.cpp | 6 +- xfa/fwl/theme/cfwl_scrollbartp.h | 18 ++-- xfa/fwl/theme/cfwl_widgettp.cpp | 5 +- xfa/fwl/theme/cfwl_widgettp.h | 11 ++- xfa/fxfa/app/xfa_fwltheme.cpp | 37 +++++---- xfa/fxfa/app/xfa_fwltheme.h | 2 +- 82 files changed, 641 insertions(+), 508 deletions(-) diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index ce9d083d83..57a3c93e9e 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -38,13 +38,16 @@ CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties, CFWL_BarcodeImp::~CFWL_BarcodeImp() { ReleaseBarcodeEngine(); } + FWL_Error CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Barcode; return FWL_Error::Succeeded; } -uint32_t CFWL_BarcodeImp::GetClassID() const { - return FWL_CLASSHASH_Barcode; + +FWL_Type CFWL_BarcodeImp::GetClassID() const { + return FWL_Type::Barcode; } + FWL_Error CFWL_BarcodeImp::Initialize() { if (!m_pDelegate) { m_pDelegate = new CFWL_BarcodeImpDelegate(this); diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.h b/xfa/fwl/basewidget/fwl_barcodeimp.h index 68c017e63e..705329572a 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.h +++ b/xfa/fwl/basewidget/fwl_barcodeimp.h @@ -25,14 +25,16 @@ class CFWL_BarcodeImp : public CFWL_EditImp { IFWL_Widget* pOuter); ~CFWL_BarcodeImp() override; + // CFWL_WidgetImp FWL_Error GetClassName(CFX_WideString& wsClass) const override; - uint32_t GetClassID() const override; + FWL_Type GetClassID() const 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(); diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index 2b4a67cb1a..c67c0c4291 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -53,15 +53,19 @@ FWL_Error CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Caret; return FWL_Error::Succeeded; } -uint32_t CFWL_CaretImp::GetClassID() const { - return FWL_CLASSHASH_Caret; + +FWL_Type CFWL_CaretImp::GetClassID() const { + return FWL_Type::Caret; } + FWL_Error CFWL_CaretImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_CaretImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_CaretImp::Finalize() { if (m_hTimer) { FWL_StopTimer(m_hTimer); diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h index c579beeed3..b1ebcfa184 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.h +++ b/xfa/fwl/basewidget/fwl_caretimp.h @@ -9,6 +9,7 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_timer.h" +#include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxgraphics/cfx_color.h" class CFWL_WidgetImpProperties; @@ -19,26 +20,25 @@ class CFWL_CaretImp : public CFWL_WidgetImp { public: CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_CaretImp(); + ~CFWL_CaretImp() override; - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - - virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - - virtual void ShowCaret(FX_BOOL bFlag = TRUE); - virtual FWL_Error GetFrequency(uint32_t& elapse); - virtual FWL_Error SetFrequency(uint32_t elapse); - virtual FWL_Error SetColor(CFX_Color crFill); + void ShowCaret(FX_BOOL bFlag = TRUE); + FWL_Error GetFrequency(uint32_t& elapse); + FWL_Error SetFrequency(uint32_t elapse); + FWL_Error SetColor(CFX_Color crFill); protected: - void DrawCaretBK(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix); + friend class CFWL_CaretImpDelegate; + friend class CFWL_CaretTimer; + class CFWL_CaretTimer : public IFWL_Timer { public: explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret); @@ -46,14 +46,18 @@ class CFWL_CaretImp : public CFWL_WidgetImp { int32_t Run(FWL_HTIMER hTimer) override; CFWL_CaretImp* const m_pCaret; }; + + void DrawCaretBK(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix); + CFWL_CaretTimer* m_pTimer; FWL_HTIMER m_hTimer; uint32_t m_dwElapse; CFX_Color m_crFill; FX_BOOL m_bSetColor; - friend class CFWL_CaretImpDelegate; - friend class CFWL_CaretTimer; }; + class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index a45c639450..574da160ee 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -52,20 +52,26 @@ CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, m_rtCaption.Reset(); m_rtFocus.Reset(); } + CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} + FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_CheckBox; return FWL_Error::Succeeded; } -uint32_t CFWL_CheckBoxImp::GetClassID() const { - return FWL_CLASSHASH_CheckBox; + +FWL_Type CFWL_CheckBoxImp::GetClassID() const { + return FWL_Type::CheckBox; } + FWL_Error CFWL_CheckBoxImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_CheckBoxImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_CheckBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_checkboximp.h b/xfa/fwl/basewidget/fwl_checkboximp.h index cc5474db9a..89f680c985 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.h +++ b/xfa/fwl/basewidget/fwl_checkboximp.h @@ -8,6 +8,7 @@ #define XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ #include "xfa/fwl/core/fwl_widgetimp.h" +#include "xfa/fwl/core/ifwl_widget.h" class CFWL_CheckBoxImpDelegate; class CFWL_MsgMouse; @@ -18,23 +19,28 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { public: CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_CheckBoxImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error SetCheckState(int32_t iCheck); + ~CFWL_CheckBoxImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + int32_t GetCheckState(); + FWL_Error SetCheckState(int32_t iCheck); protected: + friend class CFWL_CheckBoxImpDelegate; + void Layout(); uint32_t GetPartStates(); void UpdateTextOutStyles(); void NextStates(); + CFX_RectF m_rtClient; CFX_RectF m_rtBox; CFX_RectF m_rtCaption; @@ -42,11 +48,12 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; FX_BOOL m_bBtnDown; - friend class CFWL_CheckBoxImpDelegate; }; + class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); + void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL) override; @@ -59,6 +66,7 @@ class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { void OnMouseMove(CFWL_MsgMouse* pMsg); void OnMouseLeave(CFWL_MsgMouse* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); + CFWL_CheckBoxImp* m_pOwner; }; diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 7368f7bbbd..81c2fa75d3 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -490,13 +490,14 @@ FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { return FWL_Error::Succeeded; } -uint32_t CFWL_ComboBoxImp::GetClassID() const { - return FWL_CLASSHASH_ComboBox; +FWL_Type CFWL_ComboBoxImp::GetClassID() const { + return FWL_Type::ComboBox; } FWL_Error CFWL_ComboBoxImp::Initialize() { if (m_pWidgetMgr->IsFormDisabled()) return DisForm_Initialize(); + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h index 6fa097a4c0..45cb47d321 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.h +++ b/xfa/fwl/basewidget/fwl_comboboximp.h @@ -53,15 +53,20 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { public: CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + + // CFWL_WidgetImp + FWL_Error Initialize() override; + FWL_Error Finalize() override; + int32_t MatchItem(const CFX_WideString& wsMatch); void ChangeSelected(int32_t iSel); int32_t CountItems(); void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); void SetFocus(FX_BOOL bSet); + FX_BOOL m_bNotifyOwner; + friend class CFWL_ComboListImpDelegate; friend class CFWL_ComboBoxImp; }; @@ -83,55 +88,65 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { public: CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_ComboBoxImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error Update(); - virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - 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_Error SetCurSel(int32_t iSel); - virtual FWL_Error SetEditText(const CFX_WideString& wsText); - virtual int32_t GetEditTextLength() const; - 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_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 FWL_Error OpenDropDownList(FX_BOOL bActivate); - virtual FX_BOOL EditCanUndo(); - virtual FX_BOOL EditCanRedo(); - virtual FX_BOOL EditUndo(); - virtual FX_BOOL EditRedo(); - virtual FX_BOOL EditCanCopy(); - virtual FX_BOOL EditCanCut(); - virtual FX_BOOL EditCanSelectAll(); - virtual FX_BOOL EditCopy(CFX_WideString& wsCopy); - virtual FX_BOOL EditCut(CFX_WideString& wsCut); - virtual FX_BOOL EditPaste(const CFX_WideString& wsPaste); - virtual FX_BOOL EditSelectAll(); - virtual FX_BOOL EditDelete(); - virtual FX_BOOL EditDeSelect(); - virtual FWL_Error GetBBox(CFX_RectF& rect); - virtual FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + ~CFWL_ComboBoxImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) override; + void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; + FWL_Error 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; + + int32_t GetCurSel(); + FWL_Error SetCurSel(int32_t iSel); + FWL_Error SetEditText(const CFX_WideString& wsText); + int32_t GetEditTextLength() const; + 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_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(); + FWL_Error OpenDropDownList(FX_BOOL bActivate); + FX_BOOL EditCanUndo(); + FX_BOOL EditCanRedo(); + FX_BOOL EditUndo(); + FX_BOOL EditRedo(); + FX_BOOL EditCanCopy(); + FX_BOOL EditCanCut(); + FX_BOOL EditCanSelectAll(); + FX_BOOL EditCopy(CFX_WideString& wsCopy); + FX_BOOL EditCut(CFX_WideString& wsCut); + FX_BOOL EditPaste(const CFX_WideString& wsPaste); + FX_BOOL EditSelectAll(); + FX_BOOL EditDelete(); + FX_BOOL EditDeSelect(); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: + friend class CFWL_ComboListImp; + friend class CFWL_ComboEditImp; + friend class CFWL_ComboEditImpDelegate; + friend class CFWL_ComboListImpDelegate; + friend class CFWL_ComboBoxImpDelegate; + friend class CFWL_ComboProxyImpDelegate; + void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); FX_FLOAT GetListHeight(); void ShowDropList(FX_BOOL bActivate); @@ -177,13 +192,6 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { FX_BOOL m_bNeedShowList; CFWL_FormProxyImp* m_pProxy; CFWL_ComboProxyImpDelegate* m_pListProxyDelegate; - - friend class CFWL_ComboListImp; - friend class CFWL_ComboEditImp; - friend class CFWL_ComboEditImpDelegate; - friend class CFWL_ComboListImpDelegate; - friend class CFWL_ComboBoxImpDelegate; - friend class CFWL_ComboProxyImpDelegate; }; class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { public: diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index e65b5bfb3d..a0af1a0d71 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -421,6 +421,7 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( pDateTime->ShowMonthCalendar(FALSE); } } + CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) @@ -435,17 +436,22 @@ CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( m_pForm(nullptr) { m_rtBtn.Set(0, 0, 0, 0); } + CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} + FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_DateTimePicker; return FWL_Error::Succeeded; } -uint32_t CFWL_DateTimePickerImp::GetClassID() const { - return FWL_CLASSHASH_DateTimePicker; + +FWL_Type CFWL_DateTimePickerImp::GetClassID() const { + return FWL_Type::DateTimePicker; } + 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; @@ -469,6 +475,7 @@ FWL_Error CFWL_DateTimePickerImp::Initialize() { RegisterEventTarget(m_pEdit.get()); return FWL_Error::Succeeded; } + FWL_Error CFWL_DateTimePickerImp::Finalize() { if (m_pEdit) { m_pEdit->Finalize(); diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h index 3fd86bed05..8490324d9d 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h @@ -106,42 +106,45 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { public: CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_DateTimePickerImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_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; + ~CFWL_DateTimePickerImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error 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; + + 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; public: - virtual FX_BOOL CanUndo(); - virtual FX_BOOL CanRedo(); - virtual FX_BOOL Undo(); - virtual FX_BOOL Redo(); - virtual FX_BOOL CanCopy(); - virtual FX_BOOL CanCut(); - virtual FX_BOOL CanSelectAll(); - virtual FX_BOOL Copy(CFX_WideString& wsCopy); - virtual FX_BOOL Cut(CFX_WideString& wsCut); - virtual FX_BOOL Paste(const CFX_WideString& wsPaste); - virtual FX_BOOL SelectAll(); - virtual FX_BOOL Delete(); - virtual FX_BOOL DeSelect(); - virtual FWL_Error GetBBox(CFX_RectF& rect); - virtual FWL_Error SetEditLimit(int32_t nLimit); - virtual FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FX_BOOL CanUndo(); + FX_BOOL CanRedo(); + FX_BOOL Undo(); + FX_BOOL Redo(); + FX_BOOL CanCopy(); + FX_BOOL CanCut(); + FX_BOOL CanSelectAll(); + FX_BOOL Copy(CFX_WideString& wsCopy); + FX_BOOL Cut(CFX_WideString& wsCut); + FX_BOOL Paste(const CFX_WideString& wsPaste); + FX_BOOL SelectAll(); + FX_BOOL Delete(); + FX_BOOL DeSelect(); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); public: IFWL_DateTimeEdit* GetDataTimeEdit(); diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 563519a475..e47fb1b739 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -222,6 +222,7 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, m_rtEngine.Reset(); m_rtStatic.Reset(); } + CFWL_EditImp::~CFWL_EditImp() { if (m_pEdtEngine) { m_pEdtEngine->Release(); @@ -229,25 +230,29 @@ CFWL_EditImp::~CFWL_EditImp() { } ClearRecord(); } + FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Edit; return FWL_Error::Succeeded; } -uint32_t CFWL_EditImp::GetClassID() const { - return FWL_CLASSHASH_Edit; + +FWL_Type CFWL_EditImp::GetClassID() const { + return FWL_Type::Edit; } + FWL_Error CFWL_EditImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; - if (!m_pDelegate) { + if (!m_pDelegate) m_pDelegate = new CFWL_EditImpDelegate(this); - } + InitCaret(); - if (!m_pEdtEngine) { + if (!m_pEdtEngine) InitEngine(); - } + return FWL_Error::Succeeded; } + FWL_Error CFWL_EditImp::Finalize() { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { ShowCaret(FALSE); @@ -1507,7 +1512,7 @@ void CFWL_EditImp::Layout() { m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); } - } else if (m_pOuter->GetClassID() == FWL_CLASSHASH_DateTimePicker) { + } else if (m_pOuter->GetClassID() == FWL_Type::DateTimePicker) { CFWL_ThemePart part; part.m_pWidget = m_pOuter; CFX_RectF* pUIMargin = diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h index 96e56d0c33..168726da1e 100644 --- a/xfa/fwl/basewidget/fwl_editimp.h +++ b/xfa/fwl/basewidget/fwl_editimp.h @@ -31,7 +31,7 @@ class CFWL_EditImp : public CFWL_WidgetImp { // CFWL_WidgetImp: FWL_Error GetClassName(CFX_WideString& wsClass) const override; - uint32_t GetClassID() const override; + FWL_Type GetClassID() const override; FWL_Error Initialize() override; FWL_Error Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp index 1e70da64ad..2b76078e0c 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp +++ b/xfa/fwl/basewidget/fwl_formproxyimp.cpp @@ -13,14 +13,18 @@ CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_FormImp(properties, pOuter) {} + CFWL_FormProxyImp::~CFWL_FormProxyImp() {} + FWL_Error CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_FormProxy; return FWL_Error::Succeeded; } -uint32_t CFWL_FormProxyImp::GetClassID() const { - return FWL_CLASSHASH_FormProxy; + +FWL_Type CFWL_FormProxyImp::GetClassID() const { + return FWL_Type::FormProxy; } + FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { return TRUE; diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.h b/xfa/fwl/basewidget/fwl_formproxyimp.h index 1fbff200ba..56c868e513 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.h +++ b/xfa/fwl/basewidget/fwl_formproxyimp.h @@ -17,19 +17,22 @@ class CFWL_FormProxyImp : public CFWL_FormImp { public: CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_FormProxyImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - virtual FWL_Error Update(); - virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + ~CFWL_FormProxyImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const 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; protected: friend class CFWL_FormProxyImpDelegate; }; + class CFWL_FormProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner); diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index e585a17d7d..9b05a7fee4 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -76,20 +76,26 @@ CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, m_rtConent.Reset(); m_rtStatic.Reset(); } + CFWL_ListBoxImp::~CFWL_ListBoxImp() {} + FWL_Error CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ListBox; return FWL_Error::Succeeded; } -uint32_t CFWL_ListBoxImp::GetClassID() const { - return FWL_CLASSHASH_ListBox; + +FWL_Type CFWL_ListBoxImp::GetClassID() const { + return FWL_Type::ListBox; } + FWL_Error CFWL_ListBoxImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ListBoxImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_ListBoxImp::Finalize() { if (m_pVertScrollBar) { m_pVertScrollBar->Finalize(); diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h index 0d938fe778..f32dece8dc 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.h +++ b/xfa/fwl/basewidget/fwl_listboximp.h @@ -24,25 +24,31 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { public: CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_ListBoxImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_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_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); + ~CFWL_ListBoxImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error 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; + + int32_t CountSelItems(); + FWL_HLISTITEM GetSelItem(int32_t nIndexSel); + int32_t GetSelIndex(int32_t nIndex); + 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); + FWL_Error* Sort(IFWL_ListBoxCompare* pCom); protected: + friend class CFWL_ListBoxImpDelegate; + FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); void SetSelection(FWL_HLISTITEM hStart, FWL_HLISTITEM hEnd, @@ -84,7 +90,6 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FX_BOOL IsShowScrollBar(FX_BOOL bVert); void ProcessSelChanged(); - protected: CFX_RectF m_rtClient; CFX_RectF m_rtStatic; CFX_RectF m_rtConent; @@ -97,7 +102,6 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FX_FLOAT m_fScorllBarWidth; FX_BOOL m_bLButtonDown; IFWL_ThemeProvider* m_pScrollBarTP; - friend class CFWL_ListBoxImpDelegate; }; class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { public: diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 2d495d1fd5..e8672e67dc 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -175,24 +175,30 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp( m_bInit = FALSE; m_iMaxSel = 1; } + CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() { ClearDateItem(); delete m_pDateTime; m_arrSelDays.RemoveAll(); } + FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_MonthCalendar; return FWL_Error::Succeeded; } -uint32_t CFWL_MonthCalendarImp::GetClassID() const { - return FWL_CLASSHASH_MonthCalendar; + +FWL_Type CFWL_MonthCalendarImp::GetClassID() const { + return FWL_Type::MonthCalendar; } + FWL_Error CFWL_MonthCalendarImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_MonthCalendarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index d1096b40ce..e44a17a1d3 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -9,6 +9,7 @@ #include "xfa/fgas/localization/fgas_datetime.h" #include "xfa/fwl/core/fwl_widgetimp.h" +#include "xfa/fwl/core/ifwl_widget.h" class CFWL_MonthCalendarImpDelegate; class CFWL_MsgMouse; @@ -23,21 +24,23 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { public: CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_MonthCalendarImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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, - int32_t& iDay, - int32_t nIndex = 0); - virtual FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); + ~CFWL_MonthCalendarImp() override; + + // FWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + int32_t CountSelect(); + FX_BOOL GetSelect(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay, + int32_t nIndex = 0); + FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); protected: struct DATE { diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp index c2cd09d342..a84cc8c5e8 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp +++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp @@ -34,20 +34,26 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp( m_rtImage.Reset(); m_matrix.SetIdentity(); } + CFWL_PictureBoxImp::~CFWL_PictureBoxImp() {} + FWL_Error CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PictureBox; return FWL_Error::Succeeded; } -uint32_t CFWL_PictureBoxImp::GetClassID() const { - return FWL_CLASSHASH_PictureBox; + +FWL_Type CFWL_PictureBoxImp::GetClassID() const { + return FWL_Type::PictureBox; } + FWL_Error CFWL_PictureBoxImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_PictureBoxImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_PictureBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.h b/xfa/fwl/basewidget/fwl_pictureboximp.h index d6f0ccc935..9fa065216a 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.h +++ b/xfa/fwl/basewidget/fwl_pictureboximp.h @@ -8,6 +8,7 @@ #define XFA_FWL_BASEWIDGET_FWL_PICTUREBOXIMP_H_ #include "xfa/fwl/core/fwl_widgetimp.h" +#include "xfa/fwl/core/ifwl_widget.h" class CFWL_WidgetImpProperties; class IFWL_Widget; @@ -17,20 +18,25 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { public: CFWL_PictureBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_PictureBoxImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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); + ~CFWL_PictureBoxImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; protected: + friend class CFWL_PictureBoxImpDelegate; + void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = NULL); + FX_BOOL VStyle(FX_BOOL dwStyle); CFX_RectF m_rtClient; CFX_RectF m_rtImage; @@ -38,7 +44,6 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { FX_BOOL m_bTop; FX_BOOL m_bVCenter; FX_BOOL m_bButton; - friend class CFWL_PictureBoxImpDelegate; }; class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate { diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 3b18ad0fa0..77c93f4537 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -38,20 +38,26 @@ CFWL_PushButtonImp::CFWL_PushButtonImp( m_rtClient.Set(0, 0, 0, 0); m_rtCaption.Set(0, 0, 0, 0); } + CFWL_PushButtonImp::~CFWL_PushButtonImp() {} + FWL_Error CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PushButton; return FWL_Error::Succeeded; } -uint32_t CFWL_PushButtonImp::GetClassID() const { - return FWL_CLASSHASH_PushButton; + +FWL_Type CFWL_PushButtonImp::GetClassID() const { + return FWL_Type::PushButton; } + FWL_Error CFWL_PushButtonImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_PushButtonImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_PushButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/basewidget/fwl_pushbuttonimp.h index 89913be6c1..79a4859cc9 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.h @@ -8,6 +8,7 @@ #define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ #include "xfa/fwl/core/fwl_widgetimp.h" +#include "xfa/fwl/core/ifwl_widget.h" class CFWL_MsgMouse; class CFWL_WidgetImpProperties; @@ -18,18 +19,22 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { public: CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_PushButtonImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error Update(); - virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + ~CFWL_PushButtonImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; protected: + friend class CFWL_PushButtonImpDelegate; + void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); @@ -38,12 +43,12 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { const CFX_Matrix* pMatrix); uint32_t GetPartStates(); void UpdateTextOutStyles(); + CFX_RectF m_rtClient; CFX_RectF m_rtCaption; FX_BOOL m_bBtnDown; uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; - friend class CFWL_PushButtonImpDelegate; }; class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index b03846da91..17f98059be 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -98,20 +98,26 @@ CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, m_rtMinTrack.Reset(); m_rtMaxTrack.Reset(); } + CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {} + FWL_Error CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ScrollBar; return FWL_Error::Succeeded; } -uint32_t CFWL_ScrollBarImp::GetClassID() const { - return FWL_CLASSHASH_ScrollBar; + +FWL_Type CFWL_ScrollBarImp::GetClassID() const { + return FWL_Type::ScrollBar; } + FWL_Error CFWL_ScrollBarImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ScrollBarImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_ScrollBarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/basewidget/fwl_scrollbarimp.h index 6cee702f5c..ad10e207db 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.h +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.h @@ -9,6 +9,7 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_timer.h" +#include "xfa/fwl/core/ifwl_widget.h" class CFWL_WidgetImpProperties; class IFWL_Widget; @@ -18,31 +19,38 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { public: CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_ScrollBarImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - virtual FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); - virtual FX_FLOAT GetPageSize(); - virtual FWL_Error SetPageSize(FX_FLOAT fPageSize); - virtual FX_FLOAT GetStepSize(); - virtual FWL_Error SetStepSize(FX_FLOAT fStepSize); - virtual FX_FLOAT GetPos(); - virtual FWL_Error SetPos(FX_FLOAT fPos); - virtual FX_FLOAT GetTrackPos(); - virtual FWL_Error SetTrackPos(FX_FLOAT fTrackPos); - virtual FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); - virtual FWL_Error SetOuter(IFWL_Widget* pOuter); - virtual int32_t Run(FWL_HTIMER hTimer); + ~CFWL_ScrollBarImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + + // IFWL_Timer + int32_t Run(FWL_HTIMER hTimer) override; + + FX_BOOL IsVertical(); + FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + FX_FLOAT GetPageSize(); + FWL_Error SetPageSize(FX_FLOAT fPageSize); + FX_FLOAT GetStepSize(); + FWL_Error SetStepSize(FX_FLOAT fStepSize); + FX_FLOAT GetPos(); + FWL_Error SetPos(FX_FLOAT fPos); + FX_FLOAT GetTrackPos(); + FWL_Error SetTrackPos(FX_FLOAT fTrackPos); + FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); + FWL_Error SetOuter(IFWL_Widget* pOuter); protected: + friend class CFWL_ScrollBarImpDelegate; + void DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, FX_BOOL bLower = TRUE, @@ -96,8 +104,8 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { CFX_RectF m_rtMaxTrack; FX_BOOL m_bCustomLayout; FX_FLOAT m_fMinThumb; - friend class CFWL_ScrollBarImpDelegate; }; + class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 27b84bae92..25c8a35983 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -58,20 +58,26 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp( m_rtDnButton.Reset(); m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; } + CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {} + FWL_Error CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_SpinButton; return FWL_Error::Succeeded; } -uint32_t CFWL_SpinButtonImp::GetClassID() const { - return FWL_CLASSHASH_SpinButton; + +FWL_Type CFWL_SpinButtonImp::GetClassID() const { + return FWL_Type::SpinButton; } + FWL_Error CFWL_SpinButtonImp::Initialize() { if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_SpinButtonImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_SpinButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h index aa963c9da4..068fbd888f 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h @@ -19,27 +19,35 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { public: CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - ~CFWL_SpinButtonImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - virtual int32_t Run(FWL_HTIMER hTimer); + ~CFWL_SpinButtonImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + + // IFWL_Timer + int32_t Run(FWL_HTIMER hTimer) override; + FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); protected: + friend class CFWL_SpinButtonImpDelegate; + void DrawUpButton(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); void DrawDownButton(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); + CFX_RectF m_rtClient; CFX_RectF m_rtUpButton; CFX_RectF m_rtDnButton; @@ -48,7 +56,6 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { int32_t m_iButtonIndex; FX_BOOL m_bLButtonDwn; FWL_HTIMER m_hTimer; - friend class CFWL_SpinButtonImpDelegate; }; class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { public: diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp index f1878edee8..9ac9c31160 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp @@ -57,27 +57,33 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, m_TimerShow.m_pToolTip = this; m_TimerHide.m_pToolTip = this; } + CFWL_ToolTipImp::~CFWL_ToolTipImp() { if (m_pTimer) { delete m_pTimer; m_pTimer = NULL; } } + FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ToolTip; return FWL_Error::Succeeded; } -uint32_t CFWL_ToolTipImp::GetClassID() const { - return FWL_CLASSHASH_ToolTip; + +FWL_Type CFWL_ToolTipImp::GetClassID() const { + return FWL_Type::ToolTip; } + FWL_Error CFWL_ToolTipImp::Initialize() { m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ToolTipImpDelegate(this); return FWL_Error::Succeeded; } + FWL_Error CFWL_ToolTipImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h index 16ff424c7c..6d7af8dc89 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h @@ -19,38 +19,48 @@ class CFWL_ToolTipImp : public CFWL_FormImp { public: CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_ToolTipImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - 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_Error GetClientRect(CFX_RectF& rect); + ~CFWL_ToolTipImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + void SetStates(uint32_t dwStates, FX_BOOL bSet) override; + FWL_Error GetClientRect(CFX_RectF& rect) override; + void SetAnchor(const CFX_RectF& rtAnchor); void Show(); void Hide(); protected: - void DrawBkground(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix); - void DrawText(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix); - void UpdateTextOutStyles(); - void RefreshToolTipPos(); + friend class CFWL_ToolTipImpDelegate; + friend class CFWL_ToolTipTimer; + class CFWL_ToolTipTimer : public IFWL_Timer { public: CFWL_ToolTipTimer() {} ~CFWL_ToolTipTimer() {} + CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip); virtual int32_t Run(FWL_HTIMER hTimer); + CFWL_ToolTipImp* m_pToolTip; }; + + void DrawBkground(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix); + void DrawText(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix); + void UpdateTextOutStyles(); + void RefreshToolTipPos(); + CFX_RectF m_rtClient; CFX_RectF m_rtCaption; FX_BOOL m_bBtnDown; @@ -62,9 +72,8 @@ class CFWL_ToolTipImp : public CFWL_FormImp { CFWL_ToolTipTimer* m_pTimer; CFWL_ToolTipTimer m_TimerShow; CFWL_ToolTipTimer m_TimerHide; - friend class CFWL_ToolTipImpDelegate; - friend class CFWL_ToolTipTimer; }; + class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); diff --git a/xfa/fwl/basewidget/ifwl_barcode.h b/xfa/fwl/basewidget/ifwl_barcode.h index 6cc4c59112..13652009eb 100644 --- a/xfa/fwl/basewidget/ifwl_barcode.h +++ b/xfa/fwl/basewidget/ifwl_barcode.h @@ -13,7 +13,6 @@ class CFWL_WidgetImpProperties; #define FWL_CLASS_Barcode L"FWL_BARCODE" -#define FWL_CLASSHASH_Barcode 366886968 enum FWL_BCDAttribute { FWL_BCDATTRIBUTE_NONE = 0, diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h index c7481bdb3c..8648ca0a4b 100644 --- a/xfa/fwl/basewidget/ifwl_caret.h +++ b/xfa/fwl/basewidget/ifwl_caret.h @@ -11,7 +11,6 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_Caret L"FWL_CARET" -#define FWL_CLASSHASH_Caret 671181879 #define FWL_STATE_CAT_HightLight 1 class IFWL_Caret : public IFWL_Widget { diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 83c0dd4724..26b82443fa 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_CheckBox L"FWL_CHECKBOX" -#define FWL_CLASSHASH_CheckBox 4107183823 #define FWL_STYLEEXT_CKB_Left (0L << 0) #define FWL_STYLEEXT_CKB_Center (1L << 0) #define FWL_STYLEEXT_CKB_Right (2L << 0) diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index 92e213f9d0..916e60b5bb 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -14,7 +14,6 @@ class CFWL_WidgetImpProperties; class IFWL_ComboBox; #define FWL_CLASS_ComboBox L"FWL_COMBOBOX" -#define FWL_CLASSHASH_ComboBox 602353697 #define FWL_STYLEEXT_CMB_DropList (0L << 0) #define FWL_STYLEEXT_CMB_DropDown (1L << 0) #define FWL_STYLEEXT_CMB_Sort (1L << 1) diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index 446f988fd3..7aba68b5a0 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER" -#define FWL_CLASSHASH_DateTimePicker 3851176257 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index 87f55d7d1e..6260ce80b6 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -14,7 +14,6 @@ #include "xfa/fwl/lightwidget/cfwl_widget.h" #define FWL_CLASS_Edit L"FWL_EDIT" -#define FWL_CLASSHASH_Edit 2893987822 #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) #define FWL_STYLEEXT_EDT_MultiLine (1L << 1) #define FWL_STYLEEXT_EDT_WantReturn (1L << 2) diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index 8b1e20b28f..9782cbbc29 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_ListBox L"FWL_LISTBOX" -#define FWL_CLASSHASH_ListBox 1777358317 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h index 38e06f265b..027d25b426 100644 --- a/xfa/fwl/basewidget/ifwl_monthcalendar.h +++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR" -#define FWL_CLASSHASH_MonthCalendar 2733931374 #define FWL_STYLEEXT_MCD_MultiSelect (1L << 0) #define FWL_STYLEEXT_MCD_NoToday (1L << 1) #define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2) diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/basewidget/ifwl_picturebox.h index d039a8a1b2..8ff4981e11 100644 --- a/xfa/fwl/basewidget/ifwl_picturebox.h +++ b/xfa/fwl/basewidget/ifwl_picturebox.h @@ -14,7 +14,6 @@ #include "xfa/fwl/core/fwl_error.h" #define FWL_CLASS_PictureBox L"FWL_PICTUREBOX" -#define FWL_CLASSHASH_PictureBox 2974721741 #define FWL_STYLEEXT_PTB_Left 0L << 0 #define FWL_STYLEEXT_PTB_Center 1L << 0 #define FWL_STYLEEXT_PTB_Right 2L << 0 diff --git a/xfa/fwl/basewidget/ifwl_pushbutton.h b/xfa/fwl/basewidget/ifwl_pushbutton.h index 32e1e17215..aa8392d9db 100644 --- a/xfa/fwl/basewidget/ifwl_pushbutton.h +++ b/xfa/fwl/basewidget/ifwl_pushbutton.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/ifwl_widget.h" #define FWL_CLASS_PushButton L"FWL_PUSHBUTTON" -#define FWL_CLASSHASH_PushButton 3521614244 #define FWL_STYLEEXT_PSB_Left (0L << 0) #define FWL_STYLEEXT_PSB_Center (1L << 0) #define FWL_STYLEEXT_PSB_Right (2L << 0) diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h index 176b997a3d..bc5c722ca9 100644 --- a/xfa/fwl/basewidget/ifwl_scrollbar.h +++ b/xfa/fwl/basewidget/ifwl_scrollbar.h @@ -15,7 +15,6 @@ #include "xfa/fwl/core/fwl_error.h" #define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR" -#define FWL_CLASSHASH_ScrollBar 2826584844 #define FWL_STYLEEXT_SCB_Horz (0L << 0) #define FWL_STYLEEXT_SCB_Vert (1L << 0) diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 5f032d9e7e..0b433d407a 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -10,7 +10,6 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #define FWL_CLASS_SpinButton L"FWL_SPINBUTTON" -#define FWL_CLASSHASH_SpinButton 3793043646 #define FWL_STYLEEXE_SPB_Vert (1L << 0) BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click) diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h index 1a4280fccf..5b8dff1b3b 100644 --- a/xfa/fwl/basewidget/ifwl_tooltip.h +++ b/xfa/fwl/basewidget/ifwl_tooltip.h @@ -13,7 +13,6 @@ class CFWL_WidgetImpProperties; class IFWL_ToolTip; #define FWL_CLASS_ToolTip L"FWL_TOOLTIP" -#define FWL_CLASSHASH_ToolTip 1111984755 #define FWL_STYLEEXT_TTP_Rectangle (0L << 3) #define FWL_STYLEEXT_TTP_RoundCorner (1L << 3) #define FWL_STYLEEXT_TTP_Balloon (1L << 4) diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 202a092395..bcaba2c153 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -104,8 +104,8 @@ FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { return FWL_Error::Succeeded; } -uint32_t CFWL_FormImp::GetClassID() const { - return FWL_CLASSHASH_Form; +FWL_Type CFWL_FormImp::GetClassID() const { + return FWL_Type::Form; } FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index f1bc51df37..9d2d394d03 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -68,27 +68,29 @@ typedef struct RestoreResizeInfo { class CFWL_FormImp : public CFWL_WidgetImp { public: CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual ~CFWL_FormImp(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; - virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - - virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_Error GetClientRect(CFX_RectF& rect); - virtual FWL_Error Update(); - virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - virtual FWL_FORMSIZE GetFormSize(); - virtual FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); - virtual IFWL_Widget* DoModal(); - virtual IFWL_Widget* DoModal(uint32_t& dwCommandID); - virtual FWL_Error EndDoModal(); - virtual FWL_Error SetBorderRegion(CFX_Path* pPath); - virtual void DrawBackground(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme); + ~CFWL_FormImp() override; + + // CFWL_WidgetImp + FWL_Error GetClassName(CFX_WideString& wsClass) const override; + FWL_Type GetClassID() const override; + FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetClientRect(CFX_RectF& rect) override; + FWL_Error 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_FORMSIZE GetFormSize(); + FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); + IFWL_Widget* DoModal(); + IFWL_Widget* DoModal(uint32_t& dwCommandID); + FWL_Error EndDoModal(); + FWL_Error SetBorderRegion(CFX_Path* pPath); + void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); CFWL_WidgetImp* GetSubFocus(); void SetSubFocus(CFWL_WidgetImp* pWidget); diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 560dc3c535..5cb66efed6 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -426,7 +426,8 @@ FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, pMsg->m_pSrcTarget->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) { return FALSE; } - if (pMsg->m_pSrcTarget && pMsg->m_pSrcTarget->GetClassID() == 1111984755) { + if (pMsg->m_pSrcTarget && + pMsg->m_pSrcTarget->GetClassID() == FWL_Type::ToolTip) { return FALSE; } return TRUE; @@ -616,10 +617,10 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); msLeave.m_dwFlags = 0; msLeave.m_dwCmd = FWL_MouseCommand::Leave; - DispatchMessage(&msLeave, NULL); + DispatchMessage(&msLeave, nullptr); } - if (pTarget->GetClassID() == FWL_CLASSHASH_Form) { - m_pHover = NULL; + if (pTarget->GetClassID() == FWL_Type::Form) { + m_pHover = nullptr; return; } m_pHover = pTarget; @@ -629,7 +630,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { msHover.m_fy = pMsg->m_fy; msHover.m_dwFlags = 0; msHover.m_dwCmd = FWL_MouseCommand::Hover; - DispatchMessage(&msHover, NULL); + DispatchMessage(&msHover, nullptr); } FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { if (pMessage->GetClassID() == CFWL_MessageType::Post) diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index f45a66cc2d..e72a7f385a 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -23,7 +23,6 @@ #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fxfa/include/xfa_ffapp.h" -#define FWL_CLASSHASH_Menu 3957949655 #define FWL_STYLEEXT_MNU_Vert (1L << 0) IFWL_Widget::~IFWL_Widget() {} @@ -32,7 +31,7 @@ FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { return m_pImpl->GetClassName(wsClass); } -uint32_t IFWL_Widget::GetClassID() const { +FWL_Type IFWL_Widget::GetClassID() const { return m_pImpl->GetClassID(); } @@ -191,10 +190,6 @@ FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { return FWL_Error::Succeeded; } -uint32_t CFWL_WidgetImp::GetClassID() const { - return 0; -} - FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { return FALSE; } @@ -709,30 +704,26 @@ void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { static_cast(pApp->GetNoteDriver()); pDriver->SetGrab(m_pInterface, bSet); } + FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { - if (GetClassID() == FWL_CLASSHASH_Menu) { - return GetPopupPosMenu(fMinHeight, fMaxHeight, rtAnchor, rtPopup); - } else { - if (GetClassID() == FWL_CLASSHASH_ComboBox) { - if (m_pWidgetMgr->IsFormDisabled()) { - return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, - fMaxHeight, rtAnchor, rtPopup); - } else { - return GetPopupPosComboBox(fMinHeight, fMaxHeight, rtAnchor, rtPopup); - } - } else if (GetClassID() == FWL_CLASSHASH_DateTimePicker && - m_pWidgetMgr->IsFormDisabled()) { + if (GetClassID() == FWL_Type::ComboBox) { + if (m_pWidgetMgr->IsFormDisabled()) { return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, fMaxHeight, rtAnchor, rtPopup); - } else { - return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); } + return GetPopupPosComboBox(fMinHeight, fMaxHeight, rtAnchor, rtPopup); } - return FALSE; + if (GetClassID() == FWL_Type::DateTimePicker && + m_pWidgetMgr->IsFormDisabled()) { + return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, + fMaxHeight, rtAnchor, rtPopup); + } + return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); } + FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index 4af2872f41..1b1ccc4b74 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -23,6 +23,7 @@ class IFWL_App; class IFWL_DataProvider; class IFWL_ThemeProvider; class IFWL_Widget; +enum class FWL_Type; class CFWL_WidgetImp { public: @@ -31,7 +32,7 @@ class CFWL_WidgetImp { virtual FWL_Error Initialize(); virtual FWL_Error Finalize(); virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; - virtual uint32_t GetClassID() const; + virtual FWL_Type GetClassID() const = 0; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index 28500c2cb2..f4ceb78c48 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -461,25 +461,13 @@ IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { int32_t iRet = 0; IFWL_Widget* pChild = pFirst; - while (pChild) { - if ((pChild->GetStyles() & FWL_WGTSTYLE_Group) && - pChild->GetClassID() == 3811304691) { - iRet++; - } + while (pChild) pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); - } return iRet; } IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext) { - while ((pWidget = GetWidget(pWidget, bNext ? FWL_WGTRELATION_NextSibling - : FWL_WGTRELATION_PriorSibling)) != - NULL) { - if (pWidget->GetClassID() == 3811304691) { - return pWidget; - } - } - return NULL; + return nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( IFWL_Widget* pRadioButton) { @@ -493,10 +481,6 @@ IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( } } pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling); - if ((pNext->GetStyles() & FWL_WGTSTYLE_Group) && - pNext->GetClassID() == 3811304691) { - return pNext; - } while ((pNext = GetSiblingRadioButton(pNext, FALSE)) && pNext && pNext != pRadioButton) { if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { @@ -504,10 +488,6 @@ IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( } } pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); - if (pNext && (pNext->GetStyles() == FWL_WGTSTYLE_Group) && - pNext->GetClassID() == 3811304691) { - return pNext; - } return GetSiblingRadioButton(pNext, TRUE); } void CFWL_WidgetMgr::GetSameGroupRadioButton( @@ -519,9 +499,6 @@ void CFWL_WidgetMgr::GetSameGroupRadioButton( } int32_t iGroup = CountRadioButtonGroup(pFirst); if (iGroup < 2) { - if (pFirst->GetClassID() == 3811304691) { - group.Add(pFirst); - } IFWL_Widget* pNext = pFirst; while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { group.Add(pNext); @@ -532,24 +509,19 @@ void CFWL_WidgetMgr::GetSameGroupRadioButton( do { group.Add(pNext); pNext = GetSiblingRadioButton(pNext, TRUE); - if (!pNext) { - if (pFirst->GetClassID() == 3811304691) { - pNext = pFirst; - } else { - pNext = GetSiblingRadioButton(pFirst, TRUE); - } - } + if (!pNext) + pNext = GetSiblingRadioButton(pFirst, TRUE); } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); } IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { - if ((pParent->GetClassID() == 3521614244) && + if ((pParent->GetClassID() == FWL_Type::PushButton) && (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { return pParent; } IFWL_Widget* child = FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); while (child) { - if ((child->GetClassID() == 3521614244) && + if ((child->GetClassID() == FWL_Type::PushButton) && (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { return child; } @@ -831,16 +803,7 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); if (!pChild) return TRUE; - if (pChild->GetClassID() == 3150298670) { - CFX_RectF rtTemp; - pChild->GetWidgetRect(rtTemp); - if (rtTemp.width >= rtWidget.width && rtTemp.height >= rtWidget.height) { - pChild = - FWL_GetWidgetMgr()->GetWidget(pChild, FWL_WGTRELATION_FirstChild); - if (!pChild) - return TRUE; - } - } + CFX_RectF rtChilds; rtChilds.Empty(); FX_BOOL bChildIntersectWithDirty = FALSE; diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 22d6ecea12..75bec50d8e 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -13,9 +13,7 @@ #include "xfa/fwl/core/cfwl_widgetimpproperties.h" #define FWL_CLASS_Form L"FWL_FORM" -#define FWL_CLASSHASH_Form 881567292 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" -#define FWL_CLASSHASH_FormProxy 881567291 #define FWL_STYLEEXT_FRM_Resize (1L << 0) #define FWL_STYLEEXT_FRM_NativeBorder (1L << 1) #define FWL_STYLEEXT_FRM_RoundCorner (2L << 1) diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index 66e7e0c4fd..274b27958a 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -20,7 +20,7 @@ class IFWL_Widget; class IFWL_ThemeProvider { public: virtual ~IFWL_ThemeProvider() {} - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget) = 0; + virtual bool IsValidWidget(IFWL_Widget* pWidget) = 0; virtual uint32_t GetThemeID(IFWL_Widget* pWidget) = 0; virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 691e4606c5..8bbf8da469 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -26,6 +26,26 @@ // CFWL_... IFWL_... CFWL_...Imp // +enum class FWL_Type { + Unknown = 0, + + Barcode, + Caret, + CheckBox, + ComboBox, + DateTimePicker, + Edit, + Form, + FormProxy, + ListBox, + MonthCalendar, + PictureBox, + PushButton, + ScrollBar, + SpinButton, + ToolTip +}; + class CFWL_WidgetImp; class CFX_Graphics; class IFWL_App; @@ -79,7 +99,7 @@ class IFWL_Widget { // These call into equivalent polymorphic methods of m_pImpl. There // should be no need to override these in subclasses. FWL_Error GetClassName(CFX_WideString& wsClass) const; - uint32_t GetClassID() const; + FWL_Type GetClassID() const; FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; FWL_Error Initialize(); FWL_Error Finalize(); diff --git a/xfa/fwl/lightwidget/cfwl_theme.cpp b/xfa/fwl/lightwidget/cfwl_theme.cpp index 594dbd84a4..a070e046c1 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.cpp +++ b/xfa/fwl/lightwidget/cfwl_theme.cpp @@ -45,7 +45,7 @@ CFWL_Theme::CFWL_Theme() { CFWL_Theme::~CFWL_Theme() {} -FX_BOOL CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) { +bool CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) { return !!GetTheme(pWidget); } diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h index ba20013c10..1de1fb607c 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ b/xfa/fwl/lightwidget/cfwl_theme.h @@ -26,7 +26,7 @@ class CFWL_Theme : public IFWL_ThemeProvider { ~CFWL_Theme() override; // IFWL_ThemeProvider: - FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t GetThemeID(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp index e1959797b3..8d3237605f 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.cpp +++ b/xfa/fwl/lightwidget/cfwl_widget.cpp @@ -29,9 +29,9 @@ FWL_Error CFWL_Widget::GetClassName(CFX_WideString& wsClass) const { return m_pIface->GetClassName(wsClass); } -uint32_t CFWL_Widget::GetClassID() const { +FWL_Type CFWL_Widget::GetClassID() const { if (!m_pIface) - return 0; + return FWL_Type::Unknown; return m_pIface->GetClassID(); } diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h index fd30b71b4c..1c29b1f58e 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.h +++ b/xfa/fwl/lightwidget/cfwl_widget.h @@ -20,9 +20,10 @@ class CFWL_WidgetMgr; class CFWL_Widget { public: virtual ~CFWL_Widget(); + IFWL_Widget* GetWidget(); FWL_Error GetClassName(CFX_WideString& wsClass) const; - uint32_t GetClassID() const; + FWL_Type GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp index bdcd89e9dd..609add6c0e 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.cpp +++ b/xfa/fwl/theme/cfwl_barcodetp.cpp @@ -14,10 +14,8 @@ CFWL_BarcodeTP::CFWL_BarcodeTP() {} CFWL_BarcodeTP::~CFWL_BarcodeTP() {} -FX_BOOL CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Barcode; +bool CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::Barcode; } FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { diff --git a/xfa/fwl/theme/cfwl_barcodetp.h b/xfa/fwl/theme/cfwl_barcodetp.h index 0a03f49805..6db7f15623 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.h +++ b/xfa/fwl/theme/cfwl_barcodetp.h @@ -13,9 +13,11 @@ class CFWL_BarcodeTP : public CFWL_WidgetTP { public: CFWL_BarcodeTP(); - virtual ~CFWL_BarcodeTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + ~CFWL_BarcodeTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; }; #endif // XFA_FWL_THEME_CFWL_BARCODETP_H_ diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index 39ba20bad7..eb73231317 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp @@ -15,11 +15,10 @@ CFWL_CaretTP::CFWL_CaretTP() {} CFWL_CaretTP::~CFWL_CaretTP() {} -FX_BOOL CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Caret; +bool CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::Caret; } + FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h index 8c56d38aa9..03b376a61e 100644 --- a/xfa/fwl/theme/cfwl_carettp.h +++ b/xfa/fwl/theme/cfwl_carettp.h @@ -12,9 +12,11 @@ class CFWL_CaretTP : public CFWL_WidgetTP { public: CFWL_CaretTP(); - virtual ~CFWL_CaretTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + ~CFWL_CaretTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; protected: void DrawCaretBK(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 78d829f8b0..9a10c60a3d 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -40,9 +40,10 @@ CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { } } -FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox; +bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox; } + uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren) { diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index f6a3b82784..a502b92926 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -13,15 +13,17 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { public: CFWL_CheckBoxTP(); - virtual ~CFWL_CheckBoxTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + ~CFWL_CheckBoxTP() override; + + // CFWL_WidgeTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FX_BOOL DrawText(CFWL_ThemeText* pParams) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: void DrawBoxBk(IFWL_Widget* pWidget, diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index b02caf8a3e..92f2296105 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -22,12 +22,13 @@ const float kComboFormHandler = 8.0f; CFWL_ComboBoxTP::CFWL_ComboBoxTP() { m_dwThemeID = 0; } + CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {} -FX_BOOL CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ComboBox; + +bool CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::ComboBox; } + FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h index 42ed55ac47..0480e60c30 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.h +++ b/xfa/fwl/theme/cfwl_comboboxtp.h @@ -12,11 +12,13 @@ class CFWL_ComboBoxTP : public CFWL_WidgetTP { public: CFWL_ComboBoxTP(); - virtual ~CFWL_ComboBoxTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity); + ~CFWL_ComboBoxTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; protected: void DrawDropDownButton(CFWL_ThemeBackground* pParams, diff --git a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp index 54ddcdeb9e..a303a4ea1f 100644 --- a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp +++ b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp @@ -13,14 +13,15 @@ CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() { m_pThemeData = new DTPThemeData; initThemeData(); } + CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() { delete m_pThemeData; } -FX_BOOL CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_DateTimePicker; + +bool CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker; } + FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h index 199551ea1f..1b8899b73e 100644 --- a/xfa/fwl/theme/cfwl_datetimepickertp.h +++ b/xfa/fwl/theme/cfwl_datetimepickertp.h @@ -12,13 +12,16 @@ class CFWL_DateTimePickerTP : public CFWL_WidgetTP { public: CFWL_DateTimePickerTP(); - virtual ~CFWL_DateTimePickerTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + ~CFWL_DateTimePickerTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; protected: void DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); void initThemeData(); + struct DTPThemeData { FX_ARGB BoxBkColor[13][2]; } * m_pThemeData; diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 644da90071..8e59a4d1f2 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -15,11 +15,10 @@ CFWL_EditTP::CFWL_EditTP() {} CFWL_EditTP::~CFWL_EditTP() {} -FX_BOOL CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Edit; +bool CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::Edit; } + FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { case CFWL_Part::Border: { diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h index 7077737d8d..22cbe778a3 100644 --- a/xfa/fwl/theme/cfwl_edittp.h +++ b/xfa/fwl/theme/cfwl_edittp.h @@ -12,11 +12,13 @@ class CFWL_EditTP : public CFWL_WidgetTP { public: CFWL_EditTP(); - virtual ~CFWL_EditTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + ~CFWL_EditTP() override; + + // CFWL_WidgeTTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; }; #endif // XFA_FWL_THEME_CFWL_EDITTP_H_ diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp index 6b876d2b40..75244373d4 100644 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ b/xfa/fwl/theme/cfwl_formtp.cpp @@ -60,12 +60,10 @@ FWL_Error CFWL_FormTP::Finalize() { return CFWL_WidgetTP::Finalize(); } -FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - uint32_t dwHash = pWidget->GetClassID(); - return dwHash == FWL_CLASSHASH_Form; +bool CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::Form; } + uint32_t CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren) { diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h index 652528e0f9..ccbc71b2c2 100644 --- a/xfa/fwl/theme/cfwl_formtp.h +++ b/xfa/fwl/theme/cfwl_formtp.h @@ -15,9 +15,10 @@ class CFWL_FormTP : public CFWL_WidgetTP { CFWL_FormTP(); ~CFWL_FormTP() override; + // CFWL_WidgetTP FWL_Error Initialize() override; FWL_Error Finalize() override; - FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) override; diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 5bab1b09e5..1d381a4280 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -13,13 +13,13 @@ #include "xfa/fxgraphics/cfx_path.h" CFWL_ListBoxTP::CFWL_ListBoxTP() {} + CFWL_ListBoxTP::~CFWL_ListBoxTP() {} -FX_BOOL CFWL_ListBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ListBox; +bool CFWL_ListBoxTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::ListBox; } + FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h index 9ae85c72e7..a13df08845 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.h +++ b/xfa/fwl/theme/cfwl_listboxtp.h @@ -12,11 +12,13 @@ class CFWL_ListBoxTP : public CFWL_WidgetTP { public: CFWL_ListBoxTP(); - virtual ~CFWL_ListBoxTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + ~CFWL_ListBoxTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: void DrawListBoxItem(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index fac318f69d..d04ebb16d2 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -53,13 +53,13 @@ CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() { m_pThemeData = new MCThemeData; SetThemeData(0); } + CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() { delete m_pThemeData; } -FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar; + +bool CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::MonthCalendar; } uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index acc4787f0f..7ecbb90cf2 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -14,7 +14,8 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { CFWL_MonthCalendarTP(); ~CFWL_MonthCalendarTP() override; - FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) override; @@ -37,6 +38,7 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { FX_BOOL DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); FWLTHEME_STATE GetState(uint32_t dwFWLStates); void SetThemeData(uint32_t dwThemeID); + class MCThemeData { public: FX_ARGB clrCaption; diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp index 69ac094be0..439082b052 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp +++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp @@ -14,14 +14,14 @@ CFWL_PictureBoxTP::CFWL_PictureBoxTP() {} CFWL_PictureBoxTP::~CFWL_PictureBoxTP() {} -FX_BOOL CFWL_PictureBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_PictureBox; +bool CFWL_PictureBoxTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::PictureBox; } + FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -32,7 +32,8 @@ FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { &pParams->m_rtPart, &pParams->m_matrix); break; } - default: {} + default: + break; } return TRUE; } diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.h b/xfa/fwl/theme/cfwl_pictureboxtp.h index 0216971a94..876e8d2042 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.h +++ b/xfa/fwl/theme/cfwl_pictureboxtp.h @@ -12,9 +12,11 @@ class CFWL_PictureBoxTP : public CFWL_WidgetTP { public: CFWL_PictureBoxTP(); - virtual ~CFWL_PictureBoxTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + ~CFWL_PictureBoxTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; }; #endif // XFA_FWL_THEME_CFWL_PICTUREBOXTP_H_ diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 103bae7aa9..17c02aef44 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -23,8 +23,8 @@ CFWL_PushButtonTP::~CFWL_PushButtonTP() { delete m_pThemeData; } -FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { - return pWidget->GetClassID() == FWL_CLASSHASH_PushButton; +bool CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::PushButton; } uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index e51ce55e78..6312cd5f29 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -14,7 +14,8 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { CFWL_PushButtonTP(); ~CFWL_PushButtonTP() override; - FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) override; diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index b1acd21969..54dfbe5531 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -27,10 +27,8 @@ CFWL_ScrollBarTP::~CFWL_ScrollBarTP() { delete m_pThemeData; } -FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ScrollBar; +bool CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { + return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar; } void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index b102ee4525..84e18193db 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -12,14 +12,16 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { public: CFWL_ScrollBarTP(); - virtual ~CFWL_ScrollBarTP(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity); + ~CFWL_ScrollBarTP() override; + + // CFWL_WidgetTP + bool IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; protected: struct SBThemeData { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index ecf338e103..fb1132beef 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -47,12 +47,15 @@ static void FWL_SetChildThemeID(IFWL_Widget* pParent, uint32_t dwThemeID) { pChild = pWidgetMgr->GetWidget(pChild, FWL_WGTRELATION_NextSibling); } } -FX_BOOL CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { + +bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { return FALSE; } + uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { return m_dwThemeID; } + uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren) { diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 633892a8ee..edb793def9 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -106,7 +106,12 @@ class CFX_FontSourceEnum_File; class CFWL_WidgetTP { public: - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); + virtual ~CFWL_WidgetTP(); + + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + + virtual bool IsValidWidget(IFWL_Widget* pWidget); virtual uint32_t GetThemeID(IFWL_Widget* pWidget); virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, @@ -124,9 +129,7 @@ class CFWL_WidgetTP { FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - virtual ~CFWL_WidgetTP(); + FWL_Error SetFont(IFWL_Widget* pWidget, const FX_WCHAR* strFont, FX_FLOAT fFontSize, diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index b07a7323b3..fac873cac9 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -109,17 +109,21 @@ FWL_Error CXFA_FWLTheme::Finalize() { FWLTHEME_Release(); return FWL_Error::Succeeded; } -FX_BOOL CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) { + +bool CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) { return TRUE; } + uint32_t CXFA_FWLTheme::GetThemeID(IFWL_Widget* pWidget) { return 0; } + uint32_t CXFA_FWLTheme::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren) { return 0; } + FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); } @@ -127,7 +131,7 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { if (pParams->m_wsText.IsEmpty()) return FALSE; - if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { + if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); if (!pWidget) return FALSE; @@ -265,7 +269,7 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, } int dwCapValue = static_cast(dwCapacity); - if (pThemePart->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar && + if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar && dwCapValue >= static_cast(CFWL_WidgetCapacity::Today) && dwCapValue <= static_cast(CFWL_WidgetCapacity::December)) { if (CXFA_FFWidget* pWidget = @@ -355,7 +359,7 @@ FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); } FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { - if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { + if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); if (!pWidget) return FALSE; @@ -392,32 +396,31 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { } CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { switch (pWidget->GetClassID()) { - case FWL_CLASSHASH_CheckBox: + case FWL_Type::CheckBox: return m_pCheckBoxTP; - case FWL_CLASSHASH_ListBox: + case FWL_Type::ListBox: return m_pListBoxTP; - case FWL_CLASSHASH_PictureBox: + case FWL_Type::PictureBox: return m_pPictureBoxTP; - case FWL_CLASSHASH_ScrollBar: + case FWL_Type::ScrollBar: return m_pSrollBarTP; - case FWL_CLASSHASH_Edit: + case FWL_Type::Edit: return m_pEditTP; - case FWL_CLASSHASH_ComboBox: + case FWL_Type::ComboBox: return m_pComboBoxTP; - case FWL_CLASSHASH_MonthCalendar: + case FWL_Type::MonthCalendar: return m_pMonthCalendarTP; - case FWL_CLASSHASH_DateTimePicker: + case FWL_Type::DateTimePicker: return m_pDateTimePickerTP; - case FWL_CLASSHASH_PushButton: + case FWL_Type::PushButton: return m_pPushButtonTP; - case FWL_CLASSHASH_Caret: + case FWL_Type::Caret: return m_pCaretTP; - case FWL_CLASSHASH_Barcode: + case FWL_Type::Barcode: return m_pBarcodeTP; default: - break; + return nullptr; } - return NULL; } CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index fa63085ba5..7d58b43c9b 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -37,7 +37,7 @@ class CXFA_FWLTheme : public IFWL_ThemeProvider { virtual uint32_t GetHashCode() const { return 0; } virtual FWL_Error Initialize(); virtual FWL_Error Finalize(); - virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); + virtual bool IsValidWidget(IFWL_Widget* pWidget); virtual uint32_t GetThemeID(IFWL_Widget* pWidget); virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, -- cgit v1.2.3