diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-09 16:16:19 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-09 16:16:19 -0800 |
commit | 8ee79f8f2824d5b7058d49ebb10ced6b001c178e (patch) | |
tree | 182737e505b0795a1a9365cc3f591df266d5a6ae /xfa/src | |
parent | b3e2d4ae6c0c9a32c4616acc71cad4751c210ae0 (diff) | |
download | pdfium-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/src')
53 files changed, 441 insertions, 666 deletions
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;
|