diff options
41 files changed, 812 insertions, 568 deletions
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 6df6fb364e..bf534a7a97 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -1181,3 +1181,30 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, rtInvalidate.Inflate(2, 2); m_pOwner->Repaint(&rtInvalidate); } + +CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() { + m_iCurYear = 2010; + m_iCurMonth = 3; + m_iCurDay = 29; +} + +FWL_Error CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCaption( + IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; +} + +int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurDay( + IFWL_Widget* pWidget) { + return m_iCurDay; +} + +int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurMonth( + IFWL_Widget* pWidget) { + return m_iCurMonth; +} + +int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurYear( + IFWL_Widget* pWidget) { + return m_iCurYear; +} diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h index 8490324d9d..5ec22c1fac 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h @@ -58,33 +58,40 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { public: CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + + // CFWL_EditImp + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: friend class CFWL_DateTimeEditImpDelegate; }; + class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); void OnProcessMessage(CFWL_Message* pMessage) override; - private: - void DisForm_OnProcessMessage(CFWL_Message* pMessage); - protected: CFWL_DateTimeEdit* m_pOwner; + + private: + void DisForm_OnProcessMessage(CFWL_Message* pMessage); }; + class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { public: CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); + + // CFWL_MonthCalendarImp + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: friend class CFWL_DateTimeCalendarImpDelegate; }; + class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { public: CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); @@ -94,14 +101,15 @@ class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { void OnLButtonUpEx(CFWL_MsgMouse* pMsg); void OnMouseMoveEx(CFWL_MsgMouse* pMsg); - private: - void DisForm_OnProcessMessage(CFWL_Message* pMessage); - void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); - protected: CFWL_DateTimeCalendar* m_pOwner; FX_BOOL m_bFlag; + + private: + void DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); }; + class CFWL_DateTimePickerImp : public CFWL_WidgetImp { public: CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, @@ -127,7 +135,6 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { int32_t nStart = 0, int32_t nCount = -1) const; - public: FX_BOOL CanUndo(); FX_BOOL CanRedo(); FX_BOOL Undo(); @@ -145,11 +152,32 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { FWL_Error SetEditLimit(int32_t nLimit); FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - - public: IFWL_DateTimeEdit* GetDataTimeEdit(); protected: + friend class CFWL_DateTimeEditImpDelegate; + friend class CFWL_DateTimeCalendar; + friend class CFWL_DateTimeCalendarImpDelegate; + friend class CFWL_DateTimePickerImpDelegate; + + class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { + public: + CFWL_MonthCalendarImpDP(); + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_MonthCalendarDP + int32_t GetCurDay(IFWL_Widget* pWidget) override; + int32_t GetCurMonth(IFWL_Widget* pWidget) override; + int32_t GetCurYear(IFWL_Widget* pWidget) override; + + int32_t m_iCurDay; + int32_t m_iCurYear; + int32_t m_iCurMonth; + }; + void DrawDropDownButton(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); @@ -163,6 +191,19 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { void InitProxyForm(); void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); + CFX_RectF m_rtBtn; + CFX_RectF m_rtClient; + int32_t m_iBtnState; + int32_t m_iYear; + int32_t m_iMonth; + int32_t m_iDay; + FX_BOOL m_bLBtnDown; + std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; + std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal; + std::unique_ptr<IFWL_DateTimeForm> m_pForm; + FX_FLOAT m_fBtn; + CFWL_MonthCalendarImpDP m_MonthCalendarDP; + private: FWL_Error DisForm_Initialize(); void DisForm_InitDateTimeCalendar(); @@ -176,47 +217,13 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { FWL_Error DisForm_GetBBox(CFX_RectF& rect); FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); - - protected: - CFX_RectF m_rtBtn; - CFX_RectF m_rtClient; - int32_t m_iBtnState; - int32_t m_iYear; - int32_t m_iMonth; - int32_t m_iDay; - FX_BOOL m_bLBtnDown; - std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; - std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal; - std::unique_ptr<IFWL_DateTimeForm> m_pForm; - FX_FLOAT m_fBtn; - class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { - public: - CFWL_MonthCalendarImpDP() { - m_iCurYear = 2010; - m_iCurMonth = 3; - m_iCurDay = 29; - } - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; - } - virtual int32_t GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; } - virtual int32_t GetCurMonth(IFWL_Widget* pWidget) { return m_iCurMonth; } - virtual int32_t GetCurYear(IFWL_Widget* pWidget) { return m_iCurYear; } - int32_t m_iCurDay; - int32_t m_iCurYear; - int32_t m_iCurMonth; - }; - - CFWL_MonthCalendarImpDP m_MonthCalendarDP; - friend class CFWL_DateTimeEditImpDelegate; - friend class CFWL_DateTimeCalendar; - friend class CFWL_DateTimeCalendarImpDelegate; - friend class CFWL_DateTimePickerImpDelegate; }; + class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); + + // CFWL_WidgetImpDelegate void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL) override; diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index bf1d19f294..3fdd999d5d 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -20,7 +20,6 @@ #include "xfa/fwl/basewidget/fwl_comboboximp.h" #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" #include "xfa/fwl/basewidget/ifwl_caret.h" -#include "xfa/fwl/basewidget/ifwl_datetimepicker.h" #include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index ae5e71780b..209a857dad 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -1197,3 +1197,16 @@ void CFWL_MonthCalendarImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { } } } + +FWL_DATEINFO::FWL_DATEINFO(int32_t day, + int32_t dayofweek, + uint32_t dwSt, + CFX_RectF rc, + CFX_WideString& wsday) + : iDay(day), + iDayOfWeek(dayofweek), + dwStates(dwSt), + rect(rc), + wsDay(wsday) {} + +FWL_DATEINFO::~FWL_DATEINFO() {} diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index e44a17a1d3..a3a8f45aa0 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -216,12 +216,9 @@ struct FWL_DATEINFO { int32_t dayofweek, uint32_t dwSt, CFX_RectF rc, - CFX_WideString& wsday) - : iDay(day), - iDayOfWeek(dayofweek), - dwStates(dwSt), - rect(rc), - wsDay(wsday) {} + CFX_WideString& wsday); + ~FWL_DATEINFO(); + int32_t iDay; int32_t iDayOfWeek; uint32_t dwStates; diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 26b82443fa..2316ada9cd 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -44,9 +44,7 @@ #define FWL_STATE_CKB_Neutral (2 << (FWL_WGTSTATE_MAX + 2)) #define FWL_STATE_CKB_CheckMask (3L << (FWL_WGTSTATE_MAX + 2)) -BEGIN_FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, - CFWL_EventType::CheckStateChanged) -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, CFWL_EventType::CheckStateChanged) class IFWL_CheckBoxDP : public IFWL_DataProvider { public: diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index 2d9c907b39..5165ef2c48 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -39,36 +39,33 @@ class IFWL_ComboBox; #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, CFWL_EventType::EditChanged) -int32_t nChangeType; -CFX_WideString wsInsert; -CFX_WideString wsDelete; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, CFWL_EventType::SelectChanged) -CFX_Int32Array iArraySels; -FX_BOOL bLButtonUp; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, CFWL_EventType::HoverChanged) -int32_t m_iCurHover; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, CFWL_EventType::DrawItem) -CFX_Graphics* m_pGraphics; -CFX_Matrix m_matrix; -int32_t m_index; -CFX_RectF m_rtItem; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown) + +FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown) + +FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp) + +FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, + CFWL_EventType::EditChanged, + int32_t nChangeType; + CFX_WideString wsInsert; + CFX_WideString wsDelete;) + +FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, + CFWL_EventType::SelectChanged, + CFX_Int32Array iArraySels; + FX_BOOL bLButtonUp;) + +FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, + CFWL_EventType::HoverChanged, + int32_t m_iCurHover;) + +FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, + CFWL_EventType::DrawItem, + CFX_Graphics* m_pGraphics; + CFX_Matrix m_matrix; + int32_t m_index; + CFX_RectF m_rtItem;) class IFWL_ComboBoxDP : public IFWL_ListBoxDP { public: diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index 7aba68b5a0..f592fc1abe 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -30,25 +30,23 @@ #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown) -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown) -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp) -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp) -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, CFWL_EventType::EditChanged) -CFX_WideString m_wsText; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, + CFWL_EventType::EditChanged, + CFX_WideString m_wsText;) -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, CFWL_EventType::HoverChanged) -int32_t hoverday; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, + CFWL_EventType::HoverChanged, + int32_t hoverday;) -BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, CFWL_EventType::SelectChanged) -int32_t iYear; -int32_t iMonth; -int32_t iDay; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, + CFWL_EventType::SelectChanged, + int32_t iYear; + int32_t iMonth; + int32_t iDay;) class IFWL_DateTimePickerDP : public IFWL_DataProvider { public: diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index 531323e564..ac2ca3110f 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -54,39 +54,37 @@ enum FWL_EDT_TEXTCHANGED { FWL_EDT_TEXTCHANGED_Replace, }; -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, CFWL_EventType::TextChanged) -int32_t nChangeType; -CFX_WideString wsInsert; -CFX_WideString wsDelete; -CFX_WideString wsPrevText; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, CFWL_EventType::PreSelfAdaption) -FX_BOOL bHSelfAdaption; -FX_BOOL bVSelfAdaption; -CFX_RectF rtAfterChange; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtValidate, CFWL_EventType::Validate) -IFWL_Widget* pDstWidget; -CFX_WideString wsInsert; -FX_BOOL bValidate; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, CFWL_EventType::CheckWord) -CFX_ByteString bsWord; -FX_BOOL bCheckWord; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, - CFWL_EventType::GetSuggestedWords) -FX_BOOL bSuggestWords; -CFX_ByteString bsWord; -std::vector<CFX_ByteString> bsArraySuggestWords; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, + CFWL_EventType::TextChanged, + int32_t nChangeType; + CFX_WideString wsInsert; + CFX_WideString wsDelete; + CFX_WideString wsPrevText;) + +FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull) + +FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, + CFWL_EventType::PreSelfAdaption, + FX_BOOL bHSelfAdaption; + FX_BOOL bVSelfAdaption; + CFX_RectF rtAfterChange;) + +FWL_EVENT_DEF(CFWL_EvtEdtValidate, + CFWL_EventType::Validate, + IFWL_Widget* pDstWidget; + CFX_WideString wsInsert; + FX_BOOL bValidate;) + +FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, + CFWL_EventType::CheckWord, + CFX_ByteString bsWord; + FX_BOOL bCheckWord;) + +FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, + CFWL_EventType::GetSuggestedWords, + FX_BOOL bSuggestWords; + CFX_ByteString bsWord; + std::vector<CFX_ByteString> bsArraySuggestWords;) class CFWL_WidgetImpProperties; class IFDE_TxtEdtDoRecord; @@ -115,7 +113,6 @@ class IFWL_Edit : public IFWL_Widget { int32_t GetLimit(); FWL_Error SetLimit(int32_t nLimit); FWL_Error SetAliasChar(FX_WCHAR wAlias); - FWL_Error SetFormatString(const CFX_WideString& wsFormat); FWL_Error Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); FWL_Error DeleteSelections(); FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index c531cea9f3..010a82f705 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -31,16 +31,16 @@ class CFX_DIBitmap; -BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, CFWL_EventType::SelectChanged) -CFX_Int32Array iarraySels; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtLtbSelChanged, + CFWL_EventType::SelectChanged, + CFX_Int32Array iarraySels;) -BEGIN_FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, CFWL_EventType::DrawItem) -CFX_Graphics* m_pGraphics; -CFX_Matrix m_matrix; -int32_t m_index; -CFX_RectF m_rect; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtLtbDrawItem, + CFWL_EventType::DrawItem, + CFX_Graphics* m_pGraphics; + CFX_Matrix m_matrix; + int32_t m_index; + CFX_RectF m_rect;) class IFWL_ListItem {}; diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h index 027d25b426..40ea8cb09f 100644 --- a/xfa/fwl/basewidget/ifwl_monthcalendar.h +++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h @@ -22,17 +22,17 @@ #define FWL_ITEMSTATE_MCD_Selected (1L << 1) #define FWL_ITEMSTATE_MCD_Focused (1L << 2) -BEGIN_FWL_EVENT_DEF(CFWL_Event_McdDateSelected, CFWL_EventType::DataSelected) -int32_t m_iStartDay; -int32_t m_iEndDay; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EventMcdDateChanged, CFWL_EventType::DateChanged) -int32_t m_iOldYear; -int32_t m_iOldMonth; -int32_t m_iStartDay; -int32_t m_iEndDay; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_Event_McdDateSelected, + CFWL_EventType::DataSelected, + int32_t m_iStartDay; + int32_t m_iEndDay;) + +FWL_EVENT_DEF(CFWL_EventMcdDateChanged, + CFWL_EventType::DateChanged, + int32_t m_iOldYear; + int32_t m_iOldMonth; + int32_t m_iStartDay; + int32_t m_iEndDay;) class IFWL_MonthCalendarDP : public IFWL_DataProvider { public: diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 2e81aeb9f2..6080f0c347 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -7,14 +7,13 @@ #ifndef XFA_FWL_BASEWIDGET_IFWL_SPINBUTTON_H_ #define XFA_FWL_BASEWIDGET_IFWL_SPINBUTTON_H_ +#include "xfa/fwl/core/cfwl_event.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #define FWL_CLASS_SpinButton L"FWL_SPINBUTTON" #define FWL_STYLEEXE_SPB_Vert (1L << 0) -BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click) -FX_BOOL m_bUp; -END_FWL_EVENT_DEF +FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;) class IFWL_SpinButton : public IFWL_Widget { public: diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h index 5b8dff1b3b..db048d3ff6 100644 --- a/xfa/fwl/basewidget/ifwl_tooltip.h +++ b/xfa/fwl/basewidget/ifwl_tooltip.h @@ -21,8 +21,10 @@ class IFWL_ToolTip; class IFWL_ToolTipDP : public IFWL_DataProvider { public: - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override = 0; + virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index d9decac334..4d208d0d46 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -66,22 +66,13 @@ class IFWL_Widget; class CFWL_Event { public: - CFWL_Event() - : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} - virtual ~CFWL_Event() {} - - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { - return FWL_Error::Succeeded; - } - virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; } - - uint32_t Release() { - m_dwRefCount--; - uint32_t dwRefCount = m_dwRefCount; - if (!m_dwRefCount) - delete this; - return dwRefCount; - } + CFWL_Event(); + virtual ~CFWL_Event(); + + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; + virtual CFWL_EventType GetClassID() const; + + uint32_t Release(); IFWL_Widget* m_pSrcTarget; IFWL_Widget* m_pDstTarget; @@ -90,84 +81,95 @@ class CFWL_Event { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_EVENT_DEF(classname, eventType) \ - class classname : public CFWL_Event { \ - public: \ - classname() : CFWL_Event() {} \ - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { \ - wsClass = L## #classname; \ - return FWL_Error::Succeeded; \ - } \ - virtual CFWL_EventType GetClassID() const { return eventType; } - -#define END_FWL_EVENT_DEF \ - } \ - ; // NOLINT - -BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -uint32_t m_dwFlags; -FWL_MouseCommand m_dwCmd; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -FX_FLOAT m_fDeltaX; -FX_FLOAT m_fDeltaY; -uint32_t m_dwFlags; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key) -uint32_t m_dwKeyCode; -uint32_t m_dwFlags; -FWL_KeyCommand m_dwCmd; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, CFWL_EventType::SetFocus) -IFWL_Widget* m_pSetFocus; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, CFWL_EventType::KillFocus) -IFWL_Widget* m_pKillFocus; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw) -CFX_Graphics* m_pGraphics; -IFWL_Widget* m_pWidget; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll) -uint32_t m_iScrollCode; -FX_FLOAT m_fPos; -FX_BOOL* m_pRet; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, CFWL_EventType::ContextMenu) -FX_FLOAT m_fPosX; -FX_FLOAT m_fPosY; -IFWL_Widget* m_pOwner; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, CFWL_EventType::MenuCommand) -int32_t m_iCommand; -void* m_pData; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, CFWL_EventType::SizeChanged) -IFWL_Widget* m_pWidget; -CFX_RectF m_rtOld; -CFX_RectF m_rtNew; -END_FWL_EVENT_DEF - -BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle) -END_FWL_EVENT_DEF +inline CFWL_Event::CFWL_Event() + : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} + +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; +} + +inline uint32_t CFWL_Event::Release() { + m_dwRefCount--; + uint32_t dwRefCount = m_dwRefCount; + if (!m_dwRefCount) + delete this; + return dwRefCount; +} + +#define FWL_EVENT_DEF(classname, eventType, ...) \ + class classname : public CFWL_Event { \ + 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; + FX_FLOAT m_fy; + uint32_t m_dwFlags; + FWL_MouseCommand m_dwCmd;) + +FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx; + FX_FLOAT m_fy; + FX_FLOAT m_fDeltaX; + FX_FLOAT m_fDeltaY; + uint32_t m_dwFlags;) + +FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key, uint32_t m_dwKeyCode; + uint32_t m_dwFlags; + FWL_KeyCommand m_dwCmd;) + +FWL_EVENT_DEF(CFWL_EvtSetFocus, + CFWL_EventType::SetFocus, + IFWL_Widget* m_pSetFocus;) + +FWL_EVENT_DEF(CFWL_EvtKillFocus, + CFWL_EventType::KillFocus, + IFWL_Widget* m_pKillFocus;) + +FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw, CFX_Graphics* m_pGraphics; + IFWL_Widget * m_pWidget;) + +FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click) + +FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll, uint32_t m_iScrollCode; + FX_FLOAT m_fPos; + FX_BOOL * m_pRet;) + +FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) + +FWL_EVENT_DEF(CFWL_EvtContextMenu, + CFWL_EventType::ContextMenu, + FX_FLOAT m_fPosX; + FX_FLOAT m_fPosY; + IFWL_Widget * m_pOwner;) + +FWL_EVENT_DEF(CFWL_EvtMenuCommand, + CFWL_EventType::MenuCommand, + int32_t m_iCommand; + void* m_pData;) + +FWL_EVENT_DEF(CFWL_EvtSizeChanged, + CFWL_EventType::SizeChanged, + IFWL_Widget* m_pWidget; + CFX_RectF m_rtOld; + CFX_RectF m_rtNew;) + +FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle) #endif // XFA_FWL_CORE_CFWL_EVENT_H_ diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 74401c3e34..db434fc1fb 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -53,31 +53,15 @@ class IFWL_Widget; class CFWL_Message { public: - CFWL_Message() - : m_pSrcTarget(nullptr), - m_pDstTarget(nullptr), - m_dwExtend(0), - m_dwRefCount(1) {} - virtual ~CFWL_Message() {} - - virtual CFWL_Message* Clone() { return nullptr; } - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { - return FWL_Error::Succeeded; - } - virtual CFWL_MessageType GetClassID() const { return CFWL_MessageType::None; } - - uint32_t Release() { - m_dwRefCount--; - uint32_t dwRefCount = m_dwRefCount; - if (!m_dwRefCount) - delete this; - return dwRefCount; - } - - CFWL_Message* Retain() { - m_dwRefCount++; - return this; - } + 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(); + CFWL_Message* Retain(); IFWL_Widget* m_pSrcTarget; IFWL_Widget* m_pDstTarget; @@ -87,91 +71,124 @@ class CFWL_Message { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \ - class classname : public CFWL_Message { \ - public: \ - classname() : CFWL_Message() {} \ - CFWL_Message* Clone() override { return new classname(*this); } \ - FWL_Error GetClassName(CFX_WideString& wsClass) const override { \ - wsClass = L## #classname; \ - return FWL_Error::Succeeded; \ - } \ - CFWL_MessageType GetClassID() const override { return msgType; } - -#define END_FWL_MESSAGE_DEF \ - } \ - ; // NOLINT - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgActivate, CFWL_MessageType::Activate) -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgDeactivate, CFWL_MessageType::Deactivate) -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgMouse, CFWL_MessageType::Mouse) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -uint32_t m_dwFlags; -FWL_MouseCommand m_dwCmd; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgMouseWheel, CFWL_MessageType::MouseWheel) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -FX_FLOAT m_fDeltaX; -FX_FLOAT m_fDeltaY; -uint32_t m_dwFlags; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgSetFocus, CFWL_MessageType::SetFocus) -IFWL_Widget* m_pKillFocus; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgKillFocus, CFWL_MessageType::KillFocus) -IFWL_Widget* m_pSetFocus; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgKey, CFWL_MessageType::Key) -uint32_t m_dwKeyCode; -uint32_t m_dwFlags; -FWL_KeyCommand m_dwCmd; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgCursor, CFWL_MessageType::Cursor) -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgSize, CFWL_MessageType::Size) -int32_t m_iWidth; -int32_t m_iHeight; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgWindowMove, CFWL_MessageType::WindowMove) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -END_FWL_MESSAGE_DEF - -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgDropFiles, CFWL_MessageType::DropFiles) -CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy) { - m_pDstTarget = copy.m_pDstTarget; - m_pSrcTarget = copy.m_pSrcTarget; - m_fx = copy.m_fx; - m_fy = copy.m_fy; - m_files.Append(copy.m_files); +inline CFWL_Message::CFWL_Message() + : m_pSrcTarget(nullptr), + m_pDstTarget(nullptr), + m_dwExtend(0), + m_dwRefCount(1) {} + +inline CFWL_Message::~CFWL_Message() {} + +inline CFWL_Message* CFWL_Message::Clone() { + return nullptr; +} + +inline FWL_Error CFWL_Message::GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } -FX_FLOAT m_fx; -FX_FLOAT m_fy; -CFX_WideStringArray m_files; -END_FWL_MESSAGE_DEF -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgTaskClicked, CFWL_MessageType::TaskClicked) -FX_FLOAT m_fx; -FX_FLOAT m_fy; -END_FWL_MESSAGE_DEF +inline CFWL_MessageType CFWL_Message::GetClassID() const { + return CFWL_MessageType::None; +} -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgClose, CFWL_MessageType::Close) -END_FWL_MESSAGE_DEF +inline uint32_t CFWL_Message::Release() { + m_dwRefCount--; + uint32_t dwRefCount = m_dwRefCount; + if (!m_dwRefCount) + delete this; + return dwRefCount; +} + +inline CFWL_Message* CFWL_Message::Retain() { + m_dwRefCount++; + return this; +} -BEGIN_FWL_MESSAGE_DEF(CFWL_MsgWindowWillMove, CFWL_MessageType::WindowWillMove) -END_FWL_MESSAGE_DEF +#define FWL_MESSAGE_CLASS_DEF(classname, msgType, ...) \ + class classname : public CFWL_Message { \ + public: \ + classname(); \ + ~classname() override; \ + CFWL_Message* Clone() override; \ + FWL_Error GetClassName(CFX_WideString& wsClass) const override; \ + CFWL_MessageType GetClassID() const override; \ + __VA_ARGS__ \ + }; + +#define FWL_MESSAGE_FUNCTION_DEF(classname, msgType, ...) \ + 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__ + +#define FWL_MESSAGE_DEF(classname, msgType, ...) \ + FWL_MESSAGE_CLASS_DEF(classname, msgType, __VA_ARGS__) \ + FWL_MESSAGE_FUNCTION_DEF(classname, msgType) + +FWL_MESSAGE_DEF(CFWL_MsgActivate, CFWL_MessageType::Activate) + +FWL_MESSAGE_DEF(CFWL_MsgDeactivate, CFWL_MessageType::Deactivate) + +FWL_MESSAGE_DEF(CFWL_MsgMouse, CFWL_MessageType::Mouse, FX_FLOAT m_fx; + FX_FLOAT m_fy; + uint32_t m_dwFlags; + FWL_MouseCommand m_dwCmd;) + +FWL_MESSAGE_DEF(CFWL_MsgMouseWheel, CFWL_MessageType::MouseWheel, FX_FLOAT m_fx; + FX_FLOAT m_fy; + FX_FLOAT m_fDeltaX; + FX_FLOAT m_fDeltaY; + uint32_t m_dwFlags;) + +FWL_MESSAGE_DEF(CFWL_MsgSetFocus, + CFWL_MessageType::SetFocus, + IFWL_Widget* m_pKillFocus;) + +FWL_MESSAGE_DEF(CFWL_MsgKillFocus, + CFWL_MessageType::KillFocus, + IFWL_Widget* m_pSetFocus;) + +FWL_MESSAGE_DEF(CFWL_MsgKey, CFWL_MessageType::Key, uint32_t m_dwKeyCode; + uint32_t m_dwFlags; + FWL_KeyCommand m_dwCmd;) + +FWL_MESSAGE_DEF(CFWL_MsgCursor, CFWL_MessageType::Cursor) + +FWL_MESSAGE_DEF(CFWL_MsgSize, CFWL_MessageType::Size, int32_t m_iWidth; + int32_t m_iHeight;) + +FWL_MESSAGE_DEF(CFWL_MsgWindowMove, CFWL_MessageType::WindowMove, FX_FLOAT m_fx; + FX_FLOAT m_fy;) + +FWL_MESSAGE_CLASS_DEF(CFWL_MsgDropFiles, + CFWL_MessageType::DropFiles, + CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy); + FX_FLOAT m_fx; + FX_FLOAT m_fy; + CFX_WideStringArray m_files;) +FWL_MESSAGE_FUNCTION_DEF( + CFWL_MsgDropFiles, + CFWL_MessageType::DropFiles, + inline CFWL_MsgDropFiles::CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy) { + m_pDstTarget = copy.m_pDstTarget; + m_pSrcTarget = copy.m_pSrcTarget; + m_fx = copy.m_fx; + m_fy = copy.m_fy; + m_files.Append(copy.m_files); + }) + +FWL_MESSAGE_DEF(CFWL_MsgTaskClicked, + CFWL_MessageType::TaskClicked, + FX_FLOAT m_fx; + FX_FLOAT m_fy;) + +FWL_MESSAGE_DEF(CFWL_MsgClose, CFWL_MessageType::Close) + +FWL_MESSAGE_DEF(CFWL_MsgWindowWillMove, CFWL_MessageType::WindowWillMove) #endif // XFA_FWL_CORE_CFWL_MESSAGE_H_ diff --git a/xfa/fwl/core/cfwl_themepart.h b/xfa/fwl/core/cfwl_themepart.h index 5bdf1530a5..c5e6cd7ff5 100644 --- a/xfa/fwl/core/cfwl_themepart.h +++ b/xfa/fwl/core/cfwl_themepart.h @@ -81,16 +81,7 @@ class IFWL_Widget; class CFWL_ThemePart { public: - CFWL_ThemePart() - : m_pWidget(nullptr), - m_iPart(CFWL_Part::None), - m_dwStates(CFWL_PartState_Normal), - m_bMaximize(false), - m_bStaticBackground(false), - m_pData(nullptr) { - m_rtPart.Reset(); - m_matrix.SetIdentity(); - } + CFWL_ThemePart(); CFX_Matrix m_matrix; CFX_RectF m_rtPart; @@ -102,4 +93,15 @@ class CFWL_ThemePart { void* m_pData; }; +inline CFWL_ThemePart::CFWL_ThemePart() + : m_pWidget(nullptr), + m_iPart(CFWL_Part::None), + m_dwStates(CFWL_PartState_Normal), + m_bMaximize(false), + m_bStaticBackground(false), + m_pData(nullptr) { + m_rtPart.Reset(); + m_matrix.SetIdentity(); +} + #endif // XFA_FWL_CORE_CFWL_THEMEPART_H_ diff --git a/xfa/fwl/core/cfwl_widgetimpproperties.h b/xfa/fwl/core/cfwl_widgetimpproperties.h index 8b1cf864d4..71b0368311 100644 --- a/xfa/fwl/core/cfwl_widgetimpproperties.h +++ b/xfa/fwl/core/cfwl_widgetimpproperties.h @@ -17,17 +17,9 @@ class IFWL_Widget; class CFWL_WidgetImpProperties { public: - CFWL_WidgetImpProperties() - : m_dwStyles(FWL_WGTSTYLE_Child), - m_dwStyleExes(0), - m_dwStates(0), - m_pThemeProvider(nullptr), - m_pDataProvider(nullptr), - m_pParent(nullptr), - m_pOwner(nullptr) { - m_ctmOnParent.SetIdentity(); - m_rtWidget.Set(0, 0, 0, 0); - } + CFWL_WidgetImpProperties(); + ~CFWL_WidgetImpProperties(); + CFWL_WidgetImpProperties(const CFWL_WidgetImpProperties& other); CFX_Matrix m_ctmOnParent; CFX_RectF m_rtWidget; @@ -40,4 +32,21 @@ class CFWL_WidgetImpProperties { IFWL_Widget* m_pOwner; }; +inline CFWL_WidgetImpProperties::CFWL_WidgetImpProperties() + : m_dwStyles(FWL_WGTSTYLE_Child), + m_dwStyleExes(0), + m_dwStates(0), + m_pThemeProvider(nullptr), + m_pDataProvider(nullptr), + m_pParent(nullptr), + m_pOwner(nullptr) { + m_ctmOnParent.SetIdentity(); + m_rtWidget.Set(0, 0, 0, 0); +} + +inline CFWL_WidgetImpProperties::~CFWL_WidgetImpProperties() {} + +inline CFWL_WidgetImpProperties::CFWL_WidgetImpProperties( + const CFWL_WidgetImpProperties& other) = default; + #endif // XFA_FWL_CORE_CFWL_WIDGETIMPPROPERTIES_H_ diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index 78d8206369..d36ab7792b 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -859,3 +859,22 @@ FX_BOOL CFWL_WidgetMgrDelegate::bUseOffscreenDirect(IFWL_Widget* pWidget) { return pItem->iRedrawCounter == 0; } + +CFWL_WidgetMgrItem::CFWL_WidgetMgrItem() : CFWL_WidgetMgrItem(nullptr) {} + +CFWL_WidgetMgrItem::CFWL_WidgetMgrItem(IFWL_Widget* widget) + : pParent(nullptr), + pOwner(nullptr), + pChild(nullptr), + pPrevious(nullptr), + pNext(nullptr), + pWidget(widget), + iRedrawCounter(0) +#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) + , + bOutsideChanged(FALSE) +#endif +{ +} + +CFWL_WidgetMgrItem::~CFWL_WidgetMgrItem() {} diff --git a/xfa/fwl/core/cfwl_widgetmgr.h b/xfa/fwl/core/cfwl_widgetmgr.h index 957f6dc428..1f0df3beb6 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.h +++ b/xfa/fwl/core/cfwl_widgetmgr.h @@ -27,22 +27,9 @@ class IFWL_Widget; class CFWL_WidgetMgrItem { public: - CFWL_WidgetMgrItem() : CFWL_WidgetMgrItem(nullptr) {} - explicit CFWL_WidgetMgrItem(IFWL_Widget* widget) - : pParent(nullptr), - pOwner(nullptr), - pChild(nullptr), - pPrevious(nullptr), - pNext(nullptr), - pWidget(widget), - iRedrawCounter(0) -#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) - , - bOutsideChanged(FALSE) -#endif - { - } - ~CFWL_WidgetMgrItem() {} + CFWL_WidgetMgrItem(); + explicit CFWL_WidgetMgrItem(IFWL_Widget* widget); + ~CFWL_WidgetMgrItem(); CFWL_WidgetMgrItem* pParent; CFWL_WidgetMgrItem* pOwner; diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp index 089a6d3693..2c4258ce74 100644 --- a/xfa/fwl/core/fwl_appimp.cpp +++ b/xfa/fwl/core/fwl_appimp.cpp @@ -18,6 +18,10 @@ IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) { return pApp; } +IFWL_App::IFWL_App() {} + +IFWL_App::~IFWL_App() {} + void IFWL_App::Release() {} FWL_Error IFWL_App::Initialize() { diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 1dcb310bd4..8b4ef9fc43 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -64,6 +64,10 @@ FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); } +RestoreResizeInfo::RestoreResizeInfo() {} + +RestoreResizeInfo::~RestoreResizeInfo() {} + CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), @@ -1128,3 +1132,41 @@ void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { eClose.m_pSrcTarget = m_pOwner->m_pInterface; m_pOwner->DispatchEvent(&eClose); } + +CFWL_SysBtn::CFWL_SysBtn() { + m_rtBtn.Set(0, 0, 0, 0); + m_dwState = 0; +} + +bool CFWL_SysBtn::IsDisabled() const { + return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); +} + +void CFWL_SysBtn::SetNormal() { + m_dwState &= 0xFFF0; +} + +void CFWL_SysBtn::SetPressed() { + SetNormal(); + m_dwState |= FWL_SYSBUTTONSTATE_Pressed; +} + +void CFWL_SysBtn::SetHover() { + SetNormal(); + m_dwState |= FWL_SYSBUTTONSTATE_Hover; +} + +void CFWL_SysBtn::SetDisabled(FX_BOOL bDisabled) { + bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled + : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; +} + +uint32_t CFWL_SysBtn::GetPartState() const { + if (IsDisabled()) + return CFWL_PartState_Disabled; + if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) + return CFWL_PartState_Pressed; + if (m_dwState & FWL_SYSBUTTONSTATE_Hover) + return CFWL_PartState_Hovered; + return CFWL_PartState_Normal; +} diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index 1f2d6951c0..7278afb681 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -27,35 +27,15 @@ class CFWL_FormImpDelegate; class CFWL_SysBtn { public: - CFWL_SysBtn() { - m_rtBtn.Set(0, 0, 0, 0); - m_dwState = 0; - } - - bool IsDisabled() { return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); } - - void SetNormal() { m_dwState &= 0xFFF0; } - void SetPressed() { - SetNormal(); - m_dwState |= FWL_SYSBUTTONSTATE_Pressed; - } - void SetHover() { - SetNormal(); - m_dwState |= FWL_SYSBUTTONSTATE_Hover; - } - void SetDisabled(FX_BOOL bDisabled) { - bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled - : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; - } - uint32_t GetPartState() { - if (IsDisabled()) - return CFWL_PartState_Disabled; - if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) - return CFWL_PartState_Pressed; - if (m_dwState & FWL_SYSBUTTONSTATE_Hover) - return CFWL_PartState_Hovered; - return CFWL_PartState_Normal; - } + CFWL_SysBtn(); + + bool IsDisabled() const; + uint32_t GetPartState() const; + + void SetNormal(); + void SetPressed(); + void SetHover(); + void SetDisabled(FX_BOOL bDisabled); CFX_RectF m_rtBtn; uint32_t m_dwState; @@ -67,6 +47,9 @@ enum FORM_RESIZETYPE { }; typedef struct RestoreResizeInfo { + RestoreResizeInfo(); + ~RestoreResizeInfo(); + CFX_PointF m_ptStart; CFX_SizeF m_szStart; } RestoreInfo; diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 9518a08f00..b38592b2d3 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -668,11 +668,14 @@ void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { public: - FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); - int32_t GetInitialDelay(IFWL_Widget* pWidget); - int32_t GetAutoPopDelay(IFWL_Widget* pWidget); - CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); - CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget); + // IFWL_ToolTipDP + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + int32_t GetInitialDelay(IFWL_Widget* pWidget) override; + int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override; + CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override; + CFX_RectF GetAnchor(); CFWL_CoreToolTipDP(); @@ -681,34 +684,46 @@ class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { int32_t m_nAutoPopDelayTime; CFX_RectF m_fAnchor; }; + CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { m_nInitDelayTime = 500; m_nAutoPopDelayTime = 50000; m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); } + FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { wsCaption = m_wsCaption; return FWL_Error::Succeeded; } + int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { return m_nInitDelayTime; } + int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { return m_nAutoPopDelayTime; } + CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { return NULL; } + CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { return CFX_SizeF(); } + CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { return m_fAnchor; } + +CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, + IFWL_Widget* pListener) + : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} CFWL_EventTarget::~CFWL_EventTarget() { m_eventSources.RemoveAll(); } + int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, uint32_t dwFilter) { if (pSource) { diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 9116e31e08..eb922f916c 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -121,9 +121,9 @@ class CFWL_NoteDriver { class CFWL_EventTarget { public: - CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener) - : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} + CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener); ~CFWL_EventTarget(); + int32_t SetEventSource(IFWL_Widget* pSource, uint32_t dwFilter = FWL_EVENT_ALL_MASK); FX_BOOL ProcessEvent(CFWL_Event* pEvent); diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index 27f8a44c79..d556499e27 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -10,7 +10,6 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/basewidget/ifwl_combobox.h" -#include "xfa/fwl/basewidget/ifwl_datetimepicker.h" #include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" @@ -21,6 +20,7 @@ #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_form.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +#include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxfa/include/xfa_ffapp.h" #define FWL_STYLEEXT_MNU_Vert (1L << 0) diff --git a/xfa/fwl/core/ifwl_app.h b/xfa/fwl/core/ifwl_app.h index 5fbac6644f..27c65c8317 100644 --- a/xfa/fwl/core/ifwl_app.h +++ b/xfa/fwl/core/ifwl_app.h @@ -32,7 +32,7 @@ class IFWL_App { public: static IFWL_App* Create(CXFA_FFApp* pAdapter); - virtual ~IFWL_App() {} + virtual ~IFWL_App(); FWL_Error Initialize(); FWL_Error Finalize(); @@ -53,7 +53,7 @@ class IFWL_App { CFWL_NoteDriver* GetNoteDriver() const; private: - IFWL_App() {} + IFWL_App(); std::unique_ptr<CFWL_AppImp> m_pImpl; }; diff --git a/xfa/fwl/core/ifwl_tooltiptarget.h b/xfa/fwl/core/ifwl_tooltiptarget.h index 7489e73efd..c6a47d0e09 100644 --- a/xfa/fwl/core/ifwl_tooltiptarget.h +++ b/xfa/fwl/core/ifwl_tooltiptarget.h @@ -26,9 +26,11 @@ class IFWL_ToolTipTarget { virtual FX_BOOL UseDefaultTheme() = 0; virtual FWL_Error GetCaption(CFX_WideString& wsCaption) = 0; virtual FWL_Error GetToolTipSize(CFX_SizeF& sz) = 0; - virtual FWL_Error GetToolTipPos(CFX_PointF& pt) { - return FWL_Error::Indefinite; - } + virtual FWL_Error GetToolTipPos(CFX_PointF& pt); }; +inline FWL_Error GetToolTipPos(CFX_PointF& pt) { + return FWL_Error::Indefinite; +} + #endif // XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_ diff --git a/xfa/fwl/lightwidget/cfwl_barcode.cpp b/xfa/fwl/lightwidget/cfwl_barcode.cpp index 4b998d04d7..2e29d63f34 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.cpp +++ b/xfa/fwl/lightwidget/cfwl_barcode.cpp @@ -44,7 +44,67 @@ FX_BOOL CFWL_Barcode::IsProtectedType() { return 0; return static_cast<IFWL_Barcode*>(m_pIface)->IsProtectedType(); } + +CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP() + : m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {} + FWL_Error CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { return FWL_Error::Succeeded; } + +BC_CHAR_ENCODING CFWL_Barcode::CFWL_BarcodeDP::GetCharEncoding() { + return m_eCharEncoding; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleHeight() { + return m_nModuleHeight; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleWidth() { + return m_nModuleWidth; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() { + return m_nDataLength; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() { + return m_nCalChecksum; +} + +FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() { + return m_bPrintChecksum; +} + +BC_TEXT_LOC CFWL_Barcode::CFWL_BarcodeDP::GetTextLocation() { + return m_eTextLocation; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetWideNarrowRatio() { + return m_nWideNarrowRatio; +} + +FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetStartChar() { + return m_cStartChar; +} + +FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetEndChar() { + return m_cEndChar; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetVersion() { + return m_nVersion; +} + +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() { + return m_nECLevel; +} + +FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() { + return m_bTruncated; +} + +uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() { + return m_dwAttributeMask; +} diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h index 565ebb884e..1a22064a97 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.h +++ b/xfa/fwl/lightwidget/cfwl_barcode.h @@ -80,28 +80,31 @@ class CFWL_Barcode : public CFWL_Edit { protected: CFWL_Barcode(); - virtual ~CFWL_Barcode(); + ~CFWL_Barcode() override; class CFWL_BarcodeDP : public IFWL_BarcodeDP { public: - CFWL_BarcodeDP() : m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {} + CFWL_BarcodeDP(); + // IFWL_DataProvider FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - BC_CHAR_ENCODING GetCharEncoding() override { return m_eCharEncoding; } - int32_t GetModuleHeight() override { return m_nModuleHeight; } - int32_t GetModuleWidth() override { return m_nModuleWidth; } - int32_t GetDataLength() override { return m_nDataLength; } - int32_t GetCalChecksum() override { return m_nCalChecksum; } - FX_BOOL GetPrintChecksum() override { return m_bPrintChecksum; } - BC_TEXT_LOC GetTextLocation() override { return m_eTextLocation; } - int32_t GetWideNarrowRatio() override { return m_nWideNarrowRatio; } - FX_CHAR GetStartChar() override { return m_cStartChar; } - FX_CHAR GetEndChar() override { return m_cEndChar; } - int32_t GetVersion() override { return m_nVersion; } - int32_t GetErrorCorrectionLevel() override { return m_nECLevel; } - FX_BOOL GetTruncated() override { return m_bTruncated; } - uint32_t GetBarcodeAttributeMask() override { return m_dwAttributeMask; } + + // IFWL_BarcodeDP + BC_CHAR_ENCODING GetCharEncoding() override; + int32_t GetModuleHeight() override; + int32_t GetModuleWidth() override; + int32_t GetDataLength() override; + int32_t GetCalChecksum() override; + FX_BOOL GetPrintChecksum() override; + BC_TEXT_LOC GetTextLocation() override; + int32_t GetWideNarrowRatio() override; + FX_CHAR GetStartChar() override; + FX_CHAR GetEndChar() override; + int32_t GetVersion() override; + int32_t GetErrorCorrectionLevel() override; + FX_BOOL GetTruncated() override; + uint32_t GetBarcodeAttributeMask() override; BC_CHAR_ENCODING m_eCharEncoding; int32_t m_nModuleHeight, m_nModuleWidth; diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h index 061e46f777..7fcd43a6eb 100644 --- a/xfa/fwl/lightwidget/cfwl_checkbox.h +++ b/xfa/fwl/lightwidget/cfwl_checkbox.h @@ -12,27 +12,33 @@ class CFWL_CheckBox : public CFWL_Widget { public: + CFWL_CheckBox(); + ~CFWL_CheckBox() override; + static CFWL_CheckBox* Create(); FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_Error GetCaption(CFX_WideString& wsCaption); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); FWL_Error SetBoxSize(FX_FLOAT fHeight); int32_t GetCheckState(); FWL_Error SetCheckState(int32_t iCheck); - CFWL_CheckBox(); - virtual ~CFWL_CheckBox(); protected: class CFWL_CheckBoxDP : public IFWL_CheckBoxDP { public: CFWL_CheckBoxDP(); - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption); - virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget); + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_CheckBoxDP + FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override; + FX_FLOAT m_fBoxHeight; CFX_WideString m_wsCaption; }; + CFWL_CheckBoxDP m_checkboxData; }; diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index 934b0d856e..9d20c97824 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -290,6 +290,12 @@ CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() { CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {} +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetCaption( + IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; +} + int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(IFWL_Widget* pWidget) { return m_ItemArray.size(); } @@ -427,3 +433,7 @@ FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState( FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { return m_fMaxListHeight; } + +CFWL_ComboBoxItem::CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} + +CFWL_ComboBoxItem::~CFWL_ComboBoxItem() {} diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index a708589d4f..ba5db16f87 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -20,6 +20,9 @@ class CFWL_ComboBoxItem; class CFWL_ComboBox : public CFWL_Widget { public: + CFWL_ComboBox(); + ~CFWL_ComboBox() override; + static CFWL_ComboBox* Create(); FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); int32_t AddString(const CFX_WideStringC& wsText); @@ -65,58 +68,59 @@ class CFWL_ComboBox : public CFWL_Widget { FWL_Error GetBBox(CFX_RectF& rect); FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - CFWL_ComboBox(); - virtual ~CFWL_ComboBox(); protected: class CFWL_ComboBoxDP : public IFWL_ComboBoxDP { public: CFWL_ComboBoxDP(); - ~CFWL_ComboBoxDP(); - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; - } - - virtual int32_t CountItems(IFWL_Widget* pWidget); - virtual IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex); - virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem); - virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex); - - virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem); - virtual FWL_Error GetItemText(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_WideString& wsText); - virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_RectF& rtItem); - virtual void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem); - virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - uint32_t dwStyle); - virtual FWL_Error SetItemText(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - const FX_WCHAR* pszText); - virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - const CFX_RectF& rtItem); - virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget); - virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, - IFWL_ListItem* pItem); - virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_RectF& rtCheck); - virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - const CFX_RectF& rtCheck); - virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, - IFWL_ListItem* pItem); - virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - uint32_t dwCheckState); - virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget); + ~CFWL_ComboBoxDP() override; + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_ListBoxDP + int32_t CountItems(IFWL_Widget* pWidget) override; + IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) override; + int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + FX_BOOL SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) override; + + uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + FWL_Error GetItemText(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_WideString& wsText) override; + FWL_Error GetItemRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_RectF& rtItem) override; + void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + FWL_Error SetItemStyles(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + uint32_t dwStyle) override; + FWL_Error SetItemText(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const FX_WCHAR* pszText) override; + FWL_Error SetItemRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const CFX_RectF& rtItem) override; + FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, + IFWL_ListItem* pItem) override; + FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_RectF& rtCheck) override; + FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const CFX_RectF& rtCheck) override; + uint32_t GetItemCheckState(IFWL_Widget* pWidget, + IFWL_ListItem* pItem) override; + FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + uint32_t dwCheckState) override; + + // IFWL_ComboBoxDP + FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray; FX_FLOAT m_fMaxListHeight; @@ -127,7 +131,8 @@ class CFWL_ComboBox : public CFWL_Widget { class CFWL_ComboBoxItem : public IFWL_ListItem { public: - CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} + CFWL_ComboBoxItem(); + ~CFWL_ComboBoxItem(); CFX_RectF m_rtItem; uint32_t m_dwStyles; diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h index b4349d0cb0..2fa385fede 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h @@ -13,6 +13,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { public: static CFWL_DateTimePicker* Create(); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); FWL_Error GetEditText(CFX_WideString& wsText); @@ -40,22 +41,28 @@ class CFWL_DateTimePicker : public CFWL_Widget { uint32_t dwStylesExRemoved); protected: - CFWL_DateTimePicker(); - virtual ~CFWL_DateTimePicker(); class CFWL_DateTimePickerDP : public IFWL_DateTimePickerDP { public: CFWL_DateTimePickerDP(); - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption); - virtual FWL_Error GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay); + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_DateTimePickerDP + FWL_Error GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) override; int32_t m_iYear; int32_t m_iMonth; int32_t m_iDay; CFX_WideString m_wsData; }; + + CFWL_DateTimePicker(); + ~CFWL_DateTimePicker() override; + CFWL_DateTimePickerDP m_DateTimePickerDP; }; diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h index 349b380670..a9c058a514 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.h +++ b/xfa/fwl/lightwidget/cfwl_edit.h @@ -16,6 +16,9 @@ class IFDE_TxtEdtDoRecord; class CFWL_Edit : public CFWL_Widget { public: + CFWL_Edit(); + ~CFWL_Edit() override; + static CFWL_Edit* Create(); FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); FWL_Error SetText(const CFX_WideString& wsText); @@ -60,8 +63,6 @@ class CFWL_Edit : public CFWL_Widget { std::vector<CFX_ByteString>& sSuggest); FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, const CFX_ByteStringC& bsReplace); - CFWL_Edit(); - virtual ~CFWL_Edit(); }; #endif // XFA_FWL_LIGHTWIDGET_CFWL_EDIT_H_ diff --git a/xfa/fwl/lightwidget/cfwl_listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp index d51db44f3b..be6a6b1249 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.cpp +++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp @@ -341,3 +341,15 @@ FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState( static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; return FWL_Error::Succeeded; } + +CFWL_ListItem::CFWL_ListItem() { + m_rtItem.Reset(); + m_dwStates = 0; + m_wsText = L""; + m_pDIB = NULL; + m_pData = NULL; + m_dwCheckState = 0; + m_rtCheckBox.Reset(); +} + +CFWL_ListItem::~CFWL_ListItem() {} diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h index 7d79893fa6..c684015b61 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.h +++ b/xfa/fwl/lightwidget/cfwl_listbox.h @@ -19,6 +19,9 @@ class CFWL_ListItem; class CFWL_ListBox : public CFWL_Widget { public: + CFWL_ListBox(); + ~CFWL_ListBox() override; + static CFWL_ListBox* Create(); FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); @@ -43,14 +46,12 @@ class CFWL_ListBox : public CFWL_Widget { void* GetItemData(IFWL_ListItem* pItem); IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); uint32_t GetItemStates(IFWL_ListItem* pItem); - CFWL_ListBox(); - virtual ~CFWL_ListBox(); protected: class CFWL_ListBoxDP : public IFWL_ListBoxDP { public: CFWL_ListBoxDP(); - ~CFWL_ListBoxDP(); + ~CFWL_ListBoxDP() override; // IFWL_DataProvider: FWL_Error GetCaption(IFWL_Widget* pWidget, @@ -105,15 +106,9 @@ class CFWL_ListBox : public CFWL_Widget { class CFWL_ListItem : public IFWL_ListItem { public: - CFWL_ListItem() { - m_rtItem.Reset(); - m_dwStates = 0; - m_wsText = L""; - m_pDIB = NULL; - m_pData = NULL; - m_dwCheckState = 0; - m_rtCheckBox.Reset(); - } + CFWL_ListItem(); + ~CFWL_ListItem(); + CFX_RectF m_rtItem; uint32_t m_dwStates; CFX_WideString m_wsText; diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.cpp b/xfa/fwl/lightwidget/cfwl_picturebox.cpp index f3f52ab993..33b11cd8b5 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.cpp +++ b/xfa/fwl/lightwidget/cfwl_picturebox.cpp @@ -97,6 +97,16 @@ CFWL_PictureBox::CFWL_PictureBox() {} CFWL_PictureBox::~CFWL_PictureBox() {} +CFWL_PictureBox::CFWL_PictureBoxDP::CFWL_PictureBoxDP() + : m_pBitmap(nullptr), + m_iOpacity(0), + m_iFlipMode(0), + m_fRotation(0.0f), + m_fScaleX(1.0f), + m_fScaleY(1.0f), + m_fOffSetX(0.0f), + m_fOffSetY(0.0f) {} + FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption( IFWL_Widget* pWidget, CFX_WideString& wsCaption) { diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h index 8b0b13de24..95a0117224 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.h +++ b/xfa/fwl/lightwidget/cfwl_picturebox.h @@ -13,7 +13,11 @@ class CFWL_PictureBox : public CFWL_Widget { public: + CFWL_PictureBox(); + ~CFWL_PictureBox() override; + static CFWL_PictureBox* Create(); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); @@ -27,28 +31,24 @@ class CFWL_PictureBox : public CFWL_Widget { FWL_Error SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY); FWL_Error GetOffset(FX_FLOAT& fx, FX_FLOAT& fy); FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy); - CFWL_PictureBox(); - virtual ~CFWL_PictureBox(); protected: class CFWL_PictureBoxDP : public IFWL_PictureBoxDP { public: - CFWL_PictureBoxDP() { - m_fRotation = 0.0f; - m_fScaleX = 1.0f; - m_fScaleY = 1.0f; - m_fOffSetX = 0.0f; - m_fOffSetY = 0.0f; - m_pBitmap = NULL; - } - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption); - virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget); - virtual CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget); - virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget); - virtual int32_t GetOpacity(IFWL_Widget* pWidget); - virtual int32_t GetFlipMode(IFWL_Widget* pWidget); - virtual FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); + CFWL_PictureBoxDP(); + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_PictureBoxDP + CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) override; + int32_t GetOpacity(IFWL_Widget* pWidget) override; + int32_t GetFlipMode(IFWL_Widget* pWidget) override; + FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; + CFX_DIBitmap* m_pBitmap; int32_t m_iOpacity; int32_t m_iFlipMode; @@ -59,6 +59,7 @@ class CFWL_PictureBox : public CFWL_Widget { FX_FLOAT m_fOffSetY; CFX_WideString m_wsData; }; + CFWL_PictureBoxDP m_PictureBoxDP; }; diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h index 5ca3dded37..145f5ed6f0 100644 --- a/xfa/fwl/lightwidget/cfwl_pushbutton.h +++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h @@ -12,24 +12,33 @@ class CFWL_PushButton : public CFWL_Widget { public: + CFWL_PushButton(); + ~CFWL_PushButton() override; + static CFWL_PushButton* Create(); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); FWL_Error GetCaption(CFX_WideString& wsCaption); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); - CFWL_PushButton(); - virtual ~CFWL_PushButton(); protected: class CFWL_PushButtonDP : public IFWL_PushButtonDP { public: CFWL_PushButtonDP() : m_pBitmap(NULL) {} - FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); - virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget); + + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_PushButtonDP + CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; + CFX_WideString m_wsCaption; CFX_DIBitmap* m_pBitmap; }; + CFWL_PushButtonDP m_buttonData; }; diff --git a/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp b/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp index 9afa1b6959..31e1dda687 100644 --- a/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp +++ b/xfa/fwl/lightwidget/cfwl_widgetproperties.cpp @@ -8,6 +8,20 @@ #include "xfa/fwl/lightwidget/cfwl_widget.h" +CFWL_WidgetProperties::CFWL_WidgetProperties() + : m_dwStyles(FWL_WGTSTYLE_Child), + m_dwStyleExes(0), + m_dwStates(0), + m_pParent(nullptr), + m_pOwner(nullptr) { + m_rtWidget.Set(0, 0, 0, 0); +} + +CFWL_WidgetProperties::~CFWL_WidgetProperties() {} + +CFWL_WidgetProperties::CFWL_WidgetProperties( + const CFWL_WidgetProperties& other) = default; + CFWL_WidgetImpProperties CFWL_WidgetProperties::MakeWidgetImpProperties( IFWL_DataProvider* pDataProvider) const { CFWL_WidgetImpProperties result; diff --git a/xfa/fwl/lightwidget/cfwl_widgetproperties.h b/xfa/fwl/lightwidget/cfwl_widgetproperties.h index 2a3e3ffefb..5d4116e62d 100644 --- a/xfa/fwl/lightwidget/cfwl_widgetproperties.h +++ b/xfa/fwl/lightwidget/cfwl_widgetproperties.h @@ -17,14 +17,9 @@ class IFWL_DataProvider; class CFWL_WidgetProperties { public: - CFWL_WidgetProperties() - : m_dwStyles(FWL_WGTSTYLE_Child), - m_dwStyleExes(0), - m_dwStates(0), - m_pParent(nullptr), - m_pOwner(nullptr) { - m_rtWidget.Set(0, 0, 0, 0); - } + CFWL_WidgetProperties(); + ~CFWL_WidgetProperties(); + CFWL_WidgetProperties(const CFWL_WidgetProperties& other); CFWL_WidgetImpProperties MakeWidgetImpProperties( IFWL_DataProvider* pDataProvider) const; |