summaryrefslogtreecommitdiff
path: root/xfa/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-09 16:16:19 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-09 16:16:19 -0800
commit8ee79f8f2824d5b7058d49ebb10ced6b001c178e (patch)
tree182737e505b0795a1a9365cc3f591df266d5a6ae /xfa/include
parentb3e2d4ae6c0c9a32c4616acc71cad4751c210ae0 (diff)
downloadpdfium-8ee79f8f2824d5b7058d49ebb10ced6b001c178e.tar.xz
FWL refcounts never incremented (part 2).
Re-introduce create methods that actually create the corresponding impl so we don't have ifaces without impls. Remove per-subclass Initialize() methods. Remove unused ctors. BUG=pdfium:282 R=jun_fang@foxitsoftware.com, thestig@chromium.org Review URL: https://codereview.chromium.org/1453473002 .
Diffstat (limited to 'xfa/include')
-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
18 files changed, 96 insertions, 63 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: