From 73895de7dea3737d1a25801001b8efe186c6f5a3 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 20 Oct 2016 07:19:43 -0700 Subject: Cleanup unused methods and return values in FWL code. This CL does an initial pass to remove unused methods and return values in the FWL code base. Review-Url: https://chromiumcodereview.appspot.com/2435603003 --- xfa/fwl/theme/cfwl_barcodetp.cpp | 9 ++-- xfa/fwl/theme/cfwl_barcodetp.h | 2 +- xfa/fwl/theme/cfwl_carettp.cpp | 13 ++--- xfa/fwl/theme/cfwl_carettp.h | 2 +- xfa/fwl/theme/cfwl_checkboxtp.cpp | 24 +++++----- xfa/fwl/theme/cfwl_checkboxtp.h | 8 ++-- xfa/fwl/theme/cfwl_comboboxtp.cpp | 16 ++++--- xfa/fwl/theme/cfwl_comboboxtp.h | 2 +- xfa/fwl/theme/cfwl_datetimepickertp.cpp | 14 +++--- xfa/fwl/theme/cfwl_datetimepickertp.h | 2 +- xfa/fwl/theme/cfwl_edittp.cpp | 18 +++---- xfa/fwl/theme/cfwl_edittp.h | 6 +-- xfa/fwl/theme/cfwl_listboxtp.cpp | 27 ++++++----- xfa/fwl/theme/cfwl_listboxtp.h | 6 +-- xfa/fwl/theme/cfwl_monthcalendartp.cpp | 85 +++++++++++++++++---------------- xfa/fwl/theme/cfwl_monthcalendartp.h | 26 +++++----- xfa/fwl/theme/cfwl_pictureboxtp.cpp | 5 +- xfa/fwl/theme/cfwl_pictureboxtp.h | 2 +- xfa/fwl/theme/cfwl_pushbuttontp.cpp | 20 +++++--- xfa/fwl/theme/cfwl_pushbuttontp.h | 6 +-- xfa/fwl/theme/cfwl_scrollbartp.cpp | 34 ++++++++----- xfa/fwl/theme/cfwl_scrollbartp.h | 2 +- xfa/fwl/theme/cfwl_utils.h | 2 +- xfa/fwl/theme/cfwl_widgettp.cpp | 76 +++++++++++------------------ xfa/fwl/theme/cfwl_widgettp.h | 39 ++++++++------- 25 files changed, 225 insertions(+), 221 deletions(-) (limited to 'xfa/fwl/theme') diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp index c6cc79e488..a3a450ec2c 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.cpp +++ b/xfa/fwl/theme/cfwl_barcodetp.cpp @@ -18,9 +18,10 @@ bool CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::Barcode; } -FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -36,7 +37,7 @@ FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { &pParams->m_matrix); break; } - default: {} + default: + break; } - return TRUE; } diff --git a/xfa/fwl/theme/cfwl_barcodetp.h b/xfa/fwl/theme/cfwl_barcodetp.h index 6db7f15623..1eb34e705b 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.h +++ b/xfa/fwl/theme/cfwl_barcodetp.h @@ -17,7 +17,7 @@ class CFWL_BarcodeTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void 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 28d606a2f3..1297b13497 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp @@ -19,14 +19,15 @@ bool CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::Caret; } -FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Background: { - if (!(pParams->m_dwStates & CFWL_PartState_HightLight)) { - return TRUE; - } + if (!(pParams->m_dwStates & CFWL_PartState_HightLight)) + return; + DrawCaretBK(pParams->m_pGraphics, pParams->m_dwStates, &(pParams->m_rtPart), (CFX_Color*)pParams->m_pData, &(pParams->m_matrix)); @@ -35,8 +36,8 @@ FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { default: break; } - return TRUE; } + void CFWL_CaretTP::DrawCaretBK(CFX_Graphics* pGraphics, uint32_t dwStates, const CFX_RectF* pRect, diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h index faf37e725a..bc745be59d 100644 --- a/xfa/fwl/theme/cfwl_carettp.h +++ b/xfa/fwl/theme/cfwl_carettp.h @@ -16,7 +16,7 @@ class CFWL_CaretTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void 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 b3dffdccf8..da3790a1df 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -45,23 +45,24 @@ uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } -FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { +void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) - return FALSE; + return; + m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled ? FWLTHEME_CAPACITY_TextDisColor : FWLTHEME_CAPACITY_TextColor); - return CFWL_WidgetTP::DrawText(pParams); + CFWL_WidgetTP::DrawText(pParams); } -FWL_Error CFWL_CheckBoxTP::Initialize() { +void CFWL_CheckBoxTP::Initialize() { InitTTO(); - return CFWL_WidgetTP::Initialize(); + CFWL_WidgetTP::Initialize(); } -FWL_Error CFWL_CheckBoxTP::Finalize() { +void CFWL_CheckBoxTP::Finalize() { FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); + CFWL_WidgetTP::Finalize(); } void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics, @@ -322,16 +323,15 @@ void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { } } -FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (pParams->m_iPart != CFWL_Part::CheckBox) { - return FALSE; - } +void CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { + if (pParams->m_iPart != CFWL_Part::CheckBox) + return; + if ((pParams->m_dwStates & CFWL_PartState_Checked) || (pParams->m_dwStates & CFWL_PartState_Neutral)) { DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, pParams->m_rtPart, pParams->m_dwStates, &pParams->m_matrix); } - return FALSE; } void CFWL_CheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget, diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index cdc4ba1d57..37a8686170 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -18,12 +18,12 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { ~CFWL_CheckBoxTP() override; // CFWL_WidgeTP + void Initialize() override; + void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; - FX_BOOL DrawText(CFWL_ThemeText* pParams) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FWL_Error Initialize() override; - FWL_Error Finalize() override; + void DrawText(CFWL_ThemeText* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; protected: struct CKBThemeData { diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index d322a8e793..cdb892dc05 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -29,9 +29,10 @@ bool CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::ComboBox; } -FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -73,10 +74,11 @@ FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { DrawStrethHandler(pParams, 0, &pParams->m_matrix); break; } - default: { return FALSE; } + default: + break; } - return TRUE; } + void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, uint32_t dwStates, CFX_Matrix* pMatrix) { @@ -88,6 +90,7 @@ void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetFillColor(&cr); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); } + void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { if (dwCapacity == CFWL_WidgetCapacity::ComboFormHandler) { @@ -115,10 +118,11 @@ void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, break; } case CFWL_PartState_Disabled: { - eState = FWLTHEME_STATE_Disabale; + eState = FWLTHEME_STATE_Disable; break; } - default: {} + default: + break; } DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h index 0480e60c30..6c248218b9 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.h +++ b/xfa/fwl/theme/cfwl_comboboxtp.h @@ -16,7 +16,7 @@ class CFWL_ComboBoxTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp index 36738d9a59..7aeee04a5b 100644 --- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp +++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp @@ -17,9 +17,10 @@ bool CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker; } -FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -34,9 +35,9 @@ FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { DrawDropDownButton(pParams, &pParams->m_matrix); break; } - default: {} + default: + break; } - return TRUE; } void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, @@ -58,10 +59,11 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, break; } case CFWL_PartState_Disabled: { - eState = FWLTHEME_STATE_Disabale; + eState = FWLTHEME_STATE_Disable; break; } - default: {} + default: + break; } DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, eState, pMatrix); diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h index 04bd910959..d9950de9ef 100644 --- a/xfa/fwl/theme/cfwl_datetimepickertp.h +++ b/xfa/fwl/theme/cfwl_datetimepickertp.h @@ -16,7 +16,7 @@ class CFWL_DateTimePickerTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; protected: void DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index ca37f0c7e8..45d097dbfc 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -21,7 +21,7 @@ bool CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::Edit; } -FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (CFWL_Part::CombTextLine == pParams->m_iPart) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); FX_ARGB cr = 0xFF000000; @@ -37,7 +37,7 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { pParams->m_pGraphics->SetStrokeColor(&crLine); pParams->m_pGraphics->SetLineWidth(fWidth); pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); - return TRUE; + return; } switch (pParams->m_iPart) { @@ -92,15 +92,17 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); break; } - default: { break; } + default: + break; } - return TRUE; } -FWL_Error CFWL_EditTP::Initialize() { + +void CFWL_EditTP::Initialize() { InitTTO(); - return CFWL_WidgetTP::Initialize(); + CFWL_WidgetTP::Initialize(); } -FWL_Error CFWL_EditTP::Finalize() { + +void CFWL_EditTP::Finalize() { FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); + CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h index 22cbe778a3..24d2e982cd 100644 --- a/xfa/fwl/theme/cfwl_edittp.h +++ b/xfa/fwl/theme/cfwl_edittp.h @@ -15,10 +15,10 @@ class CFWL_EditTP : public CFWL_WidgetTP { ~CFWL_EditTP() override; // CFWL_WidgeTTP + void Initialize() override; + void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FWL_Error Initialize() override; - FWL_Error Finalize() override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; }; #endif // XFA_FWL_THEME_CFWL_EDITTP_H_ diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 69fc0719f8..304c3a8397 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -20,9 +20,10 @@ bool CFWL_ListBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::ListBox; } -FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -62,18 +63,21 @@ FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart, &pParams->m_matrix); } - default: {} + default: + break; } - return TRUE; } -FWL_Error CFWL_ListBoxTP::Initialize() { + +void CFWL_ListBoxTP::Initialize() { InitTTO(); - return CFWL_WidgetTP::Initialize(); + CFWL_WidgetTP::Initialize(); } -FWL_Error CFWL_ListBoxTP::Finalize() { + +void CFWL_ListBoxTP::Finalize() { FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); + CFWL_WidgetTP::Finalize(); } + void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, uint32_t dwStates, const CFX_RectF* prtItem, @@ -96,9 +100,6 @@ void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } - if (dwStates & CFWL_PartState_Focused) { - if (pData) { - DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); - } - } + if (dwStates & CFWL_PartState_Focused && pData) + DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); } diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h index 9a6c457d5d..15967bd663 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.h +++ b/xfa/fwl/theme/cfwl_listboxtp.h @@ -15,10 +15,10 @@ class CFWL_ListBoxTP : public CFWL_WidgetTP { ~CFWL_ListBoxTP() override; // CFWL_WidgetTP + void Initialize() override; + void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FWL_Error Initialize() override; - FWL_Error Finalize() override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; protected: void DrawListBoxItem(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 01d2854c2d..b554483dcd 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -66,9 +66,10 @@ uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } -FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -119,13 +120,15 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { DrawWeekNumSep(pParams, &pParams->m_matrix); break; } - default: {} + default: + break; } - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { + +void CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) - return FALSE; + return; + if ((pParams->m_iPart == CFWL_Part::DatesIn) && !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && (pParams->m_dwStates & @@ -136,8 +139,9 @@ FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { } else { m_pTextOut->SetTextColor(0xFF000000); } - return CFWL_WidgetTP::DrawText(pParams); + CFWL_WidgetTP::DrawText(pParams); } + void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { FX_BOOL bDefPro = FALSE; @@ -336,26 +340,30 @@ void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, wsResource = L"Today"; return &wsResource; } - default: { bDefPro = TRUE; } + default: + bDefPro = TRUE; + break; } if (!bDefPro) { - if (bDwordVal) { + if (bDwordVal) return &m_dwValue; - } return &m_fValue; } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -FWL_Error CFWL_MonthCalendarTP::Initialize() { + +void CFWL_MonthCalendarTP::Initialize() { InitTTO(); - return CFWL_WidgetTP::Initialize(); + CFWL_WidgetTP::Initialize(); } -FWL_Error CFWL_MonthCalendarTP::Finalize() { + +void CFWL_MonthCalendarTP::Finalize() { FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); + CFWL_WidgetTP::Finalize(); } -FX_BOOL CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { + +void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtTotal(pParams->m_rtPart); @@ -365,10 +373,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetFillColor(&clrBK); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { + +void CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtHead = pParams->m_rtPart; @@ -378,10 +386,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetFillColor(&clrHeadBK); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { + +void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtLBtn; @@ -410,10 +418,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrFlag); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { + +void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtRBtn; @@ -442,10 +450,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrFlag); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { + +void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtHSep; @@ -457,11 +465,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrHSep); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { +void CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtWeekSep; @@ -473,11 +480,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrHSep); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { +void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { pParams->m_pGraphics->SaveGraphState(); if (pParams->m_dwStates & CFWL_PartState_Selected) { CFX_Path path; @@ -501,11 +507,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } pParams->m_pGraphics->RestoreGraphState(); - return FALSE; } -FX_BOOL CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { +void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtSelDay; @@ -517,11 +522,10 @@ FX_BOOL CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrSelDayBK); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } -FX_BOOL CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { +void CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, + CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); CFX_RectF rtTodayCircle; @@ -533,7 +537,6 @@ FX_BOOL CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); - return TRUE; } FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(uint32_t dwFWLStates) { diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index b69b32c613..7feb0f337a 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -17,14 +17,14 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { ~CFWL_MonthCalendarTP() override; // CFWL_WidgetTP + void Initialize() override; + void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FX_BOOL DrawText(CFWL_ThemeText* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; + void DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; - FWL_Error Initialize() override; - FWL_Error Finalize() override; protected: struct MCThemeData { @@ -37,15 +37,15 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { FX_ARGB clrBK; }; - FX_BOOL DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); - FX_BOOL DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); + void DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); FWLTHEME_STATE GetState(uint32_t dwFWLStates); void SetThemeData(uint32_t dwThemeID); diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp index 2604156e41..98ba21fd5e 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp +++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp @@ -18,9 +18,9 @@ bool CFWL_PictureBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::PictureBox; } -FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { +void CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; switch (pParams->m_iPart) { case CFWL_Part::Border: { @@ -35,5 +35,4 @@ FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { default: break; } - return TRUE; } diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.h b/xfa/fwl/theme/cfwl_pictureboxtp.h index 876e8d2042..24f658bd11 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.h +++ b/xfa/fwl/theme/cfwl_pictureboxtp.h @@ -16,7 +16,7 @@ class CFWL_PictureBoxTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void 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 62b8ffef65..20446da54b 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -29,7 +29,8 @@ uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, SetThemeData(FWL_GetThemeColor(dwThemeID)); return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } -FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { + +void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); @@ -87,10 +88,11 @@ FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { pGraphics->RestoreGraphState(); break; } - default: {} + default: + break; } - return TRUE; } + void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { if (dwCapacity == CFWL_WidgetCapacity::Margin) { @@ -99,14 +101,17 @@ void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -FWL_Error CFWL_PushButtonTP::Initialize() { + +void CFWL_PushButtonTP::Initialize() { InitTTO(); - return CFWL_WidgetTP::Initialize(); + CFWL_WidgetTP::Initialize(); } -FWL_Error CFWL_PushButtonTP::Finalize() { + +void CFWL_PushButtonTP::Finalize() { FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); + CFWL_WidgetTP::Finalize(); } + void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) { if (dwID) { m_pThemeData->clrBorder[0] = ArgbEncode(255, 55, 98, 6); @@ -152,6 +157,7 @@ void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) { m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234); } } + int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) const { int32_t color = 0; if (dwStates & CFWL_PartState_Disabled) diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index 053ca28831..317d0d2336 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -17,13 +17,13 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { ~CFWL_PushButtonTP() override; // CFWL_WidgetTP + void Initialize() override; + void Finalize() override; bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; - FWL_Error Initialize() override; - FWL_Error Finalize() override; protected: struct PBThemeData { diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index e680bdd6db..4d23d3e193 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -28,6 +28,7 @@ CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {} bool CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar; } + void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { if (dwCapacity == CFWL_WidgetCapacity::Size) { @@ -36,15 +37,18 @@ void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } + uint32_t CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { if (m_pThemeData) SetThemeData(FWL_GetThemeColor(dwThemeID)); return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID); } -FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { + +void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) - return FALSE; + return; + IFWL_Widget* pWidget = pParams->m_pWidget; FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; if (pParams->m_dwStates & CFWL_PartState_Hovered) @@ -52,7 +56,8 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { else if (pParams->m_dwStates & CFWL_PartState_Pressed) eState = FWLTHEME_STATE_Pressed; else if (pParams->m_dwStates & CFWL_PartState_Disabled) - eState = FWLTHEME_STATE_Disabale; + eState = FWLTHEME_STATE_Disable; + CFX_Graphics* pGraphics = pParams->m_pGraphics; CFX_RectF* pRect = &pParams->m_rtPart; FX_BOOL bVert = pWidget->GetStylesEx(); @@ -81,9 +86,9 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); break; } - default: {} + default: + break; } - return TRUE; } void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, @@ -92,17 +97,17 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, FWLTHEME_STATE eState, FX_BOOL bPawButton, CFX_Matrix* pMatrix) { - if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { + if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) return; - } + CFX_Path path; path.Create(); CFX_RectF rect(*pRect); if (bVert) { rect.Deflate(1, 0); - if (rect.IsEmpty(0.1f)) { + if (rect.IsEmpty(0.1f)) return; - } + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); DrawAxialShading(pGraphics, rect.left, rect.top, rect.right(), rect.top, m_pThemeData->clrBtnBK[eState - 1][0], @@ -116,9 +121,9 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, pGraphics->RestoreGraphState(); } else { rect.Deflate(0, 1); - if (rect.IsEmpty(0.1f)) { + if (rect.IsEmpty(0.1f)) return; - } + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); DrawAxialShading(pGraphics, rect.left, rect.top, rect.left, rect.bottom(), m_pThemeData->clrBtnBK[eState - 1][0], @@ -132,6 +137,7 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, pGraphics->RestoreGraphState(); } } + void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FX_BOOL bVert, @@ -207,15 +213,16 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, pGraphics->StrokePath(&path, pMatrix); } } + void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FX_BOOL bVert, FWLTHEME_STATE eState, FX_BOOL bLowerTrack, CFX_Matrix* pMatrix) { - if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { + if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) return; - } + pGraphics->SaveGraphState(); CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); CFX_Path path; @@ -242,6 +249,7 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, DrawAxialShading(pGraphics, x1, y1, x2, y2, m_pThemeData->clrTrackBKStart, m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix); } + void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index 6643bb700b..6caf8f4917 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h @@ -19,7 +19,7 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP { // CFWL_WidgetTP bool IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + void DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; diff --git a/xfa/fwl/theme/cfwl_utils.h b/xfa/fwl/theme/cfwl_utils.h index b253722198..51bd07fbf9 100644 --- a/xfa/fwl/theme/cfwl_utils.h +++ b/xfa/fwl/theme/cfwl_utils.h @@ -19,7 +19,7 @@ enum FWLTHEME_STATE { FWLTHEME_STATE_Normal = 1, FWLTHEME_STATE_Hover, FWLTHEME_STATE_Pressed, - FWLTHEME_STATE_Disabale + FWLTHEME_STATE_Disable }; enum FWLTHEME_DIRECTION { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 5c54afd8fc..f313511164 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -52,29 +52,16 @@ uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) { return dwOld; } -FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) { - matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - _ctm.Set(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); - return FWL_Error::Succeeded; -} +void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {} -FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) { - return TRUE; -} - -FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { +void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) InitTTO(); int32_t iLen = pParams->m_wsText.GetLength(); if (iLen <= 0) - return FALSE; + return; + CFX_Graphics* pGraphics = pParams->m_pGraphics; m_pTextOut->SetRenderDevice(pGraphics->GetRenderDevice()); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); @@ -83,7 +70,6 @@ FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { pMatrix->Concat(*pGraphics->GetMatrix()); m_pTextOut->SetMatrix(*pMatrix); m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart); - return TRUE; } void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, @@ -137,66 +123,60 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, m_rtMargin.Set(0, 0, 0, 0); return &m_rtMargin; } - default: { return nullptr; } + default: + return nullptr; } return &m_fValue; } -FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { - return FWL_GetThemeLayout(m_dwThemeID); +bool CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { + return !!FWL_GetThemeLayout(m_dwThemeID); } -FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { - if (!pParams) - return FALSE; - if (!m_pTextOut) - return FALSE; +void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { + if (!pParams || !m_pTextOut) + return; + m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), pParams->m_wsText.GetLength(), rect); - return TRUE; } -FWL_Error CFWL_WidgetTP::Initialize() { +void CFWL_WidgetTP::Initialize() { m_dwThemeID = 0; - _ctm.SetIdentity(); - return FWL_Error::Succeeded; } -FWL_Error CFWL_WidgetTP::Finalize() { +void CFWL_WidgetTP::Finalize() { if (!m_pTextOut) FinalizeTTO(); - return FWL_Error::Succeeded; } CFWL_WidgetTP::~CFWL_WidgetTP() {} -FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { +void CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont) { if (!m_pTextOut) - return FWL_Error::Succeeded; + return; m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); m_pTextOut->SetFont(m_pFDEFont); m_pTextOut->SetFontSize(fFontSize); m_pTextOut->SetTextColor(rgbFont); - return FWL_Error::Succeeded; } -FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - CFGAS_GEFont* pFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { +void CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, + CFGAS_GEFont* pFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont) { if (!m_pTextOut) - return FWL_Error::Succeeded; + return; m_pTextOut->SetFont(pFont); m_pTextOut->SetFontSize(fFontSize); m_pTextOut->SetTextColor(rgbFont); - return FWL_Error::Succeeded; } CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { @@ -206,9 +186,9 @@ CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {} -FWL_Error CFWL_WidgetTP::InitTTO() { +void CFWL_WidgetTP::InitTTO() { if (m_pTextOut) - return FWL_Error::Succeeded; + return; m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0); @@ -217,12 +197,10 @@ FWL_Error CFWL_WidgetTP::InitTTO() { m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); m_pTextOut->SetEllipsisString(L"..."); - return FWL_Error::Succeeded; } -FWL_Error CFWL_WidgetTP::FinalizeTTO() { +void CFWL_WidgetTP::FinalizeTTO() { m_pTextOut.reset(); - return FWL_Error::Succeeded; } void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index ddd504b050..02f3981077 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -107,36 +107,36 @@ class CFWL_WidgetTP { public: virtual ~CFWL_WidgetTP(); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + virtual void Initialize(); + virtual void Finalize(); virtual bool IsValidWidget(IFWL_Widget* pWidget); virtual uint32_t GetThemeID(IFWL_Widget* pWidget); virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID); - virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); - virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); + + virtual void DrawBackground(CFWL_ThemeBackground* pParams); + virtual void DrawText(CFWL_ThemeText* pParams); virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity); - virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); - virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); + virtual bool IsCustomizedLayout(IFWL_Widget* pWidget); + virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); - FWL_Error SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); - FWL_Error SetFont(IFWL_Widget* pWidget, - CFGAS_GEFont* pFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); + void SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont); + void SetFont(IFWL_Widget* pWidget, + CFGAS_GEFont* pFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont); CFGAS_GEFont* GetFont(IFWL_Widget* pWidget); protected: CFWL_WidgetTP(); - FWL_Error InitTTO(); - FWL_Error FinalizeTTO(); + + void InitTTO(); + void FinalizeTTO(); + void DrawEdge(CFX_Graphics* pGraphics, uint32_t dwStyles, const CFX_RectF* pRect, @@ -219,7 +219,6 @@ class CFWL_WidgetTP { uint32_t m_dwValue; CFX_RectF m_rtMargin; uint32_t m_dwThemeID; - CFX_Matrix _ctm; }; void FWLTHEME_Release(); -- cgit v1.2.3