diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-05 10:28:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-05 10:28:03 -0700 |
commit | b4d40ffae3f955fab2fac838430c89aca452c45f (patch) | |
tree | 046c0a461e9dc0dc295da5839b831e4b53526541 /xfa/fwl/theme | |
parent | 439bb9e0b2f72cd1ede65b84130fe9ed573f74b0 (diff) | |
download | pdfium-b4d40ffae3f955fab2fac838430c89aca452c45f.tar.xz |
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
Diffstat (limited to 'xfa/fwl/theme')
26 files changed, 123 insertions, 98 deletions
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, |