summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-23 09:02:34 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-23 09:02:34 -0800
commit209821f79d0bbeeaeadf4e82ff643ee20d676222 (patch)
tree8384d4422830f598fbe727448e1f39bdd73a895d
parent1e32d811c1c9f0a729e8072cf3530208cf52e763 (diff)
downloadpdfium-209821f79d0bbeeaeadf4e82ff643ee20d676222.tar.xz
Remove plumbing for today value
The calendar always sets today to 2011/01/01. This Cl removes the various DataProviders needed to plumb this value and just sets it where needed. Review-Url: https://codereview.chromium.org/2524993002
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.cpp9
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.h8
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp27
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h18
-rw-r--r--xfa/fwl/core/ifwl_monthcalendar.cpp24
-rw-r--r--xfa/fwl/core/ifwl_monthcalendar.h7
6 files changed, 10 insertions, 83 deletions
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index 4f3b510cf0..a1d628d692 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -57,15 +57,6 @@ void CFWL_DateTimePicker::SetCurSel(int32_t iYear,
ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay);
}
-void CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
- iYear = 2011;
- iMonth = 1;
- iDay = 1;
-}
-
void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
ToDateTimePicker(GetWidget())->GetBBox(rect);
}
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index 25fb6f8678..67d0ff1163 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -11,19 +11,13 @@
#include "xfa/fwl/core/ifwl_datetimepicker.h"
class CFWL_DateTimePicker : public CFWL_Widget,
- public IFWL_DateTimePicker::DataProvider {
+ public IFWL_Widget::DataProvider {
public:
explicit CFWL_DateTimePicker(const CFWL_App* pApp);
~CFWL_DateTimePicker() override;
void Initialize();
- // IFWL_DateTimePicker::DataProvider
- void GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) override;
-
void GetEditText(CFX_WideString& wsText);
void SetEditText(const CFX_WideString& wsText);
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 9662ec0140..1a7cf2c06c 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -36,9 +36,6 @@ IFWL_DateTimePicker::IFWL_DateTimePicker(
m_iYear(-1),
m_iMonth(-1),
m_iDay(-1),
- m_iCurYear(2010),
- m_iCurMonth(3),
- m_iCurDay(29),
m_bLBtnDown(false) {
m_rtBtn.Set(0, 0, 0, 0);
@@ -117,12 +114,6 @@ void IFWL_DateTimePicker::Update() {
m_pEdit->Update();
if (!(m_pMonthCal->GetThemeProvider()))
m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
- if (m_pProperties->m_pDataProvider) {
- IFWL_DateTimePicker::DataProvider* pData =
- static_cast<IFWL_DateTimePicker::DataProvider*>(
- m_pProperties->m_pDataProvider);
- pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay);
- }
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, true);
@@ -467,12 +458,6 @@ void IFWL_DateTimePicker::DisForm_Update() {
if (!m_pMonthCal->GetThemeProvider())
m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
- if (m_pProperties->m_pDataProvider) {
- IFWL_DateTimePicker::DataProvider* pData =
- static_cast<IFWL_DateTimePicker::DataProvider*>(
- m_pProperties->m_pDataProvider);
- pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay);
- }
FX_FLOAT* pWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -674,15 +659,3 @@ void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg,
rtInvalidate.Inflate(2, 2);
Repaint(&rtInvalidate);
}
-
-int32_t IFWL_DateTimePicker::GetCurDay(IFWL_Widget* pWidget) {
- return m_iCurDay;
-}
-
-int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) {
- return m_iCurMonth;
-}
-
-int32_t IFWL_DateTimePicker::GetCurYear(IFWL_Widget* pWidget) {
- return m_iCurYear;
-}
diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h
index 2b4be4804d..3b0dc39b1d 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -36,16 +36,8 @@ class IFWL_DateTimeEdit;
class IFWL_FormProxy;
class IFWL_DateTimePicker : public IFWL_Widget,
- public IFWL_MonthCalendar::DataProvider {
+ public IFWL_Widget::DataProvider {
public:
- class DataProvider : public IFWL_Widget::DataProvider {
- public:
- virtual void GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) = 0;
- };
-
explicit IFWL_DateTimePicker(
const CFWL_App* app,
std::unique_ptr<CFWL_WidgetProperties> properties);
@@ -63,11 +55,6 @@ class IFWL_DateTimePicker : public IFWL_Widget,
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- // IFWL_MonthCalendar::DataProvider
- int32_t GetCurDay(IFWL_Widget* pWidget) override;
- int32_t GetCurMonth(IFWL_Widget* pWidget) override;
- int32_t GetCurYear(IFWL_Widget* pWidget) override;
-
void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
@@ -124,9 +111,6 @@ class IFWL_DateTimePicker : public IFWL_Widget,
int32_t m_iYear;
int32_t m_iMonth;
int32_t m_iDay;
- int32_t m_iCurYear;
- int32_t m_iCurMonth;
- int32_t m_iCurDay;
bool m_bLBtnDown;
std::unique_ptr<IFWL_DateTimeEdit> m_pEdit;
std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal;
diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp
index 0137f195c9..aaa15e47ae 100644
--- a/xfa/fwl/core/ifwl_monthcalendar.cpp
+++ b/xfa/fwl/core/ifwl_monthcalendar.cpp
@@ -724,22 +724,14 @@ void IFWL_MonthCalendar::GetCapValue() {
}
void IFWL_MonthCalendar::InitDate() {
- if (m_pProperties->m_pDataProvider) {
- IFWL_MonthCalendar::DataProvider* pDateProv =
- static_cast<IFWL_MonthCalendar::DataProvider*>(
- m_pProperties->m_pDataProvider);
- m_iYear = pDateProv->GetCurYear(this);
- m_iMonth = pDateProv->GetCurMonth(this);
- m_iDay = pDateProv->GetCurDay(this);
- m_iCurYear = m_iYear;
- m_iCurMonth = m_iMonth;
- } else {
- m_iDay = 1;
- m_iMonth = 1;
- m_iYear = 1;
- m_iCurYear = m_iYear;
- m_iCurMonth = m_iMonth;
- }
+ // TODO(dsinclair): These should pull the real today values instead of
+ // pretending it's 2011-01-01.
+ m_iYear = 2011;
+ m_iMonth = 1;
+ m_iDay = 1;
+ m_iCurYear = m_iYear;
+ m_iCurMonth = m_iMonth;
+
GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday);
GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead);
m_dtMin = DATE(1500, 12, 1);
diff --git a/xfa/fwl/core/ifwl_monthcalendar.h b/xfa/fwl/core/ifwl_monthcalendar.h
index dd58663106..758ce5c730 100644
--- a/xfa/fwl/core/ifwl_monthcalendar.h
+++ b/xfa/fwl/core/ifwl_monthcalendar.h
@@ -28,13 +28,6 @@ class IFWL_Widget;
class IFWL_MonthCalendar : public IFWL_Widget {
public:
- class DataProvider : public IFWL_Widget::DataProvider {
- public:
- virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0;
- virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0;
- virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0;
- };
-
IFWL_MonthCalendar(const CFWL_App* app,
std::unique_ptr<CFWL_WidgetProperties> properties,
IFWL_Widget* pOuter);