summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/include/fwl/basewidget/fwl_barcode.h8
-rw-r--r--xfa/include/fwl/basewidget/fwl_caret.h11
-rw-r--r--xfa/include/fwl/basewidget/fwl_checkbox.h19
-rw-r--r--xfa/include/fwl/basewidget/fwl_combobox.h8
-rw-r--r--xfa/include/fwl/basewidget/fwl_datetimepicker.h9
-rw-r--r--xfa/include/fwl/basewidget/fwl_edit.h10
-rw-r--r--xfa/include/fwl/basewidget/fwl_listbox.h11
-rw-r--r--xfa/include/fwl/basewidget/fwl_monthcalendar.h5
-rw-r--r--xfa/include/fwl/basewidget/fwl_picturebox.h7
-rw-r--r--xfa/include/fwl/basewidget/fwl_pushbutton.h6
-rw-r--r--xfa/include/fwl/basewidget/fwl_scrollbar.h9
-rw-r--r--xfa/include/fwl/basewidget/fwl_spinbutton.h9
-rw-r--r--xfa/include/fwl/basewidget/fwl_tooltipctrl.h9
-rw-r--r--xfa/include/fwl/core/fwl_form.h12
-rw-r--r--xfa/include/fwl/core/fwl_grid.h4
-rw-r--r--xfa/include/fwl/core/fwl_panel.h12
-rw-r--r--xfa/include/fwl/core/fwl_target.h4
-rw-r--r--xfa/include/fwl/core/fwl_widget.h6
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp25
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_caretimp.cpp34
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp44
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp95
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp91
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp65
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp3
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_listboximp.cpp45
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp44
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp27
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp23
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp50
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp33
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp27
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_caretimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h11
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h29
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_editimp.h4
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h1
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_listboximp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h3
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h3
-rw-r--r--xfa/src/fwl/src/core/fwl_contentimp.cpp20
-rw-r--r--xfa/src/fwl/src/core/fwl_formimp.cpp56
-rw-r--r--xfa/src/fwl/src/core/fwl_gridimp.cpp38
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp8
-rw-r--r--xfa/src/fwl/src/core/fwl_panelimp.cpp44
-rw-r--r--xfa/src/fwl/src/core/fwl_targetimp.cpp1
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp38
-rw-r--r--xfa/src/fwl/src/core/include/fwl_contentimp.h7
-rw-r--r--xfa/src/fwl/src/core/include/fwl_formimp.h4
-rw-r--r--xfa/src/fwl/src/core/include/fwl_gridimp.h3
-rw-r--r--xfa/src/fwl/src/core/include/fwl_panelimp.h3
-rw-r--r--xfa/src/fwl/src/core/include/fwl_widgetimp.h3
-rw-r--r--xfa/src/fwl/src/lightwidget/barcode.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/caret.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/checkbox.cpp30
-rw-r--r--xfa/src/fwl/src/lightwidget/combobox.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/datetimepicker.cpp20
-rw-r--r--xfa/src/fwl/src/lightwidget/edit.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/listbox.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/picturebox.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/pushbutton.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/scrollbar.cpp16
-rw-r--r--xfa/src/fwl/src/lightwidget/tooltipctrl.cpp16
-rw-r--r--xfa/src/fwl/src/theme/checkboxtp.cpp6
-rw-r--r--xfa/src/fxfa/src/app/xfa_fwltheme.cpp1
71 files changed, 537 insertions, 729 deletions
diff --git a/xfa/include/fwl/basewidget/fwl_barcode.h b/xfa/include/fwl/basewidget/fwl_barcode.h
index 28b40baad1..b55630f4e2 100644
--- a/xfa/include/fwl/basewidget/fwl_barcode.h
+++ b/xfa/include/fwl/basewidget/fwl_barcode.h
@@ -47,12 +47,14 @@ class IFWL_BarcodeDP : public IFWL_EditDP {
virtual FX_BOOL GetTruncated() = 0;
virtual FX_DWORD GetBarcodeAttributeMask() = 0;
};
+
class IFWL_Barcode : public IFWL_Edit {
public:
- IFWL_Barcode();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_Barcode* Create(const CFWL_WidgetImpProperties& properties);
void SetType(BC_TYPE type);
FX_BOOL IsProtectedType();
+
+ protected:
+ IFWL_Barcode();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_caret.h b/xfa/include/fwl/basewidget/fwl_caret.h
index d2e8a807ce..0e5a0c2afe 100644
--- a/xfa/include/fwl/basewidget/fwl_caret.h
+++ b/xfa/include/fwl/basewidget/fwl_caret.h
@@ -14,17 +14,18 @@ class IFWL_Caret;
#define FWL_STATE_CAT_HightLight 1
#define FWL_PART_CAT_Background 1
#define FWL_PARTSTATE_CAT_HightLight 1
+
class IFWL_Caret : public IFWL_Widget {
public:
- IFWL_Caret();
-
- FWL_ERR Initialize(IFWL_Widget* pOuter = NULL);
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_Caret* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE);
FWL_ERR GetFrequency(FX_DWORD& elapse);
FWL_ERR SetFrequency(FX_DWORD elapse);
FWL_ERR SetColor(CFX_Color crFill);
+
+ protected:
+ IFWL_Caret();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_checkbox.h b/xfa/include/fwl/basewidget/fwl_checkbox.h
index 3e08a63972..f6102d6150 100644
--- a/xfa/include/fwl/basewidget/fwl_checkbox.h
+++ b/xfa/include/fwl/basewidget/fwl_checkbox.h
@@ -11,9 +11,7 @@ class IFWL_Widget;
class IFWL_CheckBoxDP;
class IFWL_CheckBox;
#define FWL_CLASS_CheckBox L"FWL_CHECKBOX"
-#define FWL_CLASS_RadioButton L"FWL_RADIOBUTTON"
#define FWL_CLASSHASH_CheckBox 4107183823
-#define FWL_CLASSHASH_RadioButton 3811304691
#define FWL_STYLEEXT_CKB_Left (0L << 0)
#define FWL_STYLEEXT_CKB_Center (1L << 0)
#define FWL_STYLEEXT_CKB_Right (2L << 0)
@@ -68,21 +66,16 @@ class IFWL_CheckBoxDP : public IFWL_DataProvider {
public:
virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0;
};
+
class IFWL_CheckBox : public IFWL_Widget {
public:
- IFWL_CheckBox();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_CheckBox* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
int32_t GetCheckState();
FWL_ERR SetCheckState(int32_t iCheck);
+ protected:
+ IFWL_CheckBox();
};
-class IFWL_RadioButton : public IFWL_Widget {
- public:
- IFWL_RadioButton();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- int32_t GetCheckState();
- FWL_ERR SetCheckState(int32_t iCheck);
-};
+
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_combobox.h b/xfa/include/fwl/basewidget/fwl_combobox.h
index 184d0107a4..7fa9bddc3d 100644
--- a/xfa/include/fwl/basewidget/fwl_combobox.h
+++ b/xfa/include/fwl/basewidget/fwl_combobox.h
@@ -97,9 +97,8 @@ class IFWL_ComboBoxDP : public IFWL_ListBoxDP {
};
class IFWL_ComboBox : public IFWL_Widget {
public:
- IFWL_ComboBox();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties);
+
int32_t GetCurSel();
FWL_ERR SetCurSel(int32_t iSel);
FWL_ERR SetEditText(const CFX_WideString& wsText);
@@ -133,5 +132,8 @@ class IFWL_ComboBox : public IFWL_Widget {
FWL_ERR GetBBox(CFX_RectF& rect);
FWL_ERR EditModifyStylesEx(FX_DWORD dwStylesExAdded,
FX_DWORD dwStylesExRemoved);
+
+ protected:
+ IFWL_ComboBox();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_datetimepicker.h b/xfa/include/fwl/basewidget/fwl_datetimepicker.h
index 1f3750aaca..15ba0eaeff 100644
--- a/xfa/include/fwl/basewidget/fwl_datetimepicker.h
+++ b/xfa/include/fwl/basewidget/fwl_datetimepicker.h
@@ -70,9 +70,9 @@ class IFWL_DateTimePickerDP : public IFWL_DataProvider {
};
class IFWL_DateTimePicker : public IFWL_Widget {
public:
- IFWL_DateTimePicker();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
FWL_ERR SetEditText(const CFX_WideString& wsText);
@@ -98,5 +98,8 @@ class IFWL_DateTimePicker : public IFWL_Widget {
FWL_ERR SetEditLimit(int32_t nLimit);
FWL_ERR ModifyEditStylesEx(FX_DWORD dwStylesExAdded,
FX_DWORD dwStylesExRemoved);
+
+ protected:
+ IFWL_DateTimePicker();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_edit.h b/xfa/include/fwl/basewidget/fwl_edit.h
index 207e6ef614..da7398a2ca 100644
--- a/xfa/include/fwl/basewidget/fwl_edit.h
+++ b/xfa/include/fwl/basewidget/fwl_edit.h
@@ -112,10 +112,11 @@ class IFWL_EditDP : public IFWL_DataProvider {};
typedef struct _FWL_HEDTFIND { void* pData; } * FWL_HEDTFIND;
class IFWL_Edit : public IFWL_Widget {
public:
- IFWL_Edit();
+ static IFWL_Edit* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ static IFWL_Edit* CreateComboEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
FWL_ERR SetText(const CFX_WideString& wsText);
int32_t GetTextLength() const;
FWL_ERR GetText(CFX_WideString& wsText,
@@ -159,5 +160,8 @@ class IFWL_Edit : public IFWL_Widget {
FX_BOOL GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray& sSuggest);
FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
const CFX_ByteStringC& bsReplace);
+
+ protected:
+ IFWL_Edit();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_listbox.h b/xfa/include/fwl/basewidget/fwl_listbox.h
index cc2fe91feb..1d585881d3 100644
--- a/xfa/include/fwl/basewidget/fwl_listbox.h
+++ b/xfa/include/fwl/basewidget/fwl_listbox.h
@@ -109,10 +109,12 @@ class IFWL_ListBoxCompare {
};
class IFWL_ListBox : public IFWL_Widget {
public:
- IFWL_ListBox();
+ static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ static IFWL_ListBox* CreateComboList(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
int32_t CountSelItems();
FWL_HLISTITEM GetSelItem(int32_t nIndexSel);
int32_t GetSelIndex(int32_t nIndex);
@@ -120,5 +122,8 @@ class IFWL_ListBox : public IFWL_Widget {
FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText);
FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
FWL_ERR* Sort(IFWL_ListBoxCompare* pCom);
+
+ protected:
+ IFWL_ListBox();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_monthcalendar.h b/xfa/include/fwl/basewidget/fwl_monthcalendar.h
index 23bc0ea712..c1c3001825 100644
--- a/xfa/include/fwl/basewidget/fwl_monthcalendar.h
+++ b/xfa/include/fwl/basewidget/fwl_monthcalendar.h
@@ -114,10 +114,9 @@ class IFWL_MonthCalendarDP : public IFWL_DataProvider {
};
class IFWL_MonthCalendar : public IFWL_Widget {
public:
- static IFWL_MonthCalendar* Create();
+ static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
int32_t CountSelect();
FX_BOOL GetSelect(int32_t& iYear,
int32_t& iMonth,
diff --git a/xfa/include/fwl/basewidget/fwl_picturebox.h b/xfa/include/fwl/basewidget/fwl_picturebox.h
index b55d4c30d9..d0eefdea1d 100644
--- a/xfa/include/fwl/basewidget/fwl_picturebox.h
+++ b/xfa/include/fwl/basewidget/fwl_picturebox.h
@@ -40,10 +40,13 @@ class IFWL_PictureBoxDP : public IFWL_DataProvider {
virtual int32_t GetFlipMode(IFWL_Widget* pWidget) = 0;
virtual FWL_ERR GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0;
};
+
class IFWL_PictureBox : public IFWL_Widget {
public:
+ static IFWL_PictureBox* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ protected:
IFWL_PictureBox();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_pushbutton.h b/xfa/include/fwl/basewidget/fwl_pushbutton.h
index e0239190ad..953fb01893 100644
--- a/xfa/include/fwl/basewidget/fwl_pushbutton.h
+++ b/xfa/include/fwl/basewidget/fwl_pushbutton.h
@@ -45,8 +45,10 @@ class IFWL_PushButtonDP : public IFWL_DataProvider {
};
class IFWL_PushButton : public IFWL_Widget {
public:
+ static IFWL_PushButton* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ protected:
IFWL_PushButton();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_scrollbar.h b/xfa/include/fwl/basewidget/fwl_scrollbar.h
index 10ce5f2688..04263a8967 100644
--- a/xfa/include/fwl/basewidget/fwl_scrollbar.h
+++ b/xfa/include/fwl/basewidget/fwl_scrollbar.h
@@ -47,9 +47,9 @@ enum FWL_SCBCODE {
class IFWL_ScrollBarDP : public IFWL_DataProvider {};
class IFWL_ScrollBar : public IFWL_Widget {
public:
- IFWL_ScrollBar();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_ScrollBar* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
FX_BOOL IsVertical();
FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax);
FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax);
@@ -62,5 +62,8 @@ class IFWL_ScrollBar : public IFWL_Widget {
FX_FLOAT GetTrackPos();
FWL_ERR SetTrackPos(FX_FLOAT fTrackPos);
FX_BOOL DoScroll(FX_DWORD dwCode, FX_FLOAT fPos = 0.0f);
+
+ protected:
+ IFWL_ScrollBar();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_spinbutton.h b/xfa/include/fwl/basewidget/fwl_spinbutton.h
index 79e3f68b5b..efcfa22a49 100644
--- a/xfa/include/fwl/basewidget/fwl_spinbutton.h
+++ b/xfa/include/fwl/basewidget/fwl_spinbutton.h
@@ -30,10 +30,13 @@ END_FWL_EVENT_DEF
class IFWL_SpinButton : public IFWL_Widget {
public:
- IFWL_SpinButton();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_SpinButton* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
FWL_ERR EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE);
FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE);
+
+ protected:
+ IFWL_SpinButton();
};
#endif
diff --git a/xfa/include/fwl/basewidget/fwl_tooltipctrl.h b/xfa/include/fwl/basewidget/fwl_tooltipctrl.h
index ac467556d8..7205c37cd7 100644
--- a/xfa/include/fwl/basewidget/fwl_tooltipctrl.h
+++ b/xfa/include/fwl/basewidget/fwl_tooltipctrl.h
@@ -31,11 +31,14 @@ class IFWL_ToolTipDP : public IFWL_DataProvider {
};
class IFWL_ToolTip : public IFWL_Form {
public:
- IFWL_ToolTip();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
FWL_ERR SetAnchor(const CFX_RectF& rtAnchor);
FWL_ERR Show();
FWL_ERR Hide();
+
+ protected:
+ IFWL_ToolTip();
};
#endif
diff --git a/xfa/include/fwl/core/fwl_form.h b/xfa/include/fwl/core/fwl_form.h
index 439d1cb554..52a2f5c479 100644
--- a/xfa/include/fwl/core/fwl_form.h
+++ b/xfa/include/fwl/core/fwl_form.h
@@ -63,17 +63,21 @@ enum FWL_COMMANDID {
FWL_COMMANDID_Yes,
FWL_COMMANDID_No,
};
+
class IFWL_Form : public IFWL_Panel {
public:
- IFWL_Form();
- FWL_ERR Initialize(CFWL_WidgetImpProperties& properties,
- CFX_WideString* classname,
- IFWL_Widget* pOuter);
+ static IFWL_Form* CreateFormProxy(CFWL_WidgetImpProperties& properties,
+ CFX_WideString* classname,
+ IFWL_Widget* pOuter);
+
FWL_FORMSIZE GetFormSize();
FWL_ERR SetFormSize(FWL_FORMSIZE eFormSize);
IFWL_Widget* DoModal();
IFWL_Widget* DoModal(FX_DWORD& dwCommandID);
FWL_ERR EndDoModal();
FWL_ERR SetBorderRegion(CFX_Path* pPath);
+
+ protected:
+ IFWL_Form();
};
#endif
diff --git a/xfa/include/fwl/core/fwl_grid.h b/xfa/include/fwl/core/fwl_grid.h
index a41ef4ed53..168de913ba 100644
--- a/xfa/include/fwl/core/fwl_grid.h
+++ b/xfa/include/fwl/core/fwl_grid.h
@@ -8,7 +8,6 @@
#define _FWL_GRID_H
class IFWL_Widget;
class IFWL_Content;
-class IFWL_Grid;
#define FWL_CLASS_Grid L"FWL_GRID"
#define FWL_CLASSHASH_Grid 3150298670
#define FWL_GRIDSTYLEEXT_ShowGridLines (1L << 0)
@@ -39,8 +38,7 @@ enum FWL_GRIDSIZE {
typedef struct _FWL_HGRIDCOLROW { void* pData; } * FWL_HGRIDCOLROW;
class IFWL_Grid : public IFWL_Content {
public:
- static IFWL_Grid* Create();
- FWL_ERR Initialize(CFWL_WidgetImpProperties& properties);
+ static IFWL_Grid* Create(const CFWL_WidgetImpProperties& properties);
FWL_HGRIDCOLROW InsertColRow(FX_BOOL bColumn, int32_t nIndex = -1);
int32_t CountColRows(FX_BOOL bColumn);
diff --git a/xfa/include/fwl/core/fwl_panel.h b/xfa/include/fwl/core/fwl_panel.h
index bea6675911..351055def7 100644
--- a/xfa/include/fwl/core/fwl_panel.h
+++ b/xfa/include/fwl/core/fwl_panel.h
@@ -12,20 +12,24 @@ class IFWL_Panel;
class IFWL_CustomPanel;
#define FWL_CLASS_Panel L"FWL_Panel"
#define FWL_CLASSHASH_Panel 881567292
+
class IFWL_Panel : public IFWL_Widget {
public:
- static IFWL_Panel* Create();
- FWL_ERR Initialize(CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ static IFWL_Panel* Create(CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
IFWL_Content* GetContent();
FWL_ERR SetContent(IFWL_Content* pContent);
protected:
IFWL_Panel();
};
+
class IFWL_CustomPanel : public IFWL_Widget {
public:
- static IFWL_CustomPanel* Create();
- FWL_ERR Initialize(CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ static IFWL_CustomPanel* Create(CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
IFWL_Content* GetContent();
FWL_ERR SetContent(IFWL_Content* pContent);
FWL_ERR SetProxy(IFWL_Proxy* pProxy);
diff --git a/xfa/include/fwl/core/fwl_target.h b/xfa/include/fwl/core/fwl_target.h
index dc10ca5399..d7be7519b5 100644
--- a/xfa/include/fwl/core/fwl_target.h
+++ b/xfa/include/fwl/core/fwl_target.h
@@ -31,6 +31,8 @@ class IFWL_Target {
IFWL_Target() : m_pImpl(nullptr) {}
virtual ~IFWL_Target();
+ // These call into equivalent polymorphic methods of m_pImpl. There
+ // should be no need to override these in subclasses.
FWL_ERR GetClassName(CFX_WideString& wsClass) const;
FX_DWORD GetClassID() const;
FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
@@ -38,6 +40,8 @@ class IFWL_Target {
FWL_ERR Finalize();
CFWL_TargetImp* GetImpl() const { return m_pImpl; }
+
+ protected:
void SetImpl(CFWL_TargetImp* pImpl) { m_pImpl = pImpl; }
private:
diff --git a/xfa/include/fwl/core/fwl_widget.h b/xfa/include/fwl/core/fwl_widget.h
index acada467b4..6338be9ee6 100644
--- a/xfa/include/fwl/core/fwl_widget.h
+++ b/xfa/include/fwl/core/fwl_widget.h
@@ -92,9 +92,9 @@ class CFWL_WidgetImpProperties {
};
class IFWL_Custom : public IFWL_Widget {
public:
- static IFWL_Custom* Create();
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_Custom* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
FWL_ERR SetProxy(IFWL_Proxy* pProxy);
protected:
diff --git a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp
index 37cc945947..02cd6a7b54 100644
--- a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp
@@ -10,26 +10,23 @@
#include "../core/include/fwl_widgetimp.h"
#include "include/fwl_editimp.h"
#include "include/fwl_barcodeimp.h"
-IFWL_Barcode::IFWL_Barcode() {
-}
-FWL_ERR IFWL_Barcode::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, pOuter);
- SetImpl(pBarcodeImpl);
- pBarcodeImpl->SetInterface(this);
- return pBarcodeImpl->Initialize();
-}
+
+// static
+IFWL_Barcode* IFWL_Barcode::Create(const CFWL_WidgetImpProperties& properties) {
+ IFWL_Barcode* pBarcode = new IFWL_Barcode;
+ CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, nullptr);
+ pBarcode->SetImpl(pBarcodeImpl);
+ pBarcodeImpl->SetInterface(pBarcode);
+ return pBarcode;
+}
+IFWL_Barcode::IFWL_Barcode() {}
void IFWL_Barcode::SetType(BC_TYPE type) {
static_cast<CFWL_BarcodeImp*>(GetImpl())->SetType(type);
}
FX_BOOL IFWL_Barcode::IsProtectedType() {
return static_cast<CFWL_BarcodeImp*>(GetImpl())->IsProtectedType();
}
-CFWL_BarcodeImp::CFWL_BarcodeImp(IFWL_Widget* pOuter)
- : CFWL_EditImp(pOuter),
- m_pBarcodeEngine(NULL),
- m_dwStatus(0),
- m_type(BC_UNKNOWN) {}
+
CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_EditImp(properties, pOuter),
diff --git a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp
index 24104e19b5..a7381e1ea6 100644
--- a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp
@@ -9,21 +9,17 @@
#include "../core/include/fwl_noteimp.h"
#include "../core/include/fwl_widgetimp.h"
#include "include/fwl_caretimp.h"
-IFWL_Caret::IFWL_Caret() {
-}
-FWL_ERR IFWL_Caret::Initialize(IFWL_Widget* pOuter) {
- CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(pOuter);
- SetImpl(pCaretImpl);
- pCaretImpl->SetInterface(this);
- return pCaretImpl->Initialize();
-}
-FWL_ERR IFWL_Caret::Initialize(const CFWL_WidgetImpProperties& properties,
+
+// static
+IFWL_Caret* IFWL_Caret::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_Caret* pCaret = new IFWL_Caret;
CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(properties, pOuter);
- SetImpl(pCaretImpl);
- pCaretImpl->SetInterface(this);
- return pCaretImpl->Initialize();
+ pCaret->SetImpl(pCaretImpl);
+ pCaretImpl->SetInterface(pCaret);
+ return pCaret;
}
+IFWL_Caret::IFWL_Caret() {}
FWL_ERR IFWL_Caret::ShowCaret(FX_BOOL bFlag) {
return static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag);
}
@@ -36,18 +32,14 @@ FWL_ERR IFWL_Caret::SetFrequency(FX_DWORD elapse) {
FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) {
return static_cast<CFWL_CaretImp*>(GetImpl())->SetColor(crFill);
}
-CFWL_CaretImp::CFWL_CaretImp(IFWL_Widget* pOuter) : m_hTimer(NULL) {
- m_dwElapse = 400;
- m_pTimer = new CFWL_CaretTimer(this);
- m_bSetColor = FALSE;
- SetStates(FWL_STATE_CAT_HightLight);
-}
+
CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : m_hTimer(NULL) {
- m_dwElapse = 400;
+ : CFWL_WidgetImp(properties, pOuter),
+ m_hTimer(nullptr),
+ m_dwElapse(400),
+ m_bSetColor(FALSE) {
m_pTimer = new CFWL_CaretTimer(this);
- m_bSetColor = FALSE;
SetStates(FWL_STATE_CAT_HightLight);
}
CFWL_CaretImp::~CFWL_CaretImp() {
diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
index c68dd7512b..08f15e74f0 100644
--- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
@@ -11,40 +11,24 @@
#include "../core/include/fwl_widgetmgrimp.h"
#include "include/fwl_checkboximp.h"
#define FWL_CKB_CaptionMargin 5
-IFWL_CheckBox::IFWL_CheckBox() {
-}
-FWL_ERR IFWL_CheckBox::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_CheckBox* IFWL_CheckBox::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_CheckBox* pCheckBox = new IFWL_CheckBox;
CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter);
- SetImpl(pCheckBoxImpl);
- pCheckBoxImpl->SetInterface(this);
- return pCheckBoxImpl->Initialize();
+ pCheckBox->SetImpl(pCheckBoxImpl);
+ pCheckBoxImpl->SetInterface(pCheckBox);
+ return pCheckBox;
}
+IFWL_CheckBox::IFWL_CheckBox() {}
int32_t IFWL_CheckBox::GetCheckState() {
return static_cast<CFWL_CheckBoxImp*>(GetImpl())->GetCheckState();
}
FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) {
return static_cast<CFWL_CheckBoxImp*>(GetImpl())->SetCheckState(iCheck);
}
-IFWL_RadioButton::IFWL_RadioButton() {
-}
-FWL_ERR IFWL_RadioButton::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter);
- SetImpl(pCheckBoxImpl);
- pCheckBoxImpl->SetInterface(this);
- return pCheckBoxImpl->Initialize();
-}
-CFWL_CheckBoxImp::CFWL_CheckBoxImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
- m_iTTOAlign(FDE_TTOALIGNMENT_Center),
- m_bBtnDown(FALSE) {
- m_rtClient.Reset();
- m_rtBox.Reset();
- m_rtCaption.Reset();
- m_rtFocus.Reset();
-}
+
CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
@@ -58,15 +42,11 @@ CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
}
CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {}
FWL_ERR CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const {
- wsClass = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton)
- ? FWL_CLASS_RadioButton
- : FWL_CLASS_CheckBox;
+ wsClass = FWL_CLASS_CheckBox;
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_CheckBoxImp::GetClassID() const {
- return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton
- ? FWL_CLASSHASH_RadioButton
- : FWL_CLASSHASH_CheckBox;
+ return FWL_CLASSHASH_CheckBox;
}
FWL_ERR CFWL_CheckBoxImp::Initialize() {
if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
index 265337616b..38f34d9657 100644
--- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
@@ -18,15 +18,17 @@
#include "include/fwl_listboximp.h"
#include "include/fwl_formproxyimp.h"
#include "include/fwl_comboboximp.h"
-IFWL_ComboBox::IFWL_ComboBox() {
-}
-FWL_ERR IFWL_ComboBox::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, pOuter);
- SetImpl(pComboBoxImpl);
- pComboBoxImpl->SetInterface(this);
- return pComboBoxImpl->Initialize();
-}
+
+// static
+IFWL_ComboBox* IFWL_ComboBox::Create(
+ const CFWL_WidgetImpProperties& properties) {
+ IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
+ CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
+ pComboBox->SetImpl(pComboBoxImpl);
+ pComboBoxImpl->SetInterface(pComboBox);
+ return pComboBox;
+}
+IFWL_ComboBox::IFWL_ComboBox() {}
int32_t IFWL_ComboBox::GetCurSel() {
return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel();
}
@@ -124,10 +126,7 @@ FWL_ERR IFWL_ComboBox::EditModifyStylesEx(FX_DWORD dwStylesExAdded,
return static_cast<CFWL_ComboBoxImp*>(GetImpl())
->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-CFWL_ComboEditImp::CFWL_ComboEditImp(IFWL_Widget* pOuter)
- : CFWL_EditImp(pOuter) {
- m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl());
-}
+
CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_EditImp(properties, pOuter) {
@@ -192,10 +191,6 @@ void CFWL_ComboEditImp::FlagFocus(FX_BOOL bSet) {
void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) {
m_pOuter->SetFocus(bSet);
}
-CFWL_ComboListImp::CFWL_ComboListImp(IFWL_Widget* pOuter)
- : CFWL_ListBoxImp(pOuter), m_bNotifyOwner(TRUE) {
- FXSYS_assert(pOuter != NULL);
-}
CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) {
@@ -467,18 +462,6 @@ void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) {
default: {}
}
}
-CFWL_ComboBoxImp::CFWL_ComboBoxImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_pForm(NULL),
- m_bLButtonDown(FALSE),
- m_iCurSel(-1),
- m_iBtnState(FWL_PARTSTATE_CMB_Normal),
- m_fComboFormHandler(0),
- m_bNeedShowList(FALSE) {
- m_rtClient.Reset();
- m_rtBtn.Reset();
- m_rtHandler.Reset();
-}
CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
@@ -515,18 +498,13 @@ FWL_ERR CFWL_ComboBoxImp::Initialize() {
prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
}
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
- CFWL_ComboListImp* pList = new CFWL_ComboListImp(prop, m_pInterface);
- m_pListBox.reset(new IFWL_ListBox);
- pList->SetInterface(m_pListBox.get());
- m_pListBox->SetImpl(pList);
- pList->Initialize();
+ m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
+ m_pListBox->Initialize();
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
- CFWL_ComboEditImp* pEdit = new CFWL_ComboEditImp(m_pInterface);
- m_pEdit.reset(new IFWL_Edit);
- pEdit->SetInterface(m_pEdit.get());
- m_pEdit->SetImpl(pEdit);
- pEdit->Initialize();
- pEdit->SetOuter(m_pInterface);
+ CFWL_WidgetImpProperties prop2;
+ m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface));
+ m_pEdit->Initialize();
+ static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
}
if (m_pEdit) {
m_pEdit->SetParent(m_pInterface);
@@ -575,12 +553,10 @@ FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(FX_DWORD dwStylesExAdded,
FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown;
FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown;
if (bAddDropDown && !m_pEdit) {
- CFWL_ComboEditImp* pEdit = new CFWL_ComboEditImp(m_pInterface);
- m_pEdit.reset(new IFWL_Edit);
- pEdit->SetInterface(m_pEdit.get());
- m_pEdit->SetImpl(pEdit);
- pEdit->Initialize();
- pEdit->SetOuter(m_pInterface);
+ CFWL_WidgetImpProperties prop;
+ m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr));
+ m_pEdit->Initialize();
+ static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
m_pEdit->SetParent(m_pInterface);
} else if (bRemoveDropDown && m_pEdit) {
m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE);
@@ -1155,11 +1131,10 @@ void CFWL_ComboBoxImp::InitProxyForm() {
propForm.m_pOwner = m_pInterface;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
- m_pProxy = new CFWL_FormProxyImp(propForm, m_pListBox.get());
- m_pForm = new IFWL_Form;
- m_pProxy->SetInterface(m_pForm);
- m_pForm->SetImpl(m_pProxy);
- m_pProxy->Initialize();
+ CFX_WideString className;
+ m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get());
+ m_pForm->Initialize();
+ m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl());
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
m_pProxy->SetDelegate(m_pListProxyDelegate);
@@ -1182,11 +1157,8 @@ void CFWL_ComboBoxImp::DisForm_InitComboList() {
prop.m_dwStates = FWL_WGTSTATE_Invisible;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- CFWL_ComboListImp* pList = new CFWL_ComboListImp(prop, m_pInterface);
- m_pListBox.reset(new IFWL_ListBox);
- pList->SetInterface(m_pListBox.get());
- m_pListBox->SetImpl(pList);
- pList->Initialize();
+ m_pListBox.reset(IFWL_ListBox::Create(prop, m_pInterface));
+ m_pListBox->Initialize();
}
void CFWL_ComboBoxImp::DisForm_InitComboEdit() {
if (m_pEdit) {
@@ -1195,14 +1167,9 @@ void CFWL_ComboBoxImp::DisForm_InitComboEdit() {
CFWL_WidgetImpProperties prop;
prop.m_pParent = m_pInterface;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) == 0) {
- }
- CFWL_ComboEditImp* pEdit = new CFWL_ComboEditImp(prop, m_pInterface);
- m_pEdit.reset(new IFWL_Edit);
- pEdit->SetInterface(m_pEdit.get());
- m_pEdit->SetImpl(pEdit);
- pEdit->Initialize();
- pEdit->SetOuter(m_pInterface);
+ m_pEdit.reset(IFWL_Edit::Create(prop, m_pInterface));
+ m_pEdit->Initialize();
+ static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
}
void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
FX_BOOL bDropList = DisForm_IsDropListShowed();
diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
index 5208ca880e..2eb7503476 100644
--- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
@@ -17,43 +17,56 @@
#include "include/fwl_datetimepickerimp.h"
#define FWL_DTP_WIDTH 100
#define FWL_DTP_HEIGHT 20
-FWL_ERR IFWL_DateTimeForm::Initialize(
+
+// static
+IFWL_DateTimePicker* IFWL_DateTimePicker::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_DateTimePicker* pDateTimePicker = new IFWL_DateTimePicker;
+ CFWL_DateTimePickerImp* pDateTimePickerImpl =
+ new CFWL_DateTimePickerImp(properties, pOuter);
+ pDateTimePicker->SetImpl(pDateTimePickerImpl);
+ pDateTimePickerImpl->SetInterface(pDateTimePicker);
+ return pDateTimePicker;
+}
+
+// Static
+IFWL_DateTimeForm* IFWL_DateTimeForm::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_DateTimeForm* pDateTimeForm = new IFWL_DateTimeForm;
CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter);
- SetImpl(pFormProxyImpl);
- pFormProxyImpl->SetInterface(this);
- return pFormProxyImpl->Initialize();
+ pDateTimeForm->SetImpl(pFormProxyImpl);
+ pFormProxyImpl->SetInterface(pDateTimeForm);
+ return pDateTimeForm;
}
-FWL_ERR IFWL_DateTimeCalender::Initialize(
+
+// static
+IFWL_DateTimeCalender* IFWL_DateTimeCalender::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_DateTimeCalender* pDateTimeCalendar = new IFWL_DateTimeCalender;
CFWL_DateTimeCalendar* pDateTimeCalendarImpl =
new CFWL_DateTimeCalendar(properties, pOuter);
- SetImpl(pDateTimeCalendarImpl);
- pDateTimeCalendarImpl->SetInterface(this);
- return pDateTimeCalendarImpl->Initialize();
+ pDateTimeCalendar->SetImpl(pDateTimeCalendarImpl);
+ pDateTimeCalendarImpl->SetInterface(pDateTimeCalendar);
+ return pDateTimeCalendar;
}
-FWL_ERR IFWL_DateTimeEdit::Initialize(
+
+// static
+IFWL_DateTimeEdit* IFWL_DateTimeEdit::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_DateTimeEdit* pDateTimeEdit = new IFWL_DateTimeEdit;
CFWL_DateTimeEdit* pDateTimeEditImpl =
new CFWL_DateTimeEdit(properties, pOuter);
- SetImpl(pDateTimeEditImpl);
- pDateTimeEditImpl->SetInterface(this);
- return pDateTimeEditImpl->Initialize();
+ pDateTimeEdit->SetImpl(pDateTimeEditImpl);
+ pDateTimeEditImpl->SetInterface(pDateTimeEdit);
+ return pDateTimeEdit;
}
+
IFWL_DateTimePicker::IFWL_DateTimePicker() {
}
-FWL_ERR IFWL_DateTimePicker::Initialize(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- CFWL_DateTimePickerImp* pDateTimePickerImpl =
- new CFWL_DateTimePickerImp(properties, pOuter);
- SetImpl(pDateTimePickerImpl);
- pDateTimePickerImpl->SetInterface(this);
- return pDateTimePickerImpl->Initialize();
-}
int32_t IFWL_DateTimePicker::CountSelRanges() {
return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
->GetDataTimeEdit()
@@ -396,18 +409,6 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx(
pDateTime->ShowMonthCalendar(FALSE);
}
}
-CFWL_DateTimePickerImp::CFWL_DateTimePickerImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_iBtnState(1),
- m_iYear(-1),
- m_iMonth(-1),
- m_iDay(-1),
- m_bLBtnDown(FALSE),
- m_pEdit(nullptr),
- m_pMonthCal(nullptr),
- m_pForm(nullptr) {
- m_rtBtn.Set(0, 0, 0, 0);
-}
CFWL_DateTimePickerImp::CFWL_DateTimePickerImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
@@ -442,8 +443,8 @@ FWL_ERR CFWL_DateTimePickerImp::Initialize() {
propMonth.m_pDataProvider = &m_MonthCalendarDP;
propMonth.m_pParent = m_pInterface;
propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(new IFWL_DateTimeCalender());
- m_pMonthCal->Initialize(propMonth, m_pInterface);
+ m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface));
+ m_pMonthCal->Initialize();
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
@@ -451,8 +452,8 @@ FWL_ERR CFWL_DateTimePickerImp::Initialize() {
CFWL_WidgetImpProperties propEdit;
propEdit.m_pParent = m_pInterface;
propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(new IFWL_DateTimeEdit());
- m_pEdit->Initialize(propEdit, m_pInterface);
+ m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface));
+ m_pEdit->Initialize();
RegisterEventTarget(m_pMonthCal.get());
RegisterEventTarget(m_pEdit.get());
return FWL_ERR_Succeeded;
@@ -685,8 +686,8 @@ void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics,
prop.m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
prop.m_pParent = m_pInterface;
prop.m_rtWidget = m_rtBtn;
- IFWL_SpinButton* pSpin = new IFWL_SpinButton;
- pSpin->Initialize(prop, m_pInterface);
+ IFWL_SpinButton* pSpin = IFWL_SpinButton::Create(prop, m_pInterface);
+ pSpin->Initialize();
} else {
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
@@ -813,8 +814,8 @@ void CFWL_DateTimePickerImp::InitProxyForm() {
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
propForm.m_pOwner = m_pInterface;
- m_pForm.reset(new IFWL_DateTimeForm());
- m_pForm->Initialize(propForm, m_pMonthCal.get());
+ m_pForm.reset(IFWL_DateTimeForm::Create(propForm, m_pMonthCal.get()));
+ m_pForm->Initialize();
m_pMonthCal->SetParent(m_pForm.get());
}
IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() {
@@ -839,8 +840,8 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() {
propMonth.m_pParent = m_pInterface;
propMonth.m_pDataProvider = &m_MonthCalendarDP;
propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(new IFWL_DateTimeCalender());
- m_pMonthCal->Initialize(propMonth, m_pInterface);
+ m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface));
+ m_pMonthCal->Initialize();
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
@@ -853,8 +854,8 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeEdit() {
CFWL_WidgetImpProperties propEdit;
propEdit.m_pParent = m_pInterface;
propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(new IFWL_DateTimeEdit());
- m_pEdit->Initialize(propEdit, m_pInterface);
+ m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface));
+ m_pEdit->Initialize();
}
FX_BOOL CFWL_DateTimePickerImp::DisForm_IsMonthCalendarShowed() {
if (!m_pMonthCal)
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index 8f6611884a..a35d1e60bf 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
@@ -11,18 +11,31 @@
#include "../core/include/fwl_noteimp.h"
#include "../core/include/fwl_widgetimp.h"
#include "../core/include/fwl_widgetmgrimp.h"
-#include "include/fwl_scrollbarimp.h"
-#include "include/fwl_editimp.h"
#include "include/fwl_caretimp.h"
-IFWL_Edit::IFWL_Edit() {
-}
-FWL_ERR IFWL_Edit::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+#include "include/fwl_comboboximp.h"
+#include "include/fwl_editimp.h"
+#include "include/fwl_scrollbarimp.h"
+
+// static
+IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_Edit* pEdit = new IFWL_Edit;
CFWL_EditImp* pEditImpl = new CFWL_EditImp(properties, pOuter);
- SetImpl(pEditImpl);
- pEditImpl->SetInterface(this);
- return pEditImpl->Initialize();
-}
+ pEdit->SetImpl(pEditImpl);
+ pEditImpl->SetInterface(pEdit);
+ return pEdit;
+}
+// static
+IFWL_Edit* IFWL_Edit::CreateComboEdit(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_Edit* pEdit = new IFWL_Edit;
+ CFWL_EditImp* pComboEditImpl = new CFWL_ComboEditImp(properties, pOuter);
+ pEdit->SetImpl(pComboEditImpl);
+ pComboEditImpl->SetInterface(pEdit);
+ return pEdit;
+}
+IFWL_Edit::IFWL_Edit() {}
FWL_ERR IFWL_Edit::SetText(const CFX_WideString& wsText) {
return static_cast<CFWL_EditImp*>(GetImpl())->SetText(wsText);
}
@@ -150,29 +163,6 @@ FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
->ReplaceSpellCheckWord(pointf, bsReplace);
}
#define FWL_EDIT_Margin 3
-CFWL_EditImp::CFWL_EditImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_fVAlignOffset(0.0f),
- m_fScrollOffsetX(0.0f),
- m_fScrollOffsetY(0.0f),
- m_pEdtEngine(NULL),
- m_bLButtonDown(FALSE),
- m_nSelStart(0),
- m_nLimit(-1),
- m_fSpaceAbove(0),
- m_fSpaceBelow(0),
- m_fFontSize(0),
- m_bSetRange(FALSE),
- m_iMin(-1),
- m_iMax(0xFFFFFFF),
- m_backColor(0),
- m_updateBackColor(FALSE),
- m_iCurRecord(-1),
- m_iMaxRecord(128) {
- m_rtClient.Reset();
- m_rtEngine.Reset();
- m_rtStatic.Reset();
-}
CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
@@ -1670,8 +1660,8 @@ void CFWL_EditImp::InitScrollBar(FX_BOOL bVert) {
prop.m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
prop.m_pParent = m_pInterface;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar;
- pScrollBar->Initialize(prop, m_pInterface);
+ IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface);
+ pScrollBar->Initialize();
(bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar);
}
void CFWL_EditImp::InitEngine() {
@@ -1745,8 +1735,9 @@ FX_BOOL CFWL_EditImp::ValidateNumberChar(FX_WCHAR cNum) {
void CFWL_EditImp::InitCaret() {
if (!m_pCaret) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) {
- m_pCaret.reset(new IFWL_Caret);
- m_pCaret->Initialize(m_pInterface);
+ CFWL_WidgetImpProperties prop;
+ m_pCaret.reset(IFWL_Caret::Create(prop, m_pInterface));
+ m_pCaret->Initialize();
m_pCaret->SetParent(m_pInterface);
m_pCaret->SetStates(m_pProperties->m_dwStates);
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp
index d30e7e77eb..20ec712537 100644
--- a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp
@@ -11,8 +11,7 @@
#include "../core/include/fwl_panelimp.h"
#include "../core/include/fwl_formimp.h"
#include "include/fwl_formproxyimp.h"
-CFWL_FormProxyImp::CFWL_FormProxyImp(IFWL_Widget* pOuter)
- : CFWL_FormImp(pOuter) {}
+
CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_FormImp(properties, pOuter) {}
diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
index 24ec699d10..3ef6b443ce 100644
--- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
@@ -10,16 +10,30 @@
#include "../core/include/fwl_widgetimp.h"
#include "include/fwl_scrollbarimp.h"
#include "include/fwl_listboximp.h"
+#include "include/fwl_comboboximp.h"
+
#define FWL_LISTBOX_ItemTextMargin 2
-IFWL_ListBox::IFWL_ListBox() {
-}
-FWL_ERR IFWL_ListBox::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_ListBox* IFWL_ListBox::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_ListBox* pListBox = new IFWL_ListBox;
CFWL_ListBoxImp* pListBoxImpl = new CFWL_ListBoxImp(properties, pOuter);
- SetImpl(pListBoxImpl);
- pListBoxImpl->SetInterface(this);
- return pListBoxImpl->Initialize();
+ pListBox->SetImpl(pListBoxImpl);
+ pListBoxImpl->SetInterface(pListBox);
+ return pListBox;
+}
+// static
+IFWL_ListBox* IFWL_ListBox::CreateComboList(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_ListBox* pListBox = new IFWL_ListBox;
+ CFWL_ListBoxImp* pComboListImpl = new CFWL_ComboListImp(properties, pOuter);
+ pListBox->SetImpl(pComboListImpl);
+ pComboListImpl->SetInterface(pListBox);
+ return pListBox;
}
+IFWL_ListBox::IFWL_ListBox() {}
int32_t IFWL_ListBox::CountSelItems() {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->CountSelItems();
}
@@ -41,18 +55,7 @@ FWL_ERR IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
FWL_ERR* IFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) {
return static_cast<CFWL_ListBoxImp*>(GetImpl())->Sort(pCom);
}
-CFWL_ListBoxImp::CFWL_ListBoxImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_dwTTOStyles(0),
- m_iTTOAligns(0),
- m_hAnchor(NULL),
- m_fScorllBarWidth(0),
- m_bLButtonDown(FALSE),
- m_pScrollBarTP(NULL) {
- m_rtClient.Reset();
- m_rtConent.Reset();
- m_rtStatic.Reset();
-}
+
CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
@@ -945,8 +948,8 @@ void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) {
prop.m_dwStates = FWL_WGTSTATE_Invisible;
prop.m_pParent = m_pInterface;
prop.m_pThemeProvider = m_pScrollBarTP;
- IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar;
- pScrollBar->Initialize(prop, m_pInterface);
+ IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface);
+ pScrollBar->Initialize();
(bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar);
}
void CFWL_ListBoxImp::SortItem() {}
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
index 624ce45bde..12ad6bd45a 100644
--- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
@@ -17,17 +17,19 @@
#define MONTHCAL_COLUMNS 7
#define MONTHCAL_HEADER_BTN_VMARGIN 7
#define MONTHCAL_HEADER_BTN_HMARGIN 5
-IFWL_MonthCalendar::IFWL_MonthCalendar() {
-}
-FWL_ERR IFWL_MonthCalendar::Initialize(
+
+// static
+IFWL_MonthCalendar* IFWL_MonthCalendar::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_MonthCalendar* pMonthCalendar = new IFWL_MonthCalendar;
CFWL_MonthCalendarImp* pMonthCalendarImpl =
new CFWL_MonthCalendarImp(properties, pOuter);
- SetImpl(pMonthCalendarImpl);
- pMonthCalendarImpl->SetInterface(this);
- return pMonthCalendarImpl->Initialize();
+ pMonthCalendar->SetImpl(pMonthCalendarImpl);
+ pMonthCalendarImpl->SetInterface(pMonthCalendar);
+ return pMonthCalendar;
}
+IFWL_MonthCalendar::IFWL_MonthCalendar() {}
int32_t IFWL_MonthCalendar::CountSelect() {
return static_cast<CFWL_MonthCalendarImp*>(GetImpl())->CountSelect();
}
@@ -44,35 +46,7 @@ FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear,
return static_cast<CFWL_MonthCalendarImp*>(GetImpl())
->SetSelect(iYear, iMonth, iDay);
}
-CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_iCurYear(2011),
- m_iCurMonth(1),
- m_iYear(2011),
- m_iMonth(1),
- m_iDay(1),
- m_iHovered(-1),
- m_iLBtnPartStates(FWL_PARTSTATE_MCD_Normal),
- m_iRBtnPartStates(FWL_PARTSTATE_MCD_Normal) {
- m_rtHead.Reset();
- m_rtWeek.Reset();
- m_rtLBtn.Reset();
- m_rtRBtn.Reset();
- m_rtDates.Reset();
- m_rtHSep.Reset();
- m_rtHeadText.Reset();
- m_rtToday.Reset();
- m_rtTodayFlag.Reset();
- m_rtClient.Reset();
- m_rtWeekNum.Reset();
- m_rtWeekNumSep.Reset();
- m_szHead.Reset();
- m_szCell.Reset();
- m_szToday.Reset();
- m_pDateTime = new CFX_DateTime;
- m_bInit = FALSE;
- m_iMaxSel = 1;
-}
+
CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
index 7c02052f74..8650b5545a 100644
--- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
@@ -9,25 +9,20 @@
#include "../core/include/fwl_noteimp.h"
#include "../core/include/fwl_widgetimp.h"
#include "include/fwl_pictureboximp.h"
-IFWL_PictureBox::IFWL_PictureBox() {
-}
-FWL_ERR IFWL_PictureBox::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_PictureBox* IFWL_PictureBox::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_PictureBox* pPictureBox = new IFWL_PictureBox;
CFWL_PictureBoxImp* pPictureBoxImpl =
new CFWL_PictureBoxImp(properties, pOuter);
- SetImpl(pPictureBoxImpl);
- pPictureBoxImpl->SetInterface(this);
- return pPictureBoxImpl->Initialize();
-}
-CFWL_PictureBoxImp::CFWL_PictureBoxImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_bTop(FALSE),
- m_bVCenter(FALSE),
- m_bButton(FALSE) {
- m_rtClient.Reset();
- m_rtImage.Reset();
- m_matrix.SetIdentity();
+ pPictureBox->SetImpl(pPictureBoxImpl);
+ pPictureBoxImpl->SetInterface(pPictureBox);
+ return pPictureBox;
}
+IFWL_PictureBox::IFWL_PictureBox() {}
+
CFWL_PictureBoxImp::CFWL_PictureBoxImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
diff --git a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp
index 8ddd93d272..e775861749 100644
--- a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp
@@ -9,24 +9,21 @@
#include "../core/include/fwl_noteimp.h"
#include "../core/include/fwl_widgetimp.h"
#include "include/fwl_pushbuttonimp.h"
-FWL_ERR IFWL_PushButton::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_PushButton* IFWL_PushButton::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_PushButton* pPushButton = new IFWL_PushButton;
CFWL_PushButtonImp* pPushButtonImpl =
new CFWL_PushButtonImp(properties, pOuter);
- SetImpl(pPushButtonImpl);
- pPushButtonImpl->SetInterface(this);
- return pPushButtonImpl->Initialize();
+ pPushButton->SetImpl(pPushButtonImpl);
+ pPushButtonImpl->SetInterface(pPushButton);
+ return pPushButton;
}
IFWL_PushButton::IFWL_PushButton() {
}
-CFWL_PushButtonImp::CFWL_PushButtonImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_bBtnDown(FALSE),
- m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
- m_iTTOAlign(FDE_TTOALIGNMENT_Center) {
- m_rtClient.Set(0, 0, 0, 0);
- m_rtCaption.Set(0, 0, 0, 0);
-}
+
CFWL_PushButtonImp::CFWL_PushButtonImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
diff --git a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp
index 9a6521179c..f95aeee72c 100644
--- a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp
@@ -11,15 +11,18 @@
#include "include/fwl_scrollbarimp.h"
#define FWL_SCROLLBAR_Elapse 500
#define FWL_SCROLLBAR_MinThumb 5
-IFWL_ScrollBar::IFWL_ScrollBar() {
-}
-FWL_ERR IFWL_ScrollBar::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_ScrollBar* IFWL_ScrollBar::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar;
CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(properties, pOuter);
- SetImpl(pScrollBarImpl);
- pScrollBarImpl->SetInterface(this);
- return pScrollBarImpl->Initialize();
+ pScrollBar->SetImpl(pScrollBarImpl);
+ pScrollBarImpl->SetInterface(pScrollBar);
+ return pScrollBar;
}
+IFWL_ScrollBar::IFWL_ScrollBar() {}
FX_BOOL IFWL_ScrollBar::IsVertical() {
return static_cast<CFWL_ScrollBarImp*>(GetImpl())->IsVertical();
}
@@ -56,39 +59,6 @@ FWL_ERR IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
FX_BOOL IFWL_ScrollBar::DoScroll(FX_DWORD dwCode, FX_FLOAT fPos) {
return static_cast<CFWL_ScrollBarImp*>(GetImpl())->DoScroll(dwCode, fPos);
}
-CFWL_ScrollBarImp::CFWL_ScrollBarImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_hTimer(NULL),
- m_fRangeMin(0),
- m_fRangeMax(-1),
- m_fPageSize(0),
- m_fStepSize(0),
- m_fPos(0),
- m_fTrackPos(0),
- m_iMinButtonState(FWL_PARTSTATE_SCB_Normal),
- m_iMaxButtonState(FWL_PARTSTATE_SCB_Normal),
- m_iThumbButtonState(FWL_PARTSTATE_SCB_Normal),
- m_iMinTrackState(FWL_PARTSTATE_SCB_Normal),
- m_iMaxTrackState(FWL_PARTSTATE_SCB_Normal),
- m_fLastTrackPos(0),
- m_cpTrackPointX(0),
- m_cpTrackPointY(0),
- m_iMouseWheel(0),
- m_bTrackMouseLeave(FALSE),
- m_bMouseHover(FALSE),
- m_bMouseDown(FALSE),
- m_bRepaintThumb(FALSE),
- m_fButtonLen(0),
- m_bMinSize(FALSE),
- m_bCustomLayout(FALSE),
- m_fMinThumb(FWL_SCROLLBAR_MinThumb) {
- m_rtClient.Reset();
- m_rtThumb.Reset();
- m_rtMinBtn.Reset();
- m_rtMaxBtn.Reset();
- m_rtMinTrack.Reset();
- m_rtMaxTrack.Reset();
-}
CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter),
diff --git a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp
index 7b1bf6aa44..00e7dfdb98 100644
--- a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp
@@ -12,15 +12,19 @@
#define FWL_SPN_MinWidth 18
#define FWL_SPN_MinHeight 32
#define FWL_SPIN_Elapse 200
-IFWL_SpinButton::IFWL_SpinButton() {
-}
-FWL_ERR IFWL_SpinButton::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- CFWL_SpinButtonImp* pSpinButtonImpl = new CFWL_SpinButtonImp(properties);
- SetImpl(pSpinButtonImpl);
- pSpinButtonImpl->SetInterface(this);
- return pSpinButtonImpl->Initialize();
+
+// static
+IFWL_SpinButton* IFWL_SpinButton::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_SpinButton* pSpinButton = new IFWL_SpinButton;
+ CFWL_SpinButtonImp* pSpinButtonImpl =
+ new CFWL_SpinButtonImp(properties, nullptr);
+ pSpinButton->SetImpl(pSpinButtonImpl);
+ pSpinButtonImpl->SetInterface(pSpinButton);
+ return pSpinButton;
}
+IFWL_SpinButton::IFWL_SpinButton() {}
FWL_ERR IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
return static_cast<CFWL_SpinButtonImp*>(GetImpl())
->EnableButton(bEnable, bUp);
@@ -28,18 +32,7 @@ FWL_ERR IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) {
return static_cast<CFWL_SpinButtonImp*>(GetImpl())->IsButtonEnable(bUp);
}
-CFWL_SpinButtonImp::CFWL_SpinButtonImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter),
- m_dwUpState(FWL_PARTSTATE_SPB_Normal),
- m_dwDnState(FWL_PARTSTATE_SPB_Normal),
- m_iButtonIndex(0),
- m_bLButtonDwn(FALSE),
- m_hTimer(NULL) {
- m_rtClient.Reset();
- m_rtUpButton.Reset();
- m_rtDnButton.Reset();
- m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
-}
+
CFWL_SpinButtonImp::CFWL_SpinButtonImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
diff --git a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp
index f2079375dc..550d36af92 100644
--- a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp
@@ -11,12 +11,15 @@
#include "../core/include/fwl_panelimp.h"
#include "../core/include/fwl_formimp.h"
#include "include/fwl_tooltipctrlimp.h"
-FWL_ERR IFWL_ToolTip::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_ToolTip* pToolTip = new IFWL_ToolTip;
CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(properties, pOuter);
- SetImpl(pToolTipImpl);
- pToolTipImpl->SetInterface(this);
- return pToolTipImpl->Initialize();
+ pToolTip->SetImpl(pToolTipImpl);
+ pToolTipImpl->SetInterface(pToolTip);
+ return pToolTip;
}
FWL_ERR IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
return static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor);
@@ -29,20 +32,6 @@ FWL_ERR IFWL_ToolTip::Hide() {
}
IFWL_ToolTip::IFWL_ToolTip() {
}
-CFWL_ToolTipImp::CFWL_ToolTipImp(IFWL_Widget* pOuter)
- : CFWL_FormImp(pOuter),
- m_bBtnDown(FALSE),
- m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
- m_iTTOAlign(FDE_TTOALIGNMENT_Center),
- m_hTimerShow(NULL),
- m_hTimerHide(NULL),
- m_pTimer(NULL) {
- m_rtClient.Set(0, 0, 0, 0);
- m_rtCaption.Set(0, 0, 0, 0);
- m_pTimer = NULL;
- m_TimerShow.m_pToolTip = this;
- m_TimerHide.m_pToolTip = this;
-}
CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_FormImp(properties, pOuter),
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h b/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h
index d4dd1af7a4..d7a7e01f7f 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h
@@ -20,9 +20,8 @@ class CFWL_BarcodeImpDelegate;
#define XFA_BCS_EncodeSuccess 0x0002
class CFWL_BarcodeImp : public CFWL_EditImp {
public:
- CFWL_BarcodeImp(IFWL_Widget* pOuter = NULL);
CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_BarcodeImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h
index b8e47b6b5a..dfb42cde75 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h
@@ -17,9 +17,8 @@ class CFWL_CaretImp;
class CFWL_CaretImpDelegate;
class CFWL_CaretImp : public CFWL_WidgetImp {
public:
- CFWL_CaretImp(IFWL_Widget* pOuter = NULL);
CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_CaretImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h
index 64ea6dcca0..aebcade36f 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h
@@ -14,9 +14,8 @@ class CFWL_CheckBoxImp;
class CFWL_CheckBoxImpDelegate;
class CFWL_CheckBoxImp : public CFWL_WidgetImp {
public:
- CFWL_CheckBoxImp(IFWL_Widget* pOuter = NULL);
CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_CheckBoxImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
index 356276829e..000036d7c1 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
@@ -8,12 +8,12 @@
#define _FWL_COMBOBOX_IMP_H
#include "third_party/base/nonstd_unique_ptr.h"
+#include "xfa/src/fwl/src/basewidget/include/fwl_editimp.h"
+#include "xfa/src/fwl/src/basewidget/include/fwl_listboximp.h"
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
class CFWL_WidgetImpDelegate;
-class CFWL_EditImp;
-class CFWL_EditImpDelegate;
class CFWL_ListBoxImp;
class CFWL_ListBoxImpDelegate;
class CFWL_FormProxyImp;
@@ -27,9 +27,8 @@ class CFWL_ComboBoxImpDelegate;
class CFWL_ComboProxyImpDelegate;
class CFWL_ComboEditImp : public CFWL_EditImp {
public:
- CFWL_ComboEditImp(IFWL_Widget* pOuter);
CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
void ClearSelected();
void SetSelected();
@@ -51,7 +50,6 @@ class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate {
};
class CFWL_ComboListImp : public CFWL_ListBoxImp {
public:
- CFWL_ComboListImp(IFWL_Widget* pOuter);
CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
virtual FWL_ERR Initialize();
@@ -82,9 +80,8 @@ class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate {
};
class CFWL_ComboBoxImp : public CFWL_WidgetImp {
public:
- CFWL_ComboBoxImp(IFWL_Widget* pOuter = NULL);
CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_ComboBoxImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
index 68eb898a63..118d11ff17 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
@@ -23,21 +23,35 @@ class CFWL_DateTimeCalendar;
class CFWL_DateTimeCalendarImpDelegate;
class CFWL_DateTimePickerImp;
class CFWL_DateTimePickerImpDelegate;
+
class IFWL_DateTimeForm : public IFWL_Form {
public:
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ static IFWL_DateTimeForm* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ protected:
+ IFWL_DateTimeForm() {}
};
+
class IFWL_DateTimeCalender : public IFWL_MonthCalendar {
public:
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ static IFWL_DateTimeCalender* Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ protected:
+ IFWL_DateTimeCalender() {}
};
+
class IFWL_DateTimeEdit : public IFWL_Edit {
public:
- FWL_ERR Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ static IFWL_DateTimeEdit* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ protected:
+ IFWL_DateTimeEdit() {}
};
+
class CFWL_DateTimeEdit : public CFWL_EditImp {
public:
CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
@@ -88,9 +102,8 @@ class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate {
};
class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
public:
- CFWL_DateTimePickerImp(IFWL_Widget* pOuter = NULL);
CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_DateTimePickerImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
index 486e47c3fd..1a610c74b0 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
@@ -19,9 +19,7 @@ class CFWL_EditImp;
class CFWL_EditImpDelegate;
class CFWL_EditImp : public CFWL_WidgetImp, public IFDE_TxtEdtEventSink {
public:
- CFWL_EditImp(IFWL_Widget* pOuter = NULL);
- CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
~CFWL_EditImp() override;
// CFWL_WidgetImp:
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h b/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h
index d196917ad6..6e1ac8e272 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h
@@ -14,7 +14,6 @@ class CFWL_FormProxyImp;
class CFWL_FormProxyImpDelegate;
class CFWL_FormProxyImp : public CFWL_FormImp {
public:
- CFWL_FormProxyImp(IFWL_Widget* pOuter);
CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
~CFWL_FormProxyImp();
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
index d441e5e6a5..d7a7d9062c 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
@@ -18,9 +18,8 @@ class CFWL_ListBoxImp;
class CFWL_ListBoxImpDelegate;
class CFWL_ListBoxImp : public CFWL_WidgetImp {
public:
- CFWL_ListBoxImp(IFWL_Widget* pOuter = NULL);
CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_ListBoxImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
index 053384a041..4a659eda9e 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h
@@ -17,9 +17,8 @@ class CFWL_MonthCalendarImp;
class CFWL_MonthCalendarImpDelegate;
class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
public:
- CFWL_MonthCalendarImp(IFWL_Widget* pOuter = NULL);
CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_MonthCalendarImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h
index 2c12610ef6..765375aa3f 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h
@@ -14,9 +14,8 @@ class CFWL_PictureBoxImp;
class CFWL_PictureBoxImpDelegate;
class CFWL_PictureBoxImp : public CFWL_WidgetImp {
public:
- CFWL_PictureBoxImp(IFWL_Widget* pOuter = NULL);
CFWL_PictureBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_PictureBoxImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h b/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h
index 2985629854..87931c262f 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h
@@ -14,9 +14,8 @@ class CFWL_PushButtonImp;
class CFWL_PushButtonImpDelegate;
class CFWL_PushButtonImp : public CFWL_WidgetImp {
public:
- CFWL_PushButtonImp(IFWL_Widget* pOuter = NULL);
CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_PushButtonImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h
index cc9d9c3d64..bbdf3a6d23 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h
@@ -16,9 +16,8 @@ class CFWL_ScrollBarImp;
class CFWL_ScrollBarImpDelegate;
class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer {
public:
- CFWL_ScrollBarImp(IFWL_Widget* pOuter = NULL);
CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_ScrollBarImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h b/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h
index 6b42d2fc73..ec2442f35c 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h
@@ -15,9 +15,8 @@ class CFWL_SpinButtonImp;
class CFWL_SpinButtonImpDelegate;
class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
public:
- CFWL_SpinButtonImp(IFWL_Widget* pOuter = NULL);
CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
~CFWL_SpinButtonImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h b/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h
index 1764fc05c5..a0c895249a 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h
@@ -15,9 +15,8 @@ class CFWL_ToolTipImp;
class CFWL_ToolTipImpDelegate;
class CFWL_ToolTipImp : public CFWL_FormImp {
public:
- CFWL_ToolTipImp(IFWL_Widget* pOuter = NULL);
CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_ToolTipImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/core/fwl_contentimp.cpp b/xfa/src/fwl/src/core/fwl_contentimp.cpp
index 32235de65b..4d446d3498 100644
--- a/xfa/src/fwl/src/core/fwl_contentimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_contentimp.cpp
@@ -34,19 +34,13 @@ FWL_ERR IFWL_Content::SetMaxSize(FX_FLOAT fWidth, FX_FLOAT fHeight) {
}
IFWL_Content::IFWL_Content() {
}
-CFWL_ContentImp::CFWL_ContentImp() {
- m_fWidthMin = 0;
- m_fWidthMax = 10000;
- m_fHeightMin = 0;
- m_fHeightMax = 10000;
-}
-CFWL_ContentImp::CFWL_ContentImp(const CFWL_WidgetImpProperties& properties)
- : CFWL_WidgetImp(properties) {
- m_fWidthMin = 0;
- m_fWidthMax = 10000;
- m_fHeightMin = 0;
- m_fHeightMax = 10000;
-}
+CFWL_ContentImp::CFWL_ContentImp(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : CFWL_WidgetImp(properties, pOuter),
+ m_fWidthMin(0),
+ m_fWidthMax(10000),
+ m_fHeightMin(0),
+ m_fHeightMax(10000) {}
CFWL_ContentImp::~CFWL_ContentImp() {}
FWL_ERR CFWL_ContentImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) {
if (!pChild)
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp
index 1e236567e8..2ec7b8b468 100644
--- a/xfa/src/fwl/src/core/fwl_formimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_formimp.cpp
@@ -13,19 +13,24 @@
#include "include/fwl_formimp.h"
#include "include/fwl_widgetmgrimp.h"
#include "include/fwl_appimp.h"
+#include "xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h"
+
#define FWL_SYSBTNSIZE 21
#define FWL_SYSBTNMARGIN 5
#define FWL_SYSBTNSPAN 2
#define FWL_CornerEnlarge 10
-FWL_ERR IFWL_Form::Initialize(CFWL_WidgetImpProperties& properties,
- CFX_WideString* classname,
- IFWL_Widget* pOuter) {
- CFWL_FormImp* pFormImpl = new CFWL_FormImp(properties, pOuter);
- SetImpl(pFormImpl);
- pFormImpl->SetInterface(this);
- pFormImpl->SetPrivateData(this, classname, NULL);
- return pFormImpl->Initialize();
-}
+
+// static
+IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties,
+ CFX_WideString* classname,
+ IFWL_Widget* pOuter) {
+ IFWL_Form* pForm = new IFWL_Form;
+ CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter);
+ pForm->SetImpl(pFormProxyImpl);
+ pFormProxyImpl->SetInterface(pForm);
+ return pForm;
+}
+IFWL_Form::IFWL_Form() {}
FWL_FORMSIZE IFWL_Form::GetFormSize() {
return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize();
}
@@ -44,38 +49,7 @@ FWL_ERR IFWL_Form::EndDoModal() {
FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) {
return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath);
}
-IFWL_Form::IFWL_Form() {
-}
-CFWL_FormImp::CFWL_FormImp(IFWL_Widget* pOuter)
- : CFWL_PanelImp(pOuter),
- m_pCloseBox(NULL),
- m_pMinBox(NULL),
- m_pMaxBox(NULL),
- m_pCaptionBox(NULL),
- m_pNoteLoop(NULL),
- m_pSubFocus(NULL),
- m_fCXBorder(0),
- m_fCYBorder(0),
- m_iCaptureBtn(-1),
- m_iSysBox(0),
- m_eResizeType(FORM_RESIZETYPE_None),
- m_bLButtonDown(FALSE),
- m_bMaximized(FALSE),
- m_bSetMaximize(FALSE),
- m_bCustomizeLayout(FALSE),
- m_eFormSize(FWL_FORMSIZE_Manual),
- m_bDoModalFlag(FALSE),
- m_pBigIcon(NULL),
- m_pSmallIcon(NULL),
- m_bMouseIn(FALSE) {
- m_rtRelative.Reset();
- m_rtCaption.Reset();
- m_rtRestore.Reset();
- m_rtCaptionText.Reset();
- m_rtIcon.Reset();
- m_InfoStart.m_ptStart.Reset();
- m_InfoStart.m_szStart.Reset();
-}
+
CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_PanelImp(properties, pOuter),
diff --git a/xfa/src/fwl/src/core/fwl_gridimp.cpp b/xfa/src/fwl/src/core/fwl_gridimp.cpp
index 1d9c5d68a8..ca9c6c26fd 100644
--- a/xfa/src/fwl/src/core/fwl_gridimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_gridimp.cpp
@@ -11,12 +11,16 @@
#include "include/fwl_widgetimp.h"
#include "include/fwl_contentimp.h"
#include "include/fwl_gridimp.h"
-FWL_ERR IFWL_Grid::Initialize(CFWL_WidgetImpProperties& properties) {
- CFWL_GridImp* pGridImpl = new CFWL_GridImp(properties);
- SetImpl(pGridImpl);
- pGridImpl->SetInterface(this);
- return pGridImpl->Initialize();
-}
+
+// static
+IFWL_Grid* IFWL_Grid::Create(const CFWL_WidgetImpProperties& properties) {
+ IFWL_Grid* pGrid = new IFWL_Grid;
+ CFWL_GridImp* pGridImpl = new CFWL_GridImp(properties, nullptr);
+ pGrid->SetImpl(pGridImpl);
+ pGridImpl->SetInterface(pGrid);
+ return pGrid;
+}
+IFWL_Grid::IFWL_Grid() {}
FWL_HGRIDCOLROW IFWL_Grid::InsertColRow(FX_BOOL bColumn, int32_t nIndex) {
return static_cast<CFWL_GridImp*>(GetImpl())->InsertColRow(bColumn, nIndex);
}
@@ -117,24 +121,10 @@ FWL_ERR IFWL_Grid::SetGridSize(FWL_GRIDSIZE eSize,
FWL_GRIDUNIT eUit) {
return static_cast<CFWL_GridImp*>(GetImpl())->SetGridSize(eSize, fSize, eUit);
}
-IFWL_Grid::IFWL_Grid() {
-}
-CFWL_GridImp::CFWL_GridImp() {
- m_Size[FWL_GRIDSIZE_Width].eUnit = FWL_GRIDUNIT_Auto;
- m_Size[FWL_GRIDSIZE_Width].fLength = 0;
- m_Size[FWL_GRIDSIZE_Height].eUnit = FWL_GRIDUNIT_Auto;
- m_Size[FWL_GRIDSIZE_Height].fLength = 0;
- m_Size[FWL_GRIDSIZE_MinWidth].eUnit = FWL_GRIDUNIT_Fixed;
- m_Size[FWL_GRIDSIZE_MinWidth].fLength = 0;
- m_Size[FWL_GRIDSIZE_MaxWidth].eUnit = FWL_GRIDUNIT_Infinity;
- m_Size[FWL_GRIDSIZE_MaxWidth].fLength = 0;
- m_Size[FWL_GRIDSIZE_MinHeight].eUnit = FWL_GRIDUNIT_Fixed;
- m_Size[FWL_GRIDSIZE_MinHeight].fLength = 0;
- m_Size[FWL_GRIDSIZE_MaxHeight].eUnit = FWL_GRIDUNIT_Infinity;
- m_Size[FWL_GRIDSIZE_MaxHeight].fLength = 0;
-}
-CFWL_GridImp::CFWL_GridImp(const CFWL_WidgetImpProperties& properties)
- : CFWL_ContentImp(properties) {
+
+CFWL_GridImp::CFWL_GridImp(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : CFWL_ContentImp(properties, pOuter) {
m_Size[FWL_GRIDSIZE_Width].eUnit = FWL_GRIDUNIT_Auto;
m_Size[FWL_GRIDSIZE_Width].fLength = 0;
m_Size[FWL_GRIDSIZE_Height].eUnit = FWL_GRIDUNIT_Auto;
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index fbd90ecb7f..015b5aaf84 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -991,11 +991,9 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
CFX_RectF rtTooltip;
rtTooltip.Set(150, 150, 100, 50);
prop.m_rtWidget = rtTooltip;
- m_pToolTipImp = new CFWL_ToolTipImp(prop);
- IFWL_ToolTip* pToolTip = new IFWL_ToolTip;
- m_pToolTipImp->SetInterface(pToolTip);
- pToolTip->SetImpl(m_pToolTipImp);
- m_pToolTipImp->Initialize();
+ IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr);
+ pToolTip->Initialize();
+ m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl());
m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0);
m_pToolTipImp->SetStates(FWL_WGTSTATE_Invisible, TRUE);
}
diff --git a/xfa/src/fwl/src/core/fwl_panelimp.cpp b/xfa/src/fwl/src/core/fwl_panelimp.cpp
index 70cb5882d0..fcae28c99e 100644
--- a/xfa/src/fwl/src/core/fwl_panelimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_panelimp.cpp
@@ -9,26 +9,27 @@
#include "include/fwl_noteimp.h"
#include "include/fwl_widgetimp.h"
#include "include/fwl_panelimp.h"
-FWL_ERR IFWL_Panel::Initialize(CFWL_WidgetImpProperties& properties,
+
+// static
+IFWL_Panel* IFWL_Panel::Create(CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
+ IFWL_Panel* pPanel = new IFWL_Panel;
CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(properties, pOuter);
- SetImpl(pPanelImpl);
- pPanelImpl->SetInterface(this);
- return pPanelImpl->Initialize();
+ pPanel->SetImpl(pPanelImpl);
+ pPanelImpl->SetInterface(pPanel);
+ return pPanel;
}
+IFWL_Panel::IFWL_Panel() {}
IFWL_Content* IFWL_Panel::GetContent() {
return static_cast<CFWL_PanelImp*>(GetImpl())->GetContent();
}
FWL_ERR IFWL_Panel::SetContent(IFWL_Content* pContent) {
return static_cast<CFWL_PanelImp*>(GetImpl())->SetContent(pContent);
}
-IFWL_Panel::IFWL_Panel() {
-}
-CFWL_PanelImp::CFWL_PanelImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter), m_pContent(NULL) {}
+
CFWL_PanelImp::CFWL_PanelImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter), m_pContent(NULL) {}
+ : CFWL_WidgetImp(properties, pOuter), m_pContent(nullptr) {}
CFWL_PanelImp::~CFWL_PanelImp() {}
FWL_ERR CFWL_PanelImp::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Panel;
@@ -80,9 +81,8 @@ FWL_ERR CFWL_PanelImp::SetContent(IFWL_Content* pContent) {
}
class CFWL_CustomPanelImp : public CFWL_WidgetImp {
public:
- CFWL_CustomPanelImp(IFWL_Widget* pOuter = NULL);
CFWL_CustomPanelImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_CustomPanelImp();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
@@ -94,12 +94,12 @@ class CFWL_CustomPanelImp : public CFWL_WidgetImp {
IFWL_Content* m_pContent;
IFWL_Proxy* m_pProxy;
};
-CFWL_CustomPanelImp::CFWL_CustomPanelImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter), m_pContent(NULL), m_pProxy(NULL) {}
CFWL_CustomPanelImp::CFWL_CustomPanelImp(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter), m_pContent(NULL), m_pProxy(NULL) {}
+ : CFWL_WidgetImp(properties, pOuter),
+ m_pContent(nullptr),
+ m_pProxy(nullptr) {}
CFWL_CustomPanelImp::~CFWL_CustomPanelImp() {}
FWL_ERR CFWL_CustomPanelImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize && m_pProxy &&
@@ -127,14 +127,18 @@ FWL_ERR CFWL_CustomPanelImp::SetProxy(IFWL_Proxy* pProxy) {
m_pProxy = pProxy;
return FWL_ERR_Succeeded;
}
-FWL_ERR IFWL_CustomPanel::Initialize(CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// statuc
+IFWL_CustomPanel* IFWL_CustomPanel::Create(CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_CustomPanel* pCustomPanel = new IFWL_CustomPanel;
CFWL_CustomPanelImp* pCustomPanelImpl =
new CFWL_CustomPanelImp(properties, pOuter);
- SetImpl(pCustomPanelImpl);
- pCustomPanelImpl->SetInterface(this);
- return pCustomPanelImpl->Initialize();
+ pCustomPanel->SetImpl(pCustomPanelImpl);
+ pCustomPanelImpl->SetInterface(pCustomPanel);
+ return pCustomPanel;
}
+IFWL_CustomPanel::IFWL_CustomPanel() {}
IFWL_Content* IFWL_CustomPanel::GetContent() {
return static_cast<CFWL_CustomPanelImp*>(GetImpl())->GetContent();
}
@@ -144,5 +148,3 @@ FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) {
FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) {
return static_cast<CFWL_CustomPanelImp*>(GetImpl())->SetProxy(pProxy);
}
-IFWL_CustomPanel::IFWL_CustomPanel() {
-}
diff --git a/xfa/src/fwl/src/core/fwl_targetimp.cpp b/xfa/src/fwl/src/core/fwl_targetimp.cpp
index dde102159b..b72a6a7923 100644
--- a/xfa/src/fwl/src/core/fwl_targetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_targetimp.cpp
@@ -28,6 +28,7 @@ CFWL_TargetImp::CFWL_TargetImp() {}
CFWL_TargetImp::~CFWL_TargetImp() {
}
FWL_ERR CFWL_TargetImp::GetClassName(CFX_WideString& wsClass) const {
+ wsClass.Empty();
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_TargetImp::GetClassID() const {
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 4cba92a1cf..95e235d12a 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -499,30 +499,15 @@ IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
m_pInterface = pInterface;
}
-CFWL_WidgetImp::CFWL_WidgetImp(IFWL_Widget* pOuter)
- : m_pProperties(NULL),
- m_pPrivateData(NULL),
- m_pDelegate(NULL),
- m_pCurDelegate(NULL),
- m_pOuter(pOuter),
- m_pInterface(NULL),
- m_iLock(0) {
- m_pProperties = new CFWL_WidgetImpProperties;
- m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- FXSYS_assert(m_pWidgetMgr != NULL);
-}
CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : m_pProperties(NULL),
+ : m_pProperties(new CFWL_WidgetImpProperties),
m_pPrivateData(NULL),
m_pDelegate(NULL),
m_pCurDelegate(NULL),
m_pOuter(pOuter),
m_pInterface(NULL),
m_iLock(0) {
- if (!m_pProperties) {
- m_pProperties = new CFWL_WidgetImpProperties;
- }
*m_pProperties = properties;
m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
FXSYS_assert(m_pWidgetMgr != NULL);
@@ -1040,9 +1025,8 @@ FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
}
class CFWL_CustomImp : public CFWL_WidgetImp {
public:
- CFWL_CustomImp(IFWL_Widget* pOuter = NULL);
CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
virtual FWL_ERR SetProxy(IFWL_Proxy* pProxy);
@@ -1050,8 +1034,6 @@ class CFWL_CustomImp : public CFWL_WidgetImp {
protected:
IFWL_Proxy* m_pProxy;
};
-CFWL_CustomImp::CFWL_CustomImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter), m_pProxy(NULL) {}
CFWL_CustomImp::CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter), m_pProxy(NULL) {}
@@ -1072,15 +1054,17 @@ FWL_ERR CFWL_CustomImp::SetProxy(IFWL_Proxy* pProxy) {
m_pProxy = pProxy;
return FWL_ERR_Succeeded;
}
-IFWL_Custom::IFWL_Custom() {
-}
-FWL_ERR IFWL_Custom::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_Custom* IFWL_Custom::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_Custom* pCustom = new IFWL_Custom;
CFWL_CustomImp* pCustomImpl = new CFWL_CustomImp(properties, pOuter);
- SetImpl(pCustomImpl);
- pCustomImpl->SetInterface(this);
- return pCustomImpl->Initialize();
+ pCustom->SetImpl(pCustomImpl);
+ pCustomImpl->SetInterface(pCustom);
+ return pCustom;
}
+IFWL_Custom::IFWL_Custom() {}
FWL_ERR IFWL_Custom::SetProxy(IFWL_Proxy* pProxy) {
return static_cast<CFWL_CustomImp*>(GetImpl())->SetProxy(pProxy);
}
diff --git a/xfa/src/fwl/src/core/include/fwl_contentimp.h b/xfa/src/fwl/src/core/include/fwl_contentimp.h
index 0bfc77cd58..dc7ff7b681 100644
--- a/xfa/src/fwl/src/core/include/fwl_contentimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_contentimp.h
@@ -11,8 +11,9 @@ class IFWL_Widget;
class CFWL_ContentImp;
class CFWL_ContentImp : public CFWL_WidgetImp {
public:
- CFWL_ContentImp();
- CFWL_ContentImp(const CFWL_WidgetImpProperties& properties);
+ CFWL_ContentImp(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
virtual ~CFWL_ContentImp();
virtual FWL_ERR InsertWidget(IFWL_Widget* pChild, int32_t nIndex = -1);
virtual FWL_ERR RemoveWidget(IFWL_Widget* pWidget);
@@ -25,7 +26,7 @@ class CFWL_ContentImp : public CFWL_WidgetImp {
protected:
FX_FLOAT m_fWidthMin;
FX_FLOAT m_fWidthMax;
- FX_FLOAT m_fHeightMax;
FX_FLOAT m_fHeightMin;
+ FX_FLOAT m_fHeightMax;
};
#endif
diff --git a/xfa/src/fwl/src/core/include/fwl_formimp.h b/xfa/src/fwl/src/core/include/fwl_formimp.h
index f0e986ecff..7ac7072f5f 100644
--- a/xfa/src/fwl/src/core/include/fwl_formimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_formimp.h
@@ -67,9 +67,7 @@ typedef struct RestoreResizeInfo {
} RestoreInfo;
class CFWL_FormImp : public CFWL_PanelImp {
public:
- CFWL_FormImp(IFWL_Widget* pOuter = NULL);
- CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
virtual ~CFWL_FormImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/core/include/fwl_gridimp.h b/xfa/src/fwl/src/core/include/fwl_gridimp.h
index bce154ded3..94042c16f8 100644
--- a/xfa/src/fwl/src/core/include/fwl_gridimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_gridimp.h
@@ -70,8 +70,7 @@ class CFWL_GridWidgetInfo {
};
class CFWL_GridImp : public CFWL_ContentImp {
public:
- CFWL_GridImp();
- CFWL_GridImp(const CFWL_WidgetImpProperties& properties);
+ CFWL_GridImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
virtual ~CFWL_GridImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/core/include/fwl_panelimp.h b/xfa/src/fwl/src/core/include/fwl_panelimp.h
index 508c4bb767..be42d9560c 100644
--- a/xfa/src/fwl/src/core/include/fwl_panelimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_panelimp.h
@@ -13,9 +13,8 @@ class IFWL_Content;
class CFWL_PanelImp;
class CFWL_PanelImp : public CFWL_WidgetImp {
public:
- CFWL_PanelImp(IFWL_Widget* pOuter = NULL);
CFWL_PanelImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_PanelImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
diff --git a/xfa/src/fwl/src/core/include/fwl_widgetimp.h b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
index 109e575914..bc6ea5f988 100644
--- a/xfa/src/fwl/src/core/include/fwl_widgetimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_widgetimp.h
@@ -66,9 +66,8 @@ class CFWL_WidgetImp : public CFWL_TargetImp {
CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
protected:
- CFWL_WidgetImp(IFWL_Widget* pOuter = NULL);
CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual ~CFWL_WidgetImp();
FX_BOOL IsEnabled() const;
FX_BOOL IsVisible() const;
diff --git a/xfa/src/fwl/src/lightwidget/barcode.cpp b/xfa/src/fwl/src/lightwidget/barcode.cpp
index d0f3be46f3..15b0a40d91 100644
--- a/xfa/src/fwl/src/lightwidget/barcode.cpp
+++ b/xfa/src/fwl/src/lightwidget/barcode.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_Barcode;
- FWL_ERR ret =
- ((IFWL_Barcode*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_barcodeData),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_Barcode> pBarcode(IFWL_Barcode::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_barcodeData)));
+ FWL_ERR ret = pBarcode->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pBarcode.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
CFWL_Barcode::CFWL_Barcode() {}
CFWL_Barcode::~CFWL_Barcode() {}
diff --git a/xfa/src/fwl/src/lightwidget/caret.cpp b/xfa/src/fwl/src/lightwidget/caret.cpp
index cb318d9a58..96be7dabbf 100644
--- a/xfa/src/fwl/src/lightwidget/caret.cpp
+++ b/xfa/src/fwl/src/lightwidget/caret.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_Caret;
- FWL_ERR ret =
- ((IFWL_Caret*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(nullptr),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create(
+ m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
+ FWL_ERR ret = pCaret->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pCaret.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) {
return ((IFWL_Caret*)m_pIface)->ShowCaret(bFlag);
diff --git a/xfa/src/fwl/src/lightwidget/checkbox.cpp b/xfa/src/fwl/src/lightwidget/checkbox.cpp
index 296a2635ea..a9ae80f533 100644
--- a/xfa/src/fwl/src/lightwidget/checkbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/checkbox.cpp
@@ -14,25 +14,19 @@ FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- CFWL_WidgetImpProperties prop;
- prop.m_ctmOnParent = m_pProperties->m_ctmOnParent;
- prop.m_rtWidget = m_pProperties->m_rtWidget;
- prop.m_dwStyles = m_pProperties->m_dwStyles;
- prop.m_dwStyleExes = m_pProperties->m_dwStyleExes;
- prop.m_dwStates = m_pProperties->m_dwStates;
- prop.m_pDataProvider = &m_checkboxData;
- if (m_pProperties->m_pParent) {
- prop.m_pParent = m_pProperties->m_pParent->GetWidget();
+ CFWL_WidgetImpProperties prop =
+ m_pProperties->MakeWidgetImpProperties(&m_checkboxData);
+ prop.m_pParent = m_pProperties->m_pParent->GetWidget();
+ prop.m_pOwner = m_pProperties->m_pOwner->GetWidget();
+ nonstd::unique_ptr<IFWL_CheckBox> pCheckBox(
+ IFWL_CheckBox::Create(prop, nullptr));
+ FWL_ERR ret = pCheckBox->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- if (m_pProperties->m_pOwner) {
- prop.m_pOwner = m_pProperties->m_pOwner->GetWidget();
- }
- m_pIface = new IFWL_CheckBox;
- FWL_ERR ret = ((IFWL_CheckBox*)m_pIface)->Initialize(prop, nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
- }
- return ret;
+ m_pIface = pCheckBox.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) {
m_checkboxData.m_wsCaption = wsCaption;
diff --git a/xfa/src/fwl/src/lightwidget/combobox.cpp b/xfa/src/fwl/src/lightwidget/combobox.cpp
index b758883321..bff783ea49 100644
--- a/xfa/src/fwl/src/lightwidget/combobox.cpp
+++ b/xfa/src/fwl/src/lightwidget/combobox.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_ComboBox;
- FWL_ERR ret =
- ((IFWL_ComboBox*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_comboBoxData),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_comboBoxData)));
+ FWL_ERR ret = pComboBox->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pComboBox.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
CFWL_ComboBoxItem* pItem = new CFWL_ComboBoxItem;
diff --git a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
index 60e0e30b4e..3138e38518 100644
--- a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
+++ b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
@@ -15,17 +15,19 @@ FWL_ERR CFWL_DateTimePicker::Initialize(
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_DateTimePicker;
- FWL_ERR ret =
- ((IFWL_DateTimePicker*)m_pIface)
- ->Initialize(
- m_pProperties->MakeWidgetImpProperties(&m_DateTimePickerDP),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_DateTimePicker> pDateTimePicker(
+ IFWL_DateTimePicker::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_DateTimePickerDP),
+ nullptr));
+ FWL_ERR ret = pDateTimePicker->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pDateTimePicker.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
+
FWL_ERR CFWL_DateTimePicker::SetToday(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
diff --git a/xfa/src/fwl/src/lightwidget/edit.cpp b/xfa/src/fwl/src/lightwidget/edit.cpp
index 8e89e6474b..92e8f8138c 100644
--- a/xfa/src/fwl/src/lightwidget/edit.cpp
+++ b/xfa/src/fwl/src/lightwidget/edit.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_Edit;
- FWL_ERR ret =
- ((IFWL_Edit*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(nullptr),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create(
+ m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
+ FWL_ERR ret = pEdit->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pEdit.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) {
if (!m_pIface)
diff --git a/xfa/src/fwl/src/lightwidget/listbox.cpp b/xfa/src/fwl/src/lightwidget/listbox.cpp
index cd8c3305e9..448fd7254b 100644
--- a/xfa/src/fwl/src/lightwidget/listbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/listbox.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_ListBox;
- FWL_ERR ret =
- ((IFWL_ListBox*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_ListBox> pListBox(IFWL_ListBox::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr));
+ FWL_ERR ret = pListBox->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pListBox.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) {
((CFWL_ListItem*)hItem)->m_pDIB = pDIB;
diff --git a/xfa/src/fwl/src/lightwidget/picturebox.cpp b/xfa/src/fwl/src/lightwidget/picturebox.cpp
index 7d8e201d85..265baa1b11 100644
--- a/xfa/src/fwl/src/lightwidget/picturebox.cpp
+++ b/xfa/src/fwl/src/lightwidget/picturebox.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_PictureBox;
- FWL_ERR ret =
- ((IFWL_PictureBox*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr));
+ FWL_ERR ret = pPictureBox->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pPictureBox.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
return m_PictureBoxDP.m_pBitmap;
diff --git a/xfa/src/fwl/src/lightwidget/pushbutton.cpp b/xfa/src/fwl/src/lightwidget/pushbutton.cpp
index 24050c8666..a3df89106d 100644
--- a/xfa/src/fwl/src/lightwidget/pushbutton.cpp
+++ b/xfa/src/fwl/src/lightwidget/pushbutton.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_PushButton;
- FWL_ERR ret =
- ((IFWL_PushButton*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_buttonData),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr));
+ FWL_ERR ret = pPushButton->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pPushButton.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) {
wsCaption = m_buttonData.m_wsCaption;
diff --git a/xfa/src/fwl/src/lightwidget/scrollbar.cpp b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
index eaf9b575ef..a7a177d0ab 100644
--- a/xfa/src/fwl/src/lightwidget/scrollbar.cpp
+++ b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
@@ -14,15 +14,15 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_ScrollBar;
- FWL_ERR ret =
- ((IFWL_ScrollBar*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(nullptr),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create(
+ m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
+ FWL_ERR ret = pScrollBar->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pScrollBar.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FX_BOOL CFWL_ScrollBar::IsVertical() {
if (!m_pIface)
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
index 19ca2cb94f..de616acd35 100644
--- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
+++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
@@ -20,15 +20,15 @@ FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- m_pIface = new IFWL_ToolTip;
- FWL_ERR ret =
- ((IFWL_ToolTip*)m_pIface)
- ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_tooltipData),
- nullptr);
- if (ret == FWL_ERR_Succeeded) {
- CFWL_Widget::Initialize();
+ nonstd::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create(
+ m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr));
+ FWL_ERR ret = pToolTip->Initialize();
+ if (ret != FWL_ERR_Succeeded) {
+ return ret;
}
- return ret;
+ m_pIface = pToolTip.release();
+ CFWL_Widget::Initialize();
+ return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) {
wsCaption = m_tooltipData.m_wsCaption;
diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp
index 4e01addc28..a88fe11ec3 100644
--- a/xfa/src/fwl/src/theme/checkboxtp.cpp
+++ b/xfa/src/fwl/src/theme/checkboxtp.cpp
@@ -29,11 +29,7 @@ CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
}
}
FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
- if (!pWidget)
- return FALSE;
- FX_DWORD dwHash = pWidget->GetClassID();
- return dwHash == FWL_CLASSHASH_CheckBox ||
- dwHash == FWL_CLASSHASH_RadioButton;
+ return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox;
}
FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget,
FX_DWORD dwThemeID,
diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
index 0d2412858f..cbf81ad46c 100644
--- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
@@ -310,7 +310,6 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) {
switch (pWidget->GetClassID()) {
case FWL_CLASSHASH_CheckBox:
- case FWL_CLASSHASH_RadioButton:
return m_pCheckBoxTP;
case FWL_CLASSHASH_ListBox:
return m_pListBoxTP;