Continue IFWL widget cleanup.
Remove usunsed methods and FWL_Error returns.
Review-Url: https://codereview.chromium.org/2488963005
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp
index 77faefe..053826d 100644
--- a/xfa/fwl/core/cfwl_barcode.cpp
+++ b/xfa/fwl/core/cfwl_barcode.cpp
@@ -111,9 +111,7 @@
return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false;
}
-FWL_Error CFWL_Barcode::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
- return FWL_Error::Succeeded;
+void CFWL_Barcode::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) {
}
BC_CHAR_ENCODING CFWL_Barcode::GetCharEncoding() const {
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h
index be89318..78e5e68 100644
--- a/xfa/fwl/core/cfwl_barcode.h
+++ b/xfa/fwl/core/cfwl_barcode.h
@@ -37,8 +37,7 @@
void ResetBarcodeAttributes();
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_BarcodeDP
BC_CHAR_ENCODING GetCharEncoding() const override;
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index 5372083..75e85fc 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -51,10 +51,9 @@
return ToCheckBox(GetWidget())->SetCheckState(iCheck);
}
-FWL_Error CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+void CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
- return FWL_Error::Succeeded;
}
FX_FLOAT CFWL_CheckBox::GetBoxSize(IFWL_Widget* pWidget) {
diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h
index 8ab8885..730b906 100644
--- a/xfa/fwl/core/cfwl_checkbox.h
+++ b/xfa/fwl/core/cfwl_checkbox.h
@@ -23,8 +23,7 @@
FWL_Error SetCheckState(int32_t iCheck);
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_CheckBoxDP
FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 1a75927..572f4bf 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -232,10 +232,8 @@
}
}
-FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
- return FWL_Error::Succeeded;
-}
+void CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {}
int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) {
return m_ItemArray.size();
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index 2467119..1b6f814 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -63,8 +63,7 @@
void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP
int32_t CountItems(const IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index fb4a39f..efc2b62 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -35,15 +35,6 @@
CFWL_Widget::Initialize();
}
-FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- m_iYear = iYear;
- m_iMonth = iMonth;
- m_iDay = iDay;
- return FWL_Error::Succeeded;
-}
-
int32_t CFWL_DateTimePicker::CountSelRanges() {
return ToDateTimePicker(GetWidget())->CountSelRanges();
}
@@ -52,100 +43,40 @@
return ToDateTimePicker(GetWidget())->GetSelRange(nIndex, nStart);
}
-FWL_Error CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) {
- return ToDateTimePicker(GetWidget())->GetEditText(wsText);
+void CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) {
+ ToDateTimePicker(GetWidget())->GetEditText(wsText);
}
-FWL_Error CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
- return ToDateTimePicker(GetWidget())->SetEditText(wsText);
+void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
+ ToDateTimePicker(GetWidget())->SetEditText(wsText);
}
-FWL_Error CFWL_DateTimePicker::GetCurSel(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
- return ToDateTimePicker(GetWidget())->GetCurSel(iYear, iMonth, iDay);
+void CFWL_DateTimePicker::SetCurSel(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
+ ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay);
}
-FWL_Error CFWL_DateTimePicker::SetCurSel(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- return ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay);
-}
-
-FWL_Error CFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+void CFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsData;
- return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+void CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget,
+ int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_iYear;
iMonth = m_iMonth;
iDay = m_iDay;
- return FWL_Error::Succeeded;
}
-bool CFWL_DateTimePicker::CanUndo() {
- return ToDateTimePicker(GetWidget())->CanUndo();
+void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
+ ToDateTimePicker(GetWidget())->GetBBox(rect);
}
-bool CFWL_DateTimePicker::CanRedo() {
- return ToDateTimePicker(GetWidget())->CanRedo();
-}
-
-bool CFWL_DateTimePicker::Undo() {
- return ToDateTimePicker(GetWidget())->Undo();
-}
-
-bool CFWL_DateTimePicker::Redo() {
- return ToDateTimePicker(GetWidget())->Redo();
-}
-
-bool CFWL_DateTimePicker::CanCopy() {
- return ToDateTimePicker(GetWidget())->CanCopy();
-}
-
-bool CFWL_DateTimePicker::CanCut() {
- return ToDateTimePicker(GetWidget())->CanCut();
-}
-
-bool CFWL_DateTimePicker::CanSelectAll() {
- return ToDateTimePicker(GetWidget())->CanSelectAll();
-}
-
-bool CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
- return ToDateTimePicker(GetWidget())->Copy(wsCopy);
-}
-
-bool CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
- return ToDateTimePicker(GetWidget())->Copy(wsCut);
-}
-
-bool CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
- return ToDateTimePicker(GetWidget())->Paste(wsPaste);
-}
-
-bool CFWL_DateTimePicker::SelectAll() {
- return ToDateTimePicker(GetWidget())->SelectAll();
-}
-
-bool CFWL_DateTimePicker::Delete() {
- return ToDateTimePicker(GetWidget())->Delete();
-}
-
-bool CFWL_DateTimePicker::DeSelect() {
- return ToDateTimePicker(GetWidget())->DeSelect();
-}
-
-FWL_Error CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
- return ToDateTimePicker(GetWidget())->GetBBox(rect);
-}
-
-FWL_Error CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
- return ToDateTimePicker(GetWidget())->SetEditLimit(nLimit);
+void CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
+ ToDateTimePicker(GetWidget())->SetEditLimit(nLimit);
}
void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index 9227c7b..5003cb2 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -17,39 +17,25 @@
void Initialize();
- FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay);
- FWL_Error GetEditText(CFX_WideString& wsText);
- FWL_Error SetEditText(const CFX_WideString& wsText);
- int32_t CountSelRanges();
- int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
- FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
- FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
- bool CanUndo();
- bool CanRedo();
- bool Undo();
- bool Redo();
- bool CanCopy();
- bool CanCut();
- bool CanSelectAll();
- bool Copy(CFX_WideString& wsCopy);
- bool Cut(CFX_WideString& wsCut);
- bool Paste(const CFX_WideString& wsPaste);
- bool SelectAll();
- bool Delete();
- bool DeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
- FWL_Error SetEditLimit(int32_t nLimit);
- void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
-
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_DateTimePickerDP
- FWL_Error GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) override;
+ 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);
+
+ int32_t CountSelRanges();
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
+
+ void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
+ void GetBBox(CFX_RectF& rect);
+ void SetEditLimit(int32_t nLimit);
+ void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
private:
int32_t m_iYear;
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 9267f59..5827ac4 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -119,10 +119,8 @@
return pListItem->m_dwStates | pListItem->m_dwCheckState;
}
-FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+void CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) {
wsCaption = L"";
- return FWL_Error::Succeeded;
}
int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) {
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index 901f77e..0f1d35a 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -23,8 +23,7 @@
void Initialize();
// IFWL_DataProvider:
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP:
int32_t CountItems(const IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp
index 28d3186..8badc99 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -95,10 +95,8 @@
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
- return FWL_Error::Succeeded;
-}
+void CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {}
CFX_DIBitmap* CFWL_PictureBox::GetPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h
index 5cd7c6f..1efa0ad 100644
--- a/xfa/fwl/core/cfwl_picturebox.h
+++ b/xfa/fwl/core/cfwl_picturebox.h
@@ -32,8 +32,7 @@
FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy);
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_PictureBoxDP
CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp
index 888c127..1fc6191 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -24,11 +24,6 @@
CFWL_Widget::Initialize();
}
-FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) {
- wsCaption = m_wsCaption;
- return FWL_Error::Succeeded;
-}
-
FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) {
m_wsCaption = wsCaption;
return FWL_Error::Succeeded;
@@ -43,10 +38,9 @@
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PushButton::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+void CFWL_PushButton::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
- return FWL_Error::Succeeded;
}
CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) {
diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h
index a146efc..b6beb14 100644
--- a/xfa/fwl/core/cfwl_pushbutton.h
+++ b/xfa/fwl/core/cfwl_pushbutton.h
@@ -17,14 +17,12 @@
void Initialize();
- FWL_Error GetCaption(CFX_WideString& wsCaption);
FWL_Error SetCaption(const CFX_WideStringC& wsCaption);
CFX_DIBitmap* GetPicture();
FWL_Error SetPicture(CFX_DIBitmap* pBitmap);
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_PushButtonDP
CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index fc7523a..70999d5 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -713,10 +713,9 @@
CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {}
-FWL_Error CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+void CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
- return FWL_Error::Succeeded;
}
int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) {
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index 0b99dba..f8f5acb 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -133,8 +133,7 @@
static void DeleteInstance();
// IFWL_ToolTipDP
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
int32_t GetInitialDelay(IFWL_Widget* pWidget) override;
int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override;
CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override;
diff --git a/xfa/fwl/core/ifwl_dataprovider.h b/xfa/fwl/core/ifwl_dataprovider.h
index 53c6ec4..c4e1a4e 100644
--- a/xfa/fwl/core/ifwl_dataprovider.h
+++ b/xfa/fwl/core/ifwl_dataprovider.h
@@ -8,7 +8,6 @@
#define XFA_FWL_CORE_IFWL_DATAPROVIDER_H_
#include "core/fxcrt/fx_string.h"
-#include "xfa/fwl/core/fwl_error.h"
class IFWL_Widget;
@@ -16,8 +15,7 @@
public:
virtual ~IFWL_DataProvider() {}
- virtual FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) = 0;
+ virtual void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) = 0;
};
#endif // XFA_FWL_CORE_IFWL_DATAPROVIDER_H_
diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp
index 492f8f3..c2aa6e3 100644
--- a/xfa/fwl/core/ifwl_datetimeedit.cpp
+++ b/xfa/fwl/core/ifwl_datetimeedit.cpp
@@ -42,7 +42,7 @@
IFWL_DateTimePicker* pDateTime =
static_cast<IFWL_DateTimePicker*>(m_pOuter);
- if (pDateTime->IsMonthCalendarShowed()) {
+ if (pDateTime->IsMonthCalendarVisible()) {
CFX_RectF rtInvalidate;
pDateTime->GetWidgetRect(rtInvalidate);
pDateTime->ShowMonthCalendar(false);
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index ff2dbfb..3ecaf68 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -31,10 +31,10 @@
m_iYear(-1),
m_iMonth(-1),
m_iDay(-1),
- m_bLBtnDown(false),
m_iCurYear(2010),
m_iCurMonth(3),
- m_iCurDay(29) {
+ m_iCurDay(29),
+ m_bLBtnDown(false) {
m_rtBtn.Set(0, 0, 0, 0);
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
@@ -106,7 +106,7 @@
rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn,
m_rtClient.height);
m_pEdit->SetWidgetRect(rtEdit);
- ReSetEditAlignment();
+ ResetEditAlignment();
m_pEdit->Update();
if (!(m_pMonthCal->GetThemeProvider())) {
m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
@@ -127,11 +127,11 @@
}
int32_t IFWL_DateTimePicker::CountSelRanges() {
- return GetDataTimeEdit()->CountSelRanges();
+ return m_pEdit->CountSelRanges();
}
int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) {
- return GetDataTimeEdit()->GetSelRange(nIndex, nStart);
+ return m_pEdit->GetSelRange(nIndex, nStart);
}
FWL_WidgetHit IFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
@@ -139,7 +139,7 @@
return DisForm_HitTest(fx, fy);
if (m_rtClient.Contains(fx, fy))
return FWL_WidgetHit::Client;
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
CFX_RectF rect;
m_pMonthCal->GetWidgetRect(rect);
if (rect.Contains(fx, fy))
@@ -175,131 +175,65 @@
m_pMonthCal->SetThemeProvider(pTP);
}
-FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+void IFWL_DateTimePicker::GetCurSel(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_iYear;
iMonth = m_iMonth;
iDay = m_iDay;
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+void IFWL_DateTimePicker::SetCurSel(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
if (iYear <= 0 || iYear >= 3000)
- return FWL_Error::Indefinite;
+ return;
if (iMonth <= 0 || iMonth >= 13)
- return FWL_Error::Indefinite;
+ return;
if (iDay <= 0 || iDay >= 32)
- return FWL_Error::Indefinite;
+ return;
+
m_iYear = iYear;
m_iMonth = iMonth;
m_iDay = iDay;
m_pMonthCal->SetSelect(iYear, iMonth, iDay);
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
+void IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
if (!m_pEdit)
- return FWL_Error::Indefinite;
+ return;
m_pEdit->SetText(wsText);
Repaint(&m_rtClient);
CFWL_Event_DtpEditChanged ev;
ev.m_wsText = wsText;
DispatchEvent(&ev);
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- if (m_pEdit) {
+void IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
+ if (m_pEdit)
m_pEdit->GetText(wsText, nStart, nCount);
- return FWL_Error::Succeeded;
- }
- return FWL_Error::Indefinite;
}
-bool IFWL_DateTimePicker::CanUndo() {
- return m_pEdit->CanUndo();
-}
-
-bool IFWL_DateTimePicker::CanRedo() {
- return m_pEdit->CanRedo();
-}
-
-bool IFWL_DateTimePicker::Undo() {
- return m_pEdit->Undo();
-}
-
-bool IFWL_DateTimePicker::Redo() {
- return m_pEdit->Redo();
-}
-
-bool IFWL_DateTimePicker::CanCopy() {
- int32_t nCount = m_pEdit->CountSelRanges();
- return nCount > 0;
-}
-
-bool IFWL_DateTimePicker::CanCut() {
- if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) {
- return false;
- }
- int32_t nCount = m_pEdit->CountSelRanges();
- return nCount > 0;
-}
-
-bool IFWL_DateTimePicker::CanSelectAll() {
- return m_pEdit->GetTextLength() > 0;
-}
-
-bool IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
- return m_pEdit->Copy(wsCopy);
-}
-
-bool IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
- return m_pEdit->Cut(wsCut);
-}
-
-bool IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
- return m_pEdit->Paste(wsPaste);
-}
-
-bool IFWL_DateTimePicker::SelectAll() {
- m_pEdit->AddSelRange(0);
- return true;
-}
-
-bool IFWL_DateTimePicker::Delete() {
- m_pEdit->ClearText();
- return true;
-}
-
-bool IFWL_DateTimePicker::DeSelect() {
- m_pEdit->ClearSelections();
- return true;
-}
-
-FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
+void IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
- return DisForm_GetBBox(rect);
+ DisForm_GetBBox(rect);
+ return;
}
rect = m_pProperties->m_rtWidget;
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
CFX_RectF rtMonth;
m_pMonthCal->GetWidgetRect(rtMonth);
rtMonth.Offset(m_pProperties->m_rtWidget.left,
m_pProperties->m_rtWidget.top);
rect.Union(rtMonth);
}
- return FWL_Error::Succeeded;
}
-FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
+void IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
m_pEdit->SetLimit(nLimit);
- return FWL_Error::Succeeded;
}
void IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
@@ -346,7 +280,7 @@
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ShowMonthCalendar(bActivate);
}
- if (IsMonthCalendarShowed() == bActivate) {
+ if (IsMonthCalendarVisible() == bActivate) {
return;
}
if (!m_pForm) {
@@ -370,16 +304,16 @@
}
}
-bool IFWL_DateTimePicker::IsMonthCalendarShowed() {
+bool IFWL_DateTimePicker::IsMonthCalendarVisible() {
if (m_pWidgetMgr->IsFormDisabled()) {
- return DisForm_IsMonthCalendarShowed();
+ return DisForm_IsMonthCalendarVisible();
}
if (!m_pForm)
return false;
return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
}
-void IFWL_DateTimePicker::ReSetEditAlignment() {
+void IFWL_DateTimePicker::ResetEditAlignment() {
if (!m_pEdit)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -452,56 +386,14 @@
m_pMonthCal->SetParent(m_pForm.get());
}
-IFWL_DateTimeEdit* IFWL_DateTimePicker::GetDataTimeEdit() {
- return m_pEdit.get();
-}
-
-FWL_Error IFWL_DateTimePicker::DisForm_Initialize() {
- m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
- DisForm_InitMonthCalendar();
- DisForm_InitDateTimeEdit();
- RegisterEventTarget(m_pMonthCal.get());
- RegisterEventTarget(m_pEdit.get());
- return FWL_Error::Succeeded;
-}
-
-void IFWL_DateTimePicker::DisForm_InitMonthCalendar() {
- if (m_pMonthCal)
- return;
-
- auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(this);
- prop->m_dwStyles =
- FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken;
- prop->m_dwStates = FWL_WGTSTATE_Invisible;
- prop->m_pParent = this;
- prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
-
- m_pMonthCal.reset(new IFWL_MonthCalendar(m_pOwnerApp, std::move(prop), this));
- CFX_RectF rtMonthCal;
- m_pMonthCal->GetWidgetRect(rtMonthCal, true);
- rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
- m_pMonthCal->SetWidgetRect(rtMonthCal);
-}
-
-void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() {
- if (m_pEdit)
- return;
-
- auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
- prop->m_pParent = this;
- prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
-
- m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, std::move(prop), this));
-}
-
-bool IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() {
+bool IFWL_DateTimePicker::DisForm_IsMonthCalendarVisible() {
if (!m_pMonthCal)
return false;
return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible);
}
void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) {
- bool bShowed = IsMonthCalendarShowed();
+ bool bShowed = IsMonthCalendarVisible();
if (bShowed == bActivate) {
return;
}
@@ -547,7 +439,7 @@
rect.width += m_fBtn;
if (rect.Contains(fx, fy))
return FWL_WidgetHit::Client;
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
m_pMonthCal->GetWidgetRect(rect);
if (rect.Contains(fx, fy))
return FWL_WidgetHit::Client;
@@ -571,7 +463,7 @@
m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider);
GetClientRect(m_rtClient);
m_pEdit->SetWidgetRect(m_rtClient);
- ReSetEditAlignment();
+ ResetEditAlignment();
m_pEdit->Update();
if (!m_pMonthCal->GetThemeProvider())
m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
@@ -604,19 +496,18 @@
}
}
-FWL_Error IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) {
+void IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
if (DisForm_IsNeedShowButton()) {
rect.width += m_fBtn;
}
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
CFX_RectF rtMonth;
m_pMonthCal->GetWidgetRect(rtMonth);
rtMonth.Offset(m_pProperties->m_rtWidget.left,
m_pProperties->m_rtWidget.top);
rect.Union(rtMonth);
}
- return FWL_Error::Succeeded;
}
void IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics,
@@ -633,7 +524,7 @@
}
m_pEdit->DrawWidget(pGraphics, &mt);
}
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
CFX_RectF rtMonth;
m_pMonthCal->GetWidgetRect(rtMonth);
CFX_Matrix mt;
@@ -709,7 +600,7 @@
m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
Repaint(&m_rtClient);
}
- if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarShowed()) {
+ if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarVisible()) {
ShowMonthCalendar(false);
}
Repaint(&m_rtClient);
@@ -721,7 +612,7 @@
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)
SetFocus(true);
if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- if (IsMonthCalendarShowed()) {
+ if (IsMonthCalendarVisible()) {
ShowMonthCalendar(false);
CFWL_Event_DtpCloseUp ev;
DispatchEvent(&ev);
@@ -778,7 +669,7 @@
} else {
m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
m_rtBtn.Set(0, 0, 0, 0);
- if (DisForm_IsMonthCalendarShowed())
+ if (DisForm_IsMonthCalendarVisible())
ShowMonthCalendar(false);
if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
pMsg->m_pSrcTarget = m_pEdit.get();
@@ -789,10 +680,8 @@
Repaint(&rtInvalidate);
}
-FWL_Error IFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
- return FWL_Error::Succeeded;
-}
+void IFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {}
int32_t IFWL_DateTimePicker::GetCurDay(IFWL_Widget* pWidget) {
return m_iCurDay;
diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h
index f674283..eddb596 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -53,10 +53,10 @@
class IFWL_DateTimePickerDP : public IFWL_DataProvider {
public:
- virtual FWL_Error GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) = 0;
+ virtual void GetToday(IFWL_Widget* pWidget,
+ int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) = 0;
};
class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP {
@@ -78,49 +78,36 @@
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
- FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
- FWL_Error SetEditText(const CFX_WideString& wsText);
- FWL_Error GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- int32_t CountSelRanges();
- int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
-
- bool CanUndo();
- bool CanRedo();
- bool Undo();
- bool Redo();
- bool CanCopy();
- bool CanCut();
- bool CanSelectAll();
- bool Copy(CFX_WideString& wsCopy);
- bool Cut(CFX_WideString& wsCut);
- bool Paste(const CFX_WideString& wsPaste);
- bool SelectAll();
- bool Delete();
- bool DeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
- FWL_Error SetEditLimit(int32_t nLimit);
- void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
- IFWL_DateTimeEdit* GetDataTimeEdit();
-
- bool IsMonthCalendarShowed();
- void ShowMonthCalendar(bool bActivate);
- void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay);
-
- IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); }
-
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_MonthCalendarDP
int32_t GetCurDay(IFWL_Widget* pWidget) override;
int32_t GetCurMonth(IFWL_Widget* pWidget) override;
int32_t GetCurYear(IFWL_Widget* pWidget) override;
- protected:
+ void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
+ void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
+
+ void SetEditText(const CFX_WideString& wsText);
+ void GetEditText(CFX_WideString& wsText,
+ int32_t nStart = 0,
+ int32_t nCount = -1) const;
+
+ int32_t CountSelRanges();
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
+
+ void GetBBox(CFX_RectF& rect);
+ void SetEditLimit(int32_t nLimit);
+ void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
+
+ bool IsMonthCalendarVisible();
+ void ShowMonthCalendar(bool bActivate);
+ void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay);
+
+ IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); }
+
+ private:
void DrawDropDownButton(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
@@ -128,45 +115,39 @@
int32_t iMonth,
int32_t iDay,
CFX_WideString& wsText);
- void ReSetEditAlignment();
+ void ResetEditAlignment();
void InitProxyForm();
+ bool DisForm_IsMonthCalendarVisible();
+ void DisForm_ShowMonthCalendar(bool bActivate);
+ FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ bool DisForm_IsNeedShowButton();
+ void DisForm_Update();
+ void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
+ void DisForm_GetBBox(CFX_RectF& rect);
+ void DisForm_DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet);
+ void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseMove(CFWL_MsgMouse* pMsg);
+ void OnMouseLeave(CFWL_MsgMouse* pMsg);
+
CFX_RectF m_rtBtn;
CFX_RectF m_rtClient;
int32_t m_iBtnState;
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;
std::unique_ptr<IFWL_FormProxy> m_pForm;
FX_FLOAT m_fBtn;
-
- private:
- FWL_Error DisForm_Initialize();
- void DisForm_InitMonthCalendar();
- void DisForm_InitDateTimeEdit();
- bool DisForm_IsMonthCalendarShowed();
- void DisForm_ShowMonthCalendar(bool bActivate);
- FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
- bool DisForm_IsNeedShowButton();
- void DisForm_Update();
- void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
- FWL_Error DisForm_GetBBox(CFX_RectF& rect);
- void DisForm_DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr);
-
- void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseMove(CFWL_MsgMouse* pMsg);
- void OnMouseLeave(CFWL_MsgMouse* pMsg);
- void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet);
-
- int32_t m_iCurYear;
- int32_t m_iCurMonth;
- int32_t m_iCurDay;
};
#endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp
index e208487..cec6c4c 100644
--- a/xfa/fwl/core/ifwl_monthcalendar.cpp
+++ b/xfa/fwl/core/ifwl_monthcalendar.cpp
@@ -985,7 +985,7 @@
}
} else {
IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter);
- if (pIPicker->IsMonthCalendarShowed())
+ if (pIPicker->IsMonthCalendarVisible())
m_bFlag = 1;
}
}
diff --git a/xfa/fwl/core/ifwl_tooltip.h b/xfa/fwl/core/ifwl_tooltip.h
index a9ef5e2..d5e70cd 100644
--- a/xfa/fwl/core/ifwl_tooltip.h
+++ b/xfa/fwl/core/ifwl_tooltip.h
@@ -23,8 +23,7 @@
class IFWL_ToolTipDP : public IFWL_DataProvider {
public:
// IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override = 0;
+ void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override = 0;
virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0;
virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0;