Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: xfa/fwl/core/ifwl_datetimepicker.cpp

Issue 2469893004: Unify CFWL_WidgetProperties and CFWL_WidgetImpProperties. (Closed)
Patch Set: cleanup Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fwl/core/ifwl_datetimepicker.cpp
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 5237326b9e36e8e2ff076fa50795ecdd42e335c5..6664b2229b06c5b405baa582a3079ca56a01f34d 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -26,8 +26,8 @@ const int kDateTimePickerHeight = 20;
IFWL_DateTimePicker::IFWL_DateTimePicker(
const IFWL_App* app,
- const CFWL_WidgetImpProperties& properties)
- : IFWL_Widget(app, properties, nullptr),
+ std::unique_ptr<CFWL_WidgetProperties> properties)
+ : IFWL_Widget(app, std::move(properties), nullptr),
m_iBtnState(1),
m_iYear(-1),
m_iMonth(-1),
@@ -36,23 +36,26 @@ IFWL_DateTimePicker::IFWL_DateTimePicker(
m_rtBtn.Set(0, 0, 0, 0);
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
- CFWL_WidgetImpProperties propMonth;
- propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
- propMonth.m_dwStates = FWL_WGTSTATE_Invisible;
- propMonth.m_pDataProvider = &m_MonthCalendarDP;
- propMonth.m_pParent = this;
- propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
-
- m_pMonthCal.reset(new IFWL_DateTimeCalendar(m_pOwnerApp, propMonth, this));
+
+ auto propMonth =
Tom Sepez 2016/11/03 18:22:44 nit: same, monthProp.
dsinclair 2016/11/03 19:10:18 Done.
+ pdfium::MakeUnique<CFWL_WidgetProperties>(&m_MonthCalendarDP);
+ propMonth->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
+ propMonth->m_dwStates = FWL_WGTSTATE_Invisible;
+ propMonth->m_pParent = this;
+ propMonth->m_pThemeProvider = m_pProperties->m_pThemeProvider;
+ m_pMonthCal.reset(
+ new IFWL_DateTimeCalendar(m_pOwnerApp, std::move(propMonth), this));
+
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, true);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
m_pMonthCal->SetWidgetRect(rtMonthCal);
- CFWL_WidgetImpProperties propEdit;
- propEdit.m_pParent = this;
- propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, propEdit, this));
+ auto propEdit = pdfium::MakeUnique<CFWL_WidgetProperties>();
+ propEdit->m_pParent = this;
+ propEdit->m_pThemeProvider = m_pProperties->m_pThemeProvider;
+
+ m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, std::move(propEdit), this));
RegisterEventTarget(m_pMonthCal.get());
RegisterEventTarget(m_pEdit.get());
}
@@ -433,12 +436,14 @@ void IFWL_DateTimePicker::InitProxyForm() {
return;
if (!m_pMonthCal)
return;
- CFWL_WidgetImpProperties propForm;
- propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
- propForm.m_dwStates = FWL_WGTSTATE_Invisible;
- propForm.m_pOwner = this;
- m_pForm.reset(new IFWL_FormProxy(m_pOwnerApp, propForm, m_pMonthCal.get()));
+ auto propForm = pdfium::MakeUnique<CFWL_WidgetProperties>();
Tom Sepez 2016/11/03 18:22:44 ditto and below.
dsinclair 2016/11/03 19:10:18 Done.
+ propForm->m_dwStyles = FWL_WGTSTYLE_Popup;
+ propForm->m_dwStates = FWL_WGTSTATE_Invisible;
+ propForm->m_pOwner = this;
+
+ m_pForm.reset(
+ new IFWL_FormProxy(m_pOwnerApp, std::move(propForm), m_pMonthCal.get()));
m_pMonthCal->SetParent(m_pForm.get());
}
@@ -459,15 +464,16 @@ void IFWL_DateTimePicker::DisForm_InitDateTimeCalendar() {
if (m_pMonthCal) {
Tom Sepez 2016/11/03 18:22:44 nit: no {} while were at it.
dsinclair 2016/11/03 19:10:18 Done.
return;
}
- CFWL_WidgetImpProperties propMonth;
- propMonth.m_dwStyles =
+ auto propMonth =
+ pdfium::MakeUnique<CFWL_WidgetProperties>(&m_MonthCalendarDP);
+ propMonth->m_dwStyles =
FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken;
- propMonth.m_dwStates = FWL_WGTSTATE_Invisible;
- propMonth.m_pParent = this;
- propMonth.m_pDataProvider = &m_MonthCalendarDP;
- propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
+ propMonth->m_dwStates = FWL_WGTSTATE_Invisible;
+ propMonth->m_pParent = this;
+ propMonth->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(new IFWL_DateTimeCalendar(m_pOwnerApp, propMonth, this));
+ m_pMonthCal.reset(
+ new IFWL_DateTimeCalendar(m_pOwnerApp, std::move(propMonth), this));
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, true);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
@@ -478,11 +484,11 @@ void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() {
if (m_pEdit) {
Tom Sepez 2016/11/03 18:22:44 nit: no {}
dsinclair 2016/11/03 19:10:17 Done.
return;
}
- CFWL_WidgetImpProperties propEdit;
- propEdit.m_pParent = this;
- propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
+ auto propEdit = pdfium::MakeUnique<CFWL_WidgetProperties>();
+ propEdit->m_pParent = this;
+ propEdit->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, propEdit, this));
+ m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, std::move(propEdit), this));
}
bool IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() {

Powered by Google App Engine
This is Rietveld 408576698