diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-20 07:19:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-20 07:19:43 -0700 |
commit | 73895de7dea3737d1a25801001b8efe186c6f5a3 (patch) | |
tree | 8754626255699818c34d336fccc75926a5958345 /xfa/fwl | |
parent | 2a38a02b0492de0576c2e5b5e7d550f969367f9d (diff) | |
download | pdfium-73895de7dea3737d1a25801001b8efe186c6f5a3.tar.xz |
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
Diffstat (limited to 'xfa/fwl')
68 files changed, 373 insertions, 706 deletions
diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 3ef81ff3ba..2e1ed69145 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -69,7 +69,6 @@ class CFWL_Event { CFWL_Event(); virtual ~CFWL_Event(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual CFWL_EventType GetClassID() const; uint32_t Release(); @@ -86,10 +85,6 @@ inline CFWL_Event::CFWL_Event() inline CFWL_Event::~CFWL_Event() {} -inline FWL_Error CFWL_Event::GetClassName(CFX_WideString& wsClass) const { - return FWL_Error::Succeeded; -} - inline CFWL_EventType CFWL_Event::GetClassID() const { return CFWL_EventType::None; } @@ -107,16 +102,11 @@ inline uint32_t CFWL_Event::Release() { public: \ classname(); \ ~classname() override; \ - FWL_Error GetClassName(CFX_WideString& wsClass) const override; \ CFWL_EventType GetClassID() const override; \ __VA_ARGS__ \ }; \ inline classname::classname() {} \ inline classname::~classname() {} \ - inline FWL_Error classname::GetClassName(CFX_WideString& wsClass) const { \ - wsClass = L## #classname; \ - return FWL_Error::Succeeded; \ - } \ inline CFWL_EventType classname::GetClassID() const { return eventType; } FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx; diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 2bffff0007..0bfafb5a89 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -58,7 +58,6 @@ class CFWL_Message { virtual ~CFWL_Message(); virtual CFWL_Message* Clone(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual CFWL_MessageType GetClassID() const; uint32_t Release(); @@ -84,10 +83,6 @@ inline CFWL_Message* CFWL_Message::Clone() { return nullptr; } -inline FWL_Error CFWL_Message::GetClassName(CFX_WideString& wsClass) const { - return FWL_Error::Succeeded; -} - inline CFWL_MessageType CFWL_Message::GetClassID() const { return CFWL_MessageType::None; } @@ -111,7 +106,6 @@ inline CFWL_Message* CFWL_Message::Retain() { classname(); \ ~classname() override; \ CFWL_Message* Clone() override; \ - FWL_Error GetClassName(CFX_WideString& wsClass) const override; \ CFWL_MessageType GetClassID() const override; \ __VA_ARGS__ \ }; @@ -120,10 +114,6 @@ inline CFWL_Message* CFWL_Message::Retain() { inline classname::classname() {} \ inline classname::~classname() {} \ inline CFWL_Message* classname::Clone() { return new classname(*this); } \ - inline FWL_Error classname::GetClassName(CFX_WideString& wsClass) const { \ - wsClass = L## #classname; \ - return FWL_Error::Succeeded; \ - } \ inline CFWL_MessageType classname::GetClassID() const { return msgType; } \ __VA_ARGS__ diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp index 770a857d78..a4b210f115 100644 --- a/xfa/fwl/core/ifwl_barcode.cpp +++ b/xfa/fwl/core/ifwl_barcode.cpp @@ -17,11 +17,6 @@ IFWL_Barcode::IFWL_Barcode(const CFWL_WidgetImpProperties& properties) IFWL_Barcode::~IFWL_Barcode() {} -FWL_Error IFWL_Barcode::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_Barcode; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_Barcode::GetClassID() const { return FWL_Type::Barcode; } @@ -34,12 +29,14 @@ FWL_Error IFWL_Barcode::Initialize() { return FWL_Error::Indefinite; return FWL_Error::Succeeded; } -FWL_Error IFWL_Barcode::Finalize() { + +void IFWL_Barcode::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; m_pBarcodeEngine.reset(); - return IFWL_Edit::Finalize(); + IFWL_Edit::Finalize(); } + FWL_Error IFWL_Barcode::Update() { if (IsLocked()) { return FWL_Error::Indefinite; @@ -48,6 +45,7 @@ FWL_Error IFWL_Barcode::Update() { GenerateBarcodeImageCache(); return ret; } + FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!pGraphics) diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index cccc4f1b9c..2313f86d36 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -20,7 +20,6 @@ class IFWL_Widget; #define XFA_BCS_NeedUpdate 0x0001 #define XFA_BCS_EncodeSuccess 0x0002 -#define FWL_CLASS_Barcode L"FWL_BARCODE" enum FWL_BCDAttribute { FWL_BCDATTRIBUTE_NONE = 0, @@ -63,10 +62,9 @@ class IFWL_Barcode : public IFWL_Edit { ~IFWL_Barcode() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index 643875a001..52269049e2 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -24,11 +24,6 @@ IFWL_Caret::IFWL_Caret(const CFWL_WidgetImpProperties& properties, IFWL_Caret::~IFWL_Caret() {} -FWL_Error IFWL_Caret::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_Caret; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_Caret::GetClassID() const { return FWL_Type::Caret; } @@ -41,14 +36,14 @@ FWL_Error IFWL_Caret::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_Caret::Finalize() { +void IFWL_Caret::Finalize() { if (m_pTimerInfo) { m_pTimerInfo->StopTimer(); m_pTimerInfo = nullptr; } delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_caret.h b/xfa/fwl/core/ifwl_caret.h index 8cc3cf7e02..c5b6997b45 100644 --- a/xfa/fwl/core/ifwl_caret.h +++ b/xfa/fwl/core/ifwl_caret.h @@ -17,7 +17,6 @@ class CFWL_WidgetImpProperties; class IFWL_Widget; class CFWL_CaretImpDelegate; -#define FWL_CLASS_Caret L"FWL_CARET" #define FWL_STATE_CAT_HightLight 1 class IFWL_Caret : public IFWL_Widget { @@ -26,10 +25,9 @@ class IFWL_Caret : public IFWL_Widget { ~IFWL_Caret() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index 20298c7308..cc06f9cea8 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -36,11 +36,6 @@ IFWL_CheckBox::IFWL_CheckBox(const CFWL_WidgetImpProperties& properties) IFWL_CheckBox::~IFWL_CheckBox() {} -FWL_Error IFWL_CheckBox::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_CheckBox; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_CheckBox::GetClassID() const { return FWL_Type::CheckBox; } @@ -53,10 +48,10 @@ FWL_Error IFWL_CheckBox::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_CheckBox::Finalize() { +void IFWL_CheckBox::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 56a9139b99..cdf1e91ca3 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -12,7 +12,6 @@ #include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_CheckBox L"FWL_CHECKBOX" #define FWL_STYLEEXT_CKB_Left (0L << 0) #define FWL_STYLEEXT_CKB_Center (1L << 0) #define FWL_STYLEEXT_CKB_Right (2L << 0) @@ -62,10 +61,9 @@ class IFWL_CheckBox : public IFWL_Widget { ~IFWL_CheckBox() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index 9d3e58cec6..edc430a0f2 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -35,11 +35,6 @@ IFWL_ComboBox::IFWL_ComboBox(const CFWL_WidgetImpProperties& properties) IFWL_ComboBox::~IFWL_ComboBox() {} -FWL_Error IFWL_ComboBox::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_ComboBox; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_ComboBox::GetClassID() const { return FWL_Type::ComboBox; } @@ -74,14 +69,14 @@ FWL_Error IFWL_ComboBox::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_ComboBox::Finalize() { - if (m_pEdit) { +void IFWL_ComboBox::Finalize() { + if (m_pEdit) m_pEdit->Finalize(); - } + m_pListBox->Finalize(); delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index a40f6d583a..15db0490ee 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -25,7 +25,6 @@ class IFWL_FormProxy; class IFWL_ListBox; class IFWL_Widget; -#define FWL_CLASS_ComboBox L"FWL_COMBOBOX" #define FWL_STYLEEXT_CMB_DropList (0L << 0) #define FWL_STYLEEXT_CMB_DropDown (1L << 0) #define FWL_STYLEEXT_CMB_Sort (1L << 1) @@ -89,10 +88,9 @@ class IFWL_ComboBox : public IFWL_Widget { ~IFWL_ComboBox() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) override; diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp index abe2c092d2..d34a55bcc2 100644 --- a/xfa/fwl/core/ifwl_combolist.cpp +++ b/xfa/fwl/core/ifwl_combolist.cpp @@ -23,10 +23,10 @@ FWL_Error IFWL_ComboList::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_ComboList::Finalize() { +void IFWL_ComboList::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_ListBox::Finalize(); + IFWL_ListBox::Finalize(); } int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { diff --git a/xfa/fwl/core/ifwl_combolist.h b/xfa/fwl/core/ifwl_combolist.h index 5d21b43681..d88a5956c2 100644 --- a/xfa/fwl/core/ifwl_combolist.h +++ b/xfa/fwl/core/ifwl_combolist.h @@ -18,7 +18,7 @@ class IFWL_ComboList : public IFWL_ListBox { // IFWL_Widget FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; int32_t MatchItem(const CFX_WideString& wsMatch); void ChangeSelected(int32_t iSel); diff --git a/xfa/fwl/core/ifwl_datetimecalendar.cpp b/xfa/fwl/core/ifwl_datetimecalendar.cpp index 786d16860e..0e095b9424 100644 --- a/xfa/fwl/core/ifwl_datetimecalendar.cpp +++ b/xfa/fwl/core/ifwl_datetimecalendar.cpp @@ -23,10 +23,10 @@ FWL_Error IFWL_DateTimeCalendar::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimeCalendar::Finalize() { +void IFWL_DateTimeCalendar::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_MonthCalendar::Finalize(); + IFWL_MonthCalendar::Finalize(); } CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( diff --git a/xfa/fwl/core/ifwl_datetimecalendar.h b/xfa/fwl/core/ifwl_datetimecalendar.h index 864e756c96..c106e7f86d 100644 --- a/xfa/fwl/core/ifwl_datetimecalendar.h +++ b/xfa/fwl/core/ifwl_datetimecalendar.h @@ -16,7 +16,7 @@ class IFWL_DateTimeCalendar : public IFWL_MonthCalendar { // IFWL_MonthCalendar FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; protected: friend class CFWL_DateTimeCalendarImpDelegate; diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp index a16b729484..0097691c42 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.cpp +++ b/xfa/fwl/core/ifwl_datetimeedit.cpp @@ -20,10 +20,10 @@ FWL_Error IFWL_DateTimeEdit::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimeEdit::Finalize() { +void IFWL_DateTimeEdit::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Edit::Finalize(); + IFWL_Edit::Finalize(); } CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( diff --git a/xfa/fwl/core/ifwl_datetimeedit.h b/xfa/fwl/core/ifwl_datetimeedit.h index 29433e5173..2429e98a4c 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.h +++ b/xfa/fwl/core/ifwl_datetimeedit.h @@ -20,7 +20,7 @@ class IFWL_DateTimeEdit : public IFWL_Edit { // IFWL_Edit FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; protected: friend class CFWL_DateTimeEditImpDelegate; diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index 04290b62d1..ef13d71cf1 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -36,11 +36,6 @@ IFWL_DateTimePicker::IFWL_DateTimePicker( IFWL_DateTimePicker::~IFWL_DateTimePicker() {} -FWL_Error IFWL_DateTimePicker::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_DateTimePicker; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_DateTimePicker::GetClassID() const { return FWL_Type::DateTimePicker; } @@ -75,20 +70,18 @@ FWL_Error IFWL_DateTimePicker::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::Finalize() { - if (m_pEdit) { +void IFWL_DateTimePicker::Finalize() { + if (m_pEdit) m_pEdit->Finalize(); - } - if (m_pMonthCal) { + if (m_pMonthCal) m_pMonthCal->Finalize(); - } - if (m_pForm) { + if (m_pForm) m_pForm->Finalize(); - } + UnregisterEventTarget(); delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index 28eefe1cde..4113e9b83e 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/ifwl_monthcalendar.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER" #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) @@ -67,10 +66,9 @@ class IFWL_DateTimePicker : public IFWL_Widget { ~IFWL_DateTimePicker() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void 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; diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index 189df97c89..1d769af6cb 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -79,11 +79,6 @@ IFWL_Edit::~IFWL_Edit() { ClearRecord(); } -FWL_Error IFWL_Edit::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_Edit; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_Edit::GetClassID() const { return FWL_Type::Edit; } @@ -101,20 +96,19 @@ FWL_Error IFWL_Edit::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_Edit::Finalize() { - if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { +void IFWL_Edit::Finalize() { + if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) ShowCaret(FALSE); - } - if (m_pHorzScrollBar) { + if (m_pHorzScrollBar) m_pHorzScrollBar->Finalize(); - } - if (m_pVertScrollBar) { + if (m_pVertScrollBar) m_pVertScrollBar->Finalize(); - } + delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } + FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); @@ -796,19 +790,23 @@ FX_BOOL IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, DispatchEvent(&event); return event.bValidate; } + FWL_Error IFWL_Edit::SetBackgroundColor(uint32_t color) { m_backColor = color; m_updateBackColor = TRUE; return FWL_Error::Succeeded; } + FWL_Error IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { m_wsFont = wsFont; m_fFontSize = fSize; return FWL_Error::Succeeded; } + void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { m_fScrollOffsetY = fScrollOffset; } + void IFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h index 688c09c349..e327a2509f 100644 --- a/xfa/fwl/core/ifwl_edit.h +++ b/xfa/fwl/core/ifwl_edit.h @@ -19,7 +19,6 @@ #include "xfa/fwl/lightwidget/cfwl_widget.h" #include "xfa/fxgraphics/cfx_path.h" -#define FWL_CLASS_Edit L"FWL_EDIT" #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) #define FWL_STYLEEXT_EDT_MultiLine (1L << 1) #define FWL_STYLEEXT_EDT_WantReturn (1L << 2) @@ -111,10 +110,9 @@ class IFWL_Edit : public IFWL_Widget { ~IFWL_Edit() override; // IFWL_Widget: - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error SetWidgetRect(const CFX_RectF& rect) override; FWL_Error Update() override; diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index ad78f98cb3..5aaa566ff4 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -52,7 +52,7 @@ IFWL_Form::IFWL_Form(const CFWL_WidgetImpProperties& properties, m_bLButtonDown(FALSE), m_bMaximized(false), m_bSetMaximize(FALSE), - m_bCustomizeLayout(FALSE), + m_bCustomizeLayout(false), m_eFormSize(FWL_FORMSIZE_Manual), m_bDoModalFlag(FALSE), m_pBigIcon(nullptr), @@ -69,11 +69,6 @@ IFWL_Form::~IFWL_Form() { RemoveSysButtons(); } -FWL_Error IFWL_Form::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_Form; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_Form::GetClassID() const { return FWL_Type::Form; } @@ -92,13 +87,15 @@ FWL_Error IFWL_Form::Initialize() { m_pDelegate = new CFWL_FormImpDelegate(this); return FWL_Error::Succeeded; } -FWL_Error IFWL_Form::Finalize() { + +void IFWL_Form::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; UnregisterEventTarget(); UnRegisterForm(); - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } + FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Reset(); diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 3aa38a00cd..ee1f360629 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -89,11 +89,10 @@ class IFWL_Form : public IFWL_Widget { ~IFWL_Form() override; // IFWL_Widget - 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; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error GetClientRect(CFX_RectF& rect) override; @@ -176,7 +175,7 @@ class IFWL_Form : public IFWL_Widget { FX_BOOL m_bLButtonDown; bool m_bMaximized; FX_BOOL m_bSetMaximize; - FX_BOOL m_bCustomizeLayout; + bool m_bCustomizeLayout; FWL_FORMSIZE m_eFormSize; FX_BOOL m_bDoModalFlag; FX_FLOAT m_fSmallIconSz; diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp index d97b5b6185..9a00bf3e8f 100644 --- a/xfa/fwl/core/ifwl_formproxy.cpp +++ b/xfa/fwl/core/ifwl_formproxy.cpp @@ -14,11 +14,6 @@ IFWL_FormProxy::IFWL_FormProxy(const CFWL_WidgetImpProperties& properties, IFWL_FormProxy::~IFWL_FormProxy() {} -FWL_Error IFWL_FormProxy::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_FormProxy; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_FormProxy::GetClassID() const { return FWL_Type::FormProxy; } @@ -37,10 +32,10 @@ FWL_Error IFWL_FormProxy::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_FormProxy::Finalize() { +void IFWL_FormProxy::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_FormProxy::Update() { diff --git a/xfa/fwl/core/ifwl_formproxy.h b/xfa/fwl/core/ifwl_formproxy.h index d5a1bd97de..3bc614c4d4 100644 --- a/xfa/fwl/core/ifwl_formproxy.h +++ b/xfa/fwl/core/ifwl_formproxy.h @@ -19,11 +19,10 @@ class IFWL_FormProxy : public IFWL_Form { ~IFWL_FormProxy() override; // IFWL_Widget - 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; + void Finalize() override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index ac2b1338b9..4e94d955d1 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -36,11 +36,6 @@ IFWL_ListBox::IFWL_ListBox(const CFWL_WidgetImpProperties& properties, IFWL_ListBox::~IFWL_ListBox() {} -FWL_Error IFWL_ListBox::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_ListBox; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_ListBox::GetClassID() const { return FWL_Type::ListBox; } @@ -53,16 +48,15 @@ FWL_Error IFWL_ListBox::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_ListBox::Finalize() { - if (m_pVertScrollBar) { +void IFWL_ListBox::Finalize() { + if (m_pVertScrollBar) m_pVertScrollBar->Finalize(); - } - if (m_pHorzScrollBar) { + if (m_pHorzScrollBar) m_pHorzScrollBar->Finalize(); - } + delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h index faab63056b..036aee2d62 100644 --- a/xfa/fwl/core/ifwl_listbox.h +++ b/xfa/fwl/core/ifwl_listbox.h @@ -16,7 +16,6 @@ #include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_ListBox L"FWL_LISTBOX" #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) @@ -107,10 +106,9 @@ class IFWL_ListBox : public IFWL_Widget { ~IFWL_ListBox() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void 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; diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index 096e3586d0..69e7588245 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -151,11 +151,6 @@ IFWL_MonthCalendar::~IFWL_MonthCalendar() { m_arrSelDays.RemoveAll(); } -FWL_Error IFWL_MonthCalendar::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_MonthCalendar; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_MonthCalendar::GetClassID() const { return FWL_Type::MonthCalendar; } @@ -168,10 +163,10 @@ FWL_Error IFWL_MonthCalendar::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_MonthCalendar::Finalize() { +void IFWL_MonthCalendar::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, diff --git a/xfa/fwl/core/ifwl_monthcalendar.h b/xfa/fwl/core/ifwl_monthcalendar.h index 48b15fef19..b9376b82c3 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.h +++ b/xfa/fwl/core/ifwl_monthcalendar.h @@ -13,7 +13,6 @@ #include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR" #define FWL_STYLEEXT_MCD_MultiSelect (1L << 0) #define FWL_STYLEEXT_MCD_NoToday (1L << 1) #define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2) @@ -58,10 +57,9 @@ class IFWL_MonthCalendar : public IFWL_Widget { ~IFWL_MonthCalendar() override; // FWL_WidgetImp - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index cff711ca99..301c404767 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -21,11 +21,6 @@ IFWL_PictureBox::IFWL_PictureBox(const CFWL_WidgetImpProperties& properties) IFWL_PictureBox::~IFWL_PictureBox() {} -FWL_Error IFWL_PictureBox::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_PictureBox; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_PictureBox::GetClassID() const { return FWL_Type::PictureBox; } @@ -38,10 +33,10 @@ FWL_Error IFWL_PictureBox::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_PictureBox::Finalize() { +void IFWL_PictureBox::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 98edd2793f..cfc32c0ba5 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -12,7 +12,6 @@ #include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_PictureBox L"FWL_PICTUREBOX" #define FWL_STYLEEXT_PTB_Left 0L << 0 #define FWL_STYLEEXT_PTB_Center 1L << 0 #define FWL_STYLEEXT_PTB_Right 2L << 0 @@ -49,10 +48,9 @@ class IFWL_PictureBox : public IFWL_Widget { ~IFWL_PictureBox() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index 7cbc2e116d..6040ae1117 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -25,11 +25,6 @@ IFWL_PushButton::IFWL_PushButton(const CFWL_WidgetImpProperties& properties) IFWL_PushButton::~IFWL_PushButton() {} -FWL_Error IFWL_PushButton::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_PushButton; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_PushButton::GetClassID() const { return FWL_Type::PushButton; } @@ -42,10 +37,10 @@ FWL_Error IFWL_PushButton::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_PushButton::Finalize() { +void IFWL_PushButton::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { @@ -128,9 +123,9 @@ FWL_Error IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, } CFX_RectF rtText; rtText.Set(0, 0, 0, 0); - if (!wsCaption.IsEmpty()) { + if (!wsCaption.IsEmpty()) CalcTextRect(wsCaption, pTheme, 0, m_iTTOAlign, rtText); - } + switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_PSB_ModeMask) { case FWL_STYLEEXT_PSB_TextOnly: DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h index d5ada29e41..8906aa898f 100644 --- a/xfa/fwl/core/ifwl_pushbutton.h +++ b/xfa/fwl/core/ifwl_pushbutton.h @@ -11,7 +11,6 @@ #include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" -#define FWL_CLASS_PushButton L"FWL_PUSHBUTTON" #define FWL_STYLEEXT_PSB_Left (0L << 0) #define FWL_STYLEEXT_PSB_Center (1L << 0) #define FWL_STYLEEXT_PSB_Right (2L << 0) @@ -45,10 +44,9 @@ class IFWL_PushButton : public IFWL_Widget { ~IFWL_PushButton() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void 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; diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 8c677f6a0b..e3b9ca64d9 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -41,7 +41,7 @@ IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, m_bRepaintThumb(FALSE), m_fButtonLen(0), m_bMinSize(FALSE), - m_bCustomLayout(FALSE), + m_bCustomLayout(false), m_fMinThumb(FWL_SCROLLBAR_MinThumb) { m_rtClient.Reset(); m_rtThumb.Reset(); @@ -53,11 +53,6 @@ IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, IFWL_ScrollBar::~IFWL_ScrollBar() {} -FWL_Error IFWL_ScrollBar::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_ScrollBar; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_ScrollBar::GetClassID() const { return FWL_Type::ScrollBar; } @@ -70,10 +65,10 @@ FWL_Error IFWL_ScrollBar::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_ScrollBar::Finalize() { +void IFWL_ScrollBar::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_scrollbar.h b/xfa/fwl/core/ifwl_scrollbar.h index 39d3c04eb2..95fe7739fe 100644 --- a/xfa/fwl/core/ifwl_scrollbar.h +++ b/xfa/fwl/core/ifwl_scrollbar.h @@ -18,7 +18,6 @@ class CFWL_ScrollBarImpDelegate; class CFWL_WidgetImpProperties; class IFWL_Widget; -#define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR" #define FWL_STYLEEXT_SCB_Horz (0L << 0) #define FWL_STYLEEXT_SCB_Vert (1L << 0) @@ -44,10 +43,9 @@ class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { ~IFWL_ScrollBar() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -124,7 +122,7 @@ class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { CFX_RectF m_rtMaxBtn; CFX_RectF m_rtMinTrack; CFX_RectF m_rtMaxTrack; - FX_BOOL m_bCustomLayout; + bool m_bCustomLayout; FX_FLOAT m_fMinThumb; protected: diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index a4212bcaeb..d94a240e59 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -38,11 +38,6 @@ IFWL_SpinButton::IFWL_SpinButton(const CFWL_WidgetImpProperties& properties) IFWL_SpinButton::~IFWL_SpinButton() {} -FWL_Error IFWL_SpinButton::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_SpinButton; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_SpinButton::GetClassID() const { return FWL_Type::SpinButton; } @@ -55,10 +50,10 @@ FWL_Error IFWL_SpinButton::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_SpinButton::Finalize() { +void IFWL_SpinButton::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_spinbutton.h b/xfa/fwl/core/ifwl_spinbutton.h index f35732c4ca..e5e6211917 100644 --- a/xfa/fwl/core/ifwl_spinbutton.h +++ b/xfa/fwl/core/ifwl_spinbutton.h @@ -12,7 +12,6 @@ #include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxfa/cxfa_eventparam.h" -#define FWL_CLASS_SpinButton L"FWL_SPINBUTTON" #define FWL_STYLEEXE_SPB_Vert (1L << 0) class CFWL_MsgMouse; @@ -27,10 +26,9 @@ class IFWL_SpinButton : public IFWL_Widget, public IFWL_Timer { ~IFWL_SpinButton() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void 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; diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index 275f649574..d64b6f038d 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -20,12 +20,12 @@ class IFWL_Widget; class IFWL_ThemeProvider { public: virtual ~IFWL_ThemeProvider() {} - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; + virtual void DrawBackground(CFWL_ThemeBackground* pParams) = 0; + virtual void DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) = 0; - virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; - virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0; + virtual bool IsCustomizedLayout(IFWL_Widget* pWidget) = 0; + virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0; }; #endif // XFA_FWL_CORE_IFWL_THEMEPROVIDER_H_ diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index 6281040546..a9b9085010 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -32,11 +32,6 @@ IFWL_ToolTip::IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, IFWL_ToolTip::~IFWL_ToolTip() {} -FWL_Error IFWL_ToolTip::GetClassName(CFX_WideString& wsClass) const { - wsClass = FWL_CLASS_ToolTip; - return FWL_Error::Succeeded; -} - FWL_Type IFWL_ToolTip::GetClassID() const { return FWL_Type::ToolTip; } @@ -51,10 +46,10 @@ FWL_Error IFWL_ToolTip::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_ToolTip::Finalize() { +void IFWL_ToolTip::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; - return IFWL_Widget::Finalize(); + IFWL_Widget::Finalize(); } FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/fwl/core/ifwl_tooltip.h b/xfa/fwl/core/ifwl_tooltip.h index 7554f82bf9..4aed7d8f7f 100644 --- a/xfa/fwl/core/ifwl_tooltip.h +++ b/xfa/fwl/core/ifwl_tooltip.h @@ -14,7 +14,6 @@ class CFWL_WidgetImpProperties; class IFWL_Widget; class CFWL_ToolTipImpDelegate; -#define FWL_CLASS_ToolTip L"FWL_TOOLTIP" #define FWL_STYLEEXT_TTP_Rectangle (0L << 3) #define FWL_STYLEEXT_TTP_RoundCorner (1L << 3) #define FWL_STYLEEXT_TTP_Balloon (1L << 4) @@ -39,10 +38,9 @@ class IFWL_ToolTip : public IFWL_Form { ~IFWL_ToolTip() override; // IFWL_Widget - FWL_Error GetClassName(CFX_WideString& wsClass) const override; FWL_Type GetClassID() const override; FWL_Error Initialize() override; - FWL_Error Finalize() override; + void Finalize() override; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index 68755bf24a..5ec738f8cc 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -24,6 +24,22 @@ #define FWL_STYLEEXT_MNU_Vert (1L << 0) +IFWL_Widget::IFWL_Widget(const CFWL_WidgetImpProperties& properties, + IFWL_Widget* pOuter) + : m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), + m_pProperties(new CFWL_WidgetImpProperties(properties)), + m_pDelegate(nullptr), + m_pCurDelegate(nullptr), + m_pOuter(pOuter), + m_pLayoutItem(nullptr), + m_pAssociate(nullptr), + m_iLock(0), + m_nEventKey(0) { + ASSERT(m_pWidgetMgr); +} + +IFWL_Widget::~IFWL_Widget() {} + FWL_Error IFWL_Widget::Initialize() { IFWL_App* pApp = FWL_GetApp(); if (!pApp) @@ -45,15 +61,9 @@ FWL_Error IFWL_Widget::Initialize() { return FWL_Error::Succeeded; } -FWL_Error IFWL_Widget::Finalize() { +void IFWL_Widget::Finalize() { NotifyDriver(); m_pWidgetMgr->RemoveWidget(this); - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { - wsClass.clear(); - return FWL_Error::Succeeded; } FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { @@ -389,30 +399,9 @@ void IFWL_Widget::SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; } -CFWL_Widget* IFWL_Widget::GetAssociateWidget() const { - return m_pAssociate; -} - void IFWL_Widget::SetAssociateWidget(CFWL_Widget* pAssociate) { m_pAssociate = pAssociate; } - -IFWL_Widget::IFWL_Widget(const CFWL_WidgetImpProperties& properties, - IFWL_Widget* pOuter) - : m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), - m_pProperties(new CFWL_WidgetImpProperties(properties)), - m_pDelegate(nullptr), - m_pCurDelegate(nullptr), - m_pOuter(pOuter), - m_pLayoutItem(nullptr), - m_pAssociate(nullptr), - m_iLock(0), - m_nEventKey(0) { - ASSERT(m_pWidgetMgr); -} - -IFWL_Widget::~IFWL_Widget() {} - FX_BOOL IFWL_Widget::IsEnabled() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; } diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 9db7a0505a..6cb241d363 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -67,8 +67,7 @@ class IFWL_Widget { virtual ~IFWL_Widget(); virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; + virtual void Finalize(); virtual FWL_Type GetClassID() const = 0; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; @@ -76,31 +75,42 @@ class IFWL_Widget { virtual FWL_Error GetGlobalRect(CFX_RectF& rect); virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); virtual FWL_Error GetClientRect(CFX_RectF& rect); + virtual IFWL_Widget* GetParent(); virtual FWL_Error SetParent(IFWL_Widget* pParent); + virtual IFWL_Widget* GetOwner(); virtual FWL_Error SetOwner(IFWL_Widget* pOwner); + virtual IFWL_Widget* GetOuter(); + virtual uint32_t GetStyles(); virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); virtual uint32_t GetStylesEx(); virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); + virtual uint32_t GetStates(); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); + virtual FWL_Error Update(); virtual FWL_Error LockUpdate(); virtual FWL_Error UnlockUpdate(); + virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_Error TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); + virtual IFWL_ThemeProvider* GetThemeProvider(); virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); @@ -115,7 +125,6 @@ class IFWL_Widget { void* GetLayoutItem() const; void SetLayoutItem(void* pItem); - CFWL_Widget* GetAssociateWidget() const; void SetAssociateWidget(CFWL_Widget* pAssociate); protected: diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp index fe2b35c46b..c77bfc215c 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.cpp +++ b/xfa/fwl/lightwidget/cfwl_widget.cpp @@ -18,30 +18,24 @@ #define FWL_WGT_CalcWidth 2048 #define FWL_WGT_CalcMultiLineDefWidth 120.0f -IFWL_Widget* CFWL_Widget::GetWidget() { - return m_pIface.get(); -} - -const IFWL_Widget* CFWL_Widget::GetWidget() const { - return m_pIface.get(); +CFWL_Widget::CFWL_Widget() + : m_pDelegate(nullptr), + m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), + m_pProperties(new CFWL_WidgetProperties) { + ASSERT(m_pWidgetMgr); } -FWL_Error CFWL_Widget::GetClassName(CFX_WideString& wsClass) const { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->GetClassName(wsClass); +CFWL_Widget::~CFWL_Widget() { + if (m_pIface) + m_pIface->Finalize(); } -FWL_Type CFWL_Widget::GetClassID() const { - if (!m_pIface) - return FWL_Type::Unknown; - return m_pIface->GetClassID(); +IFWL_Widget* CFWL_Widget::GetWidget() { + return m_pIface.get(); } -FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { - if (!m_pIface) - return FALSE; - return m_pIface->IsInstance(wsClass); +const IFWL_Widget* CFWL_Widget::GetWidget() const { + return m_pIface.get(); } FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { @@ -75,39 +69,6 @@ FWL_Error CFWL_Widget::GetClientRect(CFX_RectF& rect) { return m_pIface->GetClientRect(rect); } -CFWL_Widget* CFWL_Widget::GetParent() { - if (!m_pIface) - return nullptr; - - IFWL_Widget* parent = m_pIface->GetParent(); - if (!parent) - return nullptr; - - return static_cast<CFWL_Widget*>(parent->GetAssociateWidget()); -} - -FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->SetParent(pParent ? pParent->GetWidget() : nullptr); -} - -CFWL_Widget* CFWL_Widget::GetOwner() { - return nullptr; -} - -FWL_Error CFWL_Widget::SetOwner(CFWL_Widget* pOwner) { - if (!m_pIface) - return FWL_Error::Indefinite; - return FWL_Error::Succeeded; -} - -uint32_t CFWL_Widget::GetStyles() { - if (!m_pIface) - return 0; - return m_pIface->GetStyles(); -} - FWL_Error CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved) { if (!m_pIface) @@ -135,31 +96,27 @@ void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { m_pIface->SetStates(dwStates, bSet); } -void* CFWL_Widget::GetLayoutItem() const { - return m_pIface ? m_pIface->GetLayoutItem() : nullptr; -} - void CFWL_Widget::SetLayoutItem(void* pItem) { if (m_pIface) m_pIface->SetLayoutItem(pItem); } -FWL_Error CFWL_Widget::Update() { +void CFWL_Widget::Update() { if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->Update(); + return; + m_pIface->Update(); } -FWL_Error CFWL_Widget::LockUpdate() { +void CFWL_Widget::LockUpdate() { if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->LockUpdate(); + return; + m_pIface->LockUpdate(); } -FWL_Error CFWL_Widget::UnlockUpdate() { +void CFWL_Widget::UnlockUpdate() { if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->UnlockUpdate(); + return; + m_pIface->UnlockUpdate(); } FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -168,33 +125,6 @@ FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return m_pIface->HitTest(fx, fy); } -FWL_Error CFWL_Widget::TransformTo(CFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, fx, - fy); -} - -FWL_Error CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, rt); -} - -FWL_Error CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->GetMatrix(matrix, bGlobal); -} - -FWL_Error CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { - if (!m_pIface) - return FWL_Error::Indefinite; - return m_pIface->SetMatrix(matrix); -} - FWL_Error CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!m_pIface) @@ -209,128 +139,3 @@ IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { m_pDelegate = m_pIface->SetDelegate(pDelegate); return m_pDelegate; } - -CFWL_Widget::CFWL_Widget() - : m_pDelegate(nullptr), - m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), - m_pProperties(new CFWL_WidgetProperties) { - ASSERT(m_pWidgetMgr); -} - -CFWL_Widget::~CFWL_Widget() { - if (m_pIface) - m_pIface->Finalize(); -} - -FWL_Error CFWL_Widget::Repaint(const CFX_RectF* pRect) { - if (!m_pIface) - return FWL_Error::Indefinite; - - CFX_RectF rect; - if (pRect) { - rect = *pRect; - } else { - m_pIface->GetWidgetRect(rect); - rect.left = rect.top = 0; - } - return m_pWidgetMgr->RepaintWidget(m_pIface.get(), &rect); -} - -FWL_Error CFWL_Widget::SetFocus(FX_BOOL bFocus) { - if (!m_pIface) - return FWL_Error::Indefinite; - - IFWL_App* pApp = m_pIface->GetOwnerApp(); - if (!pApp) - return FWL_Error::Indefinite; - - CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); - if (!pDriver) - return FWL_Error::Indefinite; - - if (bFocus) { - pDriver->SetFocus(m_pIface.get()); - } else { - if (pDriver->GetFocus() == m_pIface.get()) { - pDriver->SetFocus(nullptr); - } - } - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_Widget::SetGrab(FX_BOOL bSet) { - if (!m_pIface) - return FWL_Error::Indefinite; - - IFWL_App* pApp = m_pIface->GetOwnerApp(); - if (!pApp) - return FWL_Error::Indefinite; - - CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); - if (!pDriver) - return FWL_Error::Indefinite; - - pDriver->SetGrab(m_pIface.get(), bSet); - return FWL_Error::Succeeded; -} - -void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource, - uint32_t dwFilter) { - if (!m_pIface) - return; - - IFWL_App* pApp = m_pIface->GetOwnerApp(); - if (!pApp) - return; - - CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver(); - if (!pNoteDriver) - return; - - IFWL_Widget* pEventSourceImp = - !pEventSource ? nullptr : pEventSource->GetWidget(); - pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter); -} - -void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) { - if (!m_pIface) - return; - if (m_pIface->GetOuter()) - return; - - IFWL_App* pApp = m_pIface->GetOwnerApp(); - if (!pApp) - return; - - CFWL_NoteDriver* pNoteDriver = pApp->GetNoteDriver(); - if (!pNoteDriver) - return; - - pNoteDriver->SendEvent(pEvent); -} - -CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, - FX_BOOL bMultiLine, - int32_t iLineWidth) { - if (!m_pIface) - return CFX_SizeF(); - - IFWL_ThemeProvider* pTheme = m_pIface->GetThemeProvider(); - if (!pTheme) - return CFX_SizeF(); - - CFWL_ThemeText calPart; - calPart.m_pWidget = m_pIface.get(); - calPart.m_wsText = wsText; - calPart.m_dwTTOStyles = - bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine; - calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; - CFX_RectF rect; - FX_FLOAT fWidth = bMultiLine - ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth - : FWL_WGT_CalcMultiLineDefWidth) - : FWL_WGT_CalcWidth; - rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); - pTheme->CalcTextRect(&calPart, rect); - return CFX_SizeF(rect.width, rect.height); -} diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h index c230ce200c..16b1141aae 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.h +++ b/xfa/fwl/lightwidget/cfwl_widget.h @@ -21,59 +21,37 @@ class CFWL_WidgetMgr; class CFWL_Widget { public: + CFWL_Widget(); virtual ~CFWL_Widget(); virtual IFWL_Widget* GetWidget(); virtual const IFWL_Widget* GetWidget() const; - FWL_Error GetClassName(CFX_WideString& wsClass) const; - FWL_Type GetClassID() const; - virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - FWL_Error GetGlobalRect(CFX_RectF& rect); FWL_Error SetWidgetRect(const CFX_RectF& rect); + FWL_Error GetGlobalRect(CFX_RectF& rect); FWL_Error GetClientRect(CFX_RectF& rtClient); - CFWL_Widget* GetParent(); - FWL_Error SetParent(CFWL_Widget* pParent); - CFWL_Widget* GetOwner(); - FWL_Error SetOwner(CFWL_Widget* pOwner); - uint32_t GetStyles(); + FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); uint32_t GetStylesEx(); FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); + uint32_t GetStates(); void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - void* GetLayoutItem() const; + void SetLayoutItem(void* pItem); - FWL_Error SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); - void* GetPrivateData(void* module_id); - FWL_Error Update(); - FWL_Error LockUpdate(); - FWL_Error UnlockUpdate(); + void Update(); + void LockUpdate(); + void UnlockUpdate(); + FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_Error TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - FWL_Error TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); - FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - FWL_Error SetMatrix(const CFX_Matrix& matrix); + FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); - IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); - FWL_Error Repaint(const CFX_RectF* pRect = nullptr); - FWL_Error SetFocus(FX_BOOL bFocus); - FWL_Error SetGrab(FX_BOOL bSet); - CFWL_Widget(); - void RegisterEventTarget(CFWL_Widget* pEventSource = nullptr, - uint32_t dwFilter = FWL_EVENT_ALL_MASK); - void DispatchEvent(CFWL_Event* pEvent); - CFX_SizeF CalcTextSize(const CFX_WideString& wsText, - FX_BOOL bMultiLine = FALSE, - int32_t iLineWidth = -1); + IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); protected: FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); 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(); |