summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-07 10:28:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-07 10:28:47 -0800
commiteb3f68cc7f25a1e28464eb251161b8f08fcd04bc (patch)
tree36e565bac1a7760e605b181b7da4c08bda151cdd /xfa/fwl
parenta97fc7c6392c0adbd702bdf898cb9e20cee00a3e (diff)
downloadpdfium-eb3f68cc7f25a1e28464eb251161b8f08fcd04bc.tar.xz
Fold DataProviders into parent classes
This CL removes the data provider classes and folds the code into the parent classes. Review-Url: https://codereview.chromium.org/2480233003
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/core/cfwl_barcode.cpp107
-rw-r--r--xfa/fwl/core/cfwl_barcode.h77
-rw-r--r--xfa/fwl/core/cfwl_checkbox.cpp19
-rw-r--r--xfa/fwl/core/cfwl_checkbox.h25
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp136
-rw-r--r--xfa/fwl/core/cfwl_combobox.h139
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.cpp30
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.h38
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp127
-rw-r--r--xfa/fwl/core/cfwl_listbox.h130
-rw-r--r--xfa/fwl/core/cfwl_picturebox.cpp72
-rw-r--r--xfa/fwl/core/cfwl_picturebox.h53
-rw-r--r--xfa/fwl/core/cfwl_pushbutton.cpp21
-rw-r--r--xfa/fwl/core/cfwl_pushbutton.h25
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp82
-rw-r--r--xfa/fwl/core/fwl_noteimp.h20
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp36
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h32
18 files changed, 527 insertions, 642 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp
index b12a875ee2..77faefed48 100644
--- a/xfa/fwl/core/cfwl_barcode.cpp
+++ b/xfa/fwl/core/cfwl_barcode.cpp
@@ -18,7 +18,8 @@ IFWL_Barcode* ToBarcode(IFWL_Widget* widget) {
} // namespace
-CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {}
+CFWL_Barcode::CFWL_Barcode(const IFWL_App* app)
+ : CFWL_Edit(app), m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {}
CFWL_Barcode::~CFWL_Barcode() {}
@@ -26,66 +27,79 @@ void CFWL_Barcode::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_Barcode>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_barcodeData));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
- m_barcodeData.m_eCharEncoding = encoding;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
+ m_eCharEncoding = encoding;
}
+
void CFWL_Barcode::SetModuleHeight(int32_t height) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
- m_barcodeData.m_nModuleHeight = height;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
+ m_nModuleHeight = height;
}
+
void CFWL_Barcode::SetModuleWidth(int32_t width) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
- m_barcodeData.m_nModuleWidth = width;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
+ m_nModuleWidth = width;
}
+
void CFWL_Barcode::SetDataLength(int32_t dataLength) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
- m_barcodeData.m_nDataLength = dataLength;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
+ m_nDataLength = dataLength;
ToBarcode(GetWidget())->SetLimit(dataLength);
}
+
void CFWL_Barcode::SetCalChecksum(bool calChecksum) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
- m_barcodeData.m_bCalChecksum = calChecksum;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
+ m_bCalChecksum = calChecksum;
}
+
void CFWL_Barcode::SetPrintChecksum(bool printChecksum) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
- m_barcodeData.m_bPrintChecksum = printChecksum;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
+ m_bPrintChecksum = printChecksum;
}
+
void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
- m_barcodeData.m_eTextLocation = location;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
+ m_eTextLocation = location;
}
+
void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
- m_barcodeData.m_nWideNarrowRatio = ratio;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
+ m_nWideNarrowRatio = ratio;
}
+
void CFWL_Barcode::SetStartChar(FX_CHAR startChar) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
- m_barcodeData.m_cStartChar = startChar;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
+ m_cStartChar = startChar;
}
+
void CFWL_Barcode::SetEndChar(FX_CHAR endChar) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
- m_barcodeData.m_cEndChar = endChar;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
+ m_cEndChar = endChar;
}
+
void CFWL_Barcode::SetVersion(int32_t version) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
- m_barcodeData.m_nVersion = version;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
+ m_nVersion = version;
}
+
void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
- m_barcodeData.m_nECLevel = ecLevel;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
+ m_nECLevel = ecLevel;
}
+
void CFWL_Barcode::SetTruncated(bool truncated) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
- m_barcodeData.m_bTruncated = truncated;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
+ m_bTruncated = truncated;
}
+
void CFWL_Barcode::ResetBarcodeAttributes() {
- m_barcodeData.m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE;
+ m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE;
}
void CFWL_Barcode::SetType(BC_TYPE type) {
@@ -97,66 +111,63 @@ bool CFWL_Barcode::IsProtectedType() {
return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false;
}
-CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP()
- : m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {}
-
-FWL_Error CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_Barcode::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-BC_CHAR_ENCODING CFWL_Barcode::CFWL_BarcodeDP::GetCharEncoding() const {
+BC_CHAR_ENCODING CFWL_Barcode::GetCharEncoding() const {
return m_eCharEncoding;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleHeight() const {
+int32_t CFWL_Barcode::GetModuleHeight() const {
return m_nModuleHeight;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleWidth() const {
+int32_t CFWL_Barcode::GetModuleWidth() const {
return m_nModuleWidth;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() const {
+int32_t CFWL_Barcode::GetDataLength() const {
return m_nDataLength;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() const {
+bool CFWL_Barcode::GetCalChecksum() const {
return m_bCalChecksum;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() const {
+bool CFWL_Barcode::GetPrintChecksum() const {
return m_bPrintChecksum;
}
-BC_TEXT_LOC CFWL_Barcode::CFWL_BarcodeDP::GetTextLocation() const {
+BC_TEXT_LOC CFWL_Barcode::GetTextLocation() const {
return m_eTextLocation;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetWideNarrowRatio() const {
+int32_t CFWL_Barcode::GetWideNarrowRatio() const {
return m_nWideNarrowRatio;
}
-FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetStartChar() const {
+FX_CHAR CFWL_Barcode::GetStartChar() const {
return m_cStartChar;
}
-FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetEndChar() const {
+FX_CHAR CFWL_Barcode::GetEndChar() const {
return m_cEndChar;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetVersion() const {
+int32_t CFWL_Barcode::GetVersion() const {
return m_nVersion;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() const {
+int32_t CFWL_Barcode::GetErrorCorrectionLevel() const {
return m_nECLevel;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const {
+bool CFWL_Barcode::GetTruncated() const {
return m_bTruncated;
}
-uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const {
+uint32_t CFWL_Barcode::GetBarcodeAttributeMask() const {
return m_dwAttributeMask;
}
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h
index b5642d21c5..be89318f40 100644
--- a/xfa/fwl/core/cfwl_barcode.h
+++ b/xfa/fwl/core/cfwl_barcode.h
@@ -11,9 +11,7 @@
#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_barcode.h"
-class CFWL_Widget;
-
-class CFWL_Barcode : public CFWL_Edit {
+class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP {
public:
CFWL_Barcode(const IFWL_App*);
~CFWL_Barcode() override;
@@ -38,48 +36,41 @@ class CFWL_Barcode : public CFWL_Edit {
void SetTruncated(bool truncated);
void ResetBarcodeAttributes();
- protected:
- class CFWL_BarcodeDP : public IFWL_BarcodeDP {
- public:
- CFWL_BarcodeDP();
-
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
-
- // IFWL_BarcodeDP
- BC_CHAR_ENCODING GetCharEncoding() const override;
- int32_t GetModuleHeight() const override;
- int32_t GetModuleWidth() const override;
- int32_t GetDataLength() const override;
- bool GetCalChecksum() const override;
- bool GetPrintChecksum() const override;
- BC_TEXT_LOC GetTextLocation() const override;
- int32_t GetWideNarrowRatio() const override;
- FX_CHAR GetStartChar() const override;
- FX_CHAR GetEndChar() const override;
- int32_t GetVersion() const override;
- int32_t GetErrorCorrectionLevel() const override;
- bool GetTruncated() const override;
- uint32_t GetBarcodeAttributeMask() const override;
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
- BC_CHAR_ENCODING m_eCharEncoding;
- int32_t m_nModuleHeight;
- int32_t m_nModuleWidth;
- int32_t m_nDataLength;
- bool m_bCalChecksum;
- bool m_bPrintChecksum;
- BC_TEXT_LOC m_eTextLocation;
- int32_t m_nWideNarrowRatio;
- FX_CHAR m_cStartChar;
- FX_CHAR m_cEndChar;
- int32_t m_nVersion;
- int32_t m_nECLevel;
- bool m_bTruncated;
- uint32_t m_dwAttributeMask;
- };
+ // IFWL_BarcodeDP
+ BC_CHAR_ENCODING GetCharEncoding() const override;
+ int32_t GetModuleHeight() const override;
+ int32_t GetModuleWidth() const override;
+ int32_t GetDataLength() const override;
+ bool GetCalChecksum() const override;
+ bool GetPrintChecksum() const override;
+ BC_TEXT_LOC GetTextLocation() const override;
+ int32_t GetWideNarrowRatio() const override;
+ FX_CHAR GetStartChar() const override;
+ FX_CHAR GetEndChar() const override;
+ int32_t GetVersion() const override;
+ int32_t GetErrorCorrectionLevel() const override;
+ bool GetTruncated() const override;
+ uint32_t GetBarcodeAttributeMask() const override;
- CFWL_BarcodeDP m_barcodeData;
+ private:
+ BC_CHAR_ENCODING m_eCharEncoding;
+ int32_t m_nModuleHeight;
+ int32_t m_nModuleWidth;
+ int32_t m_nDataLength;
+ bool m_bCalChecksum;
+ bool m_bPrintChecksum;
+ BC_TEXT_LOC m_eTextLocation;
+ int32_t m_nWideNarrowRatio;
+ FX_CHAR m_cStartChar;
+ FX_CHAR m_cEndChar;
+ int32_t m_nVersion;
+ int32_t m_nECLevel;
+ bool m_bTruncated;
+ uint32_t m_dwAttributeMask;
};
#endif // XFA_FWL_CORE_CFWL_BARCODE_H_
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index 9baea41c4d..5372083b4c 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -19,7 +19,8 @@ IFWL_CheckBox* ToCheckBox(IFWL_Widget* widget) {
} // namespace
-CFWL_CheckBox::CFWL_CheckBox(const IFWL_App* app) : CFWL_Widget(app) {}
+CFWL_CheckBox::CFWL_CheckBox(const IFWL_App* app)
+ : CFWL_Widget(app), m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {}
CFWL_CheckBox::~CFWL_CheckBox() {}
@@ -27,18 +28,18 @@ void CFWL_CheckBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_CheckBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_checkboxData));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
FWL_Error CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) {
- m_checkboxData.m_wsCaption = wsCaption;
+ m_wsCaption = wsCaption;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) {
- m_checkboxData.m_fBoxHeight = fHeight;
+ m_fBoxHeight = fHeight;
return FWL_Error::Succeeded;
}
@@ -50,16 +51,12 @@ FWL_Error CFWL_CheckBox::SetCheckState(int32_t iCheck) {
return ToCheckBox(GetWidget())->SetCheckState(iCheck);
}
-CFWL_CheckBox::CFWL_CheckBoxDP::CFWL_CheckBoxDP()
- : m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {}
-
-FWL_Error CFWL_CheckBox::CFWL_CheckBoxDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_CheckBox::CFWL_CheckBoxDP::GetBoxSize(IFWL_Widget* pWidget) {
+FX_FLOAT CFWL_CheckBox::GetBoxSize(IFWL_Widget* pWidget) {
return m_fBoxHeight;
}
diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h
index 22574b4b9c..8ab88854d8 100644
--- a/xfa/fwl/core/cfwl_checkbox.h
+++ b/xfa/fwl/core/cfwl_checkbox.h
@@ -10,7 +10,7 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_checkbox.h"
-class CFWL_CheckBox : public CFWL_Widget {
+class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP {
public:
CFWL_CheckBox(const IFWL_App*);
~CFWL_CheckBox() override;
@@ -22,23 +22,16 @@ class CFWL_CheckBox : public CFWL_Widget {
int32_t GetCheckState();
FWL_Error SetCheckState(int32_t iCheck);
- protected:
- class CFWL_CheckBoxDP : public IFWL_CheckBoxDP {
- public:
- CFWL_CheckBoxDP();
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ // IFWL_CheckBoxDP
+ FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override;
- // IFWL_CheckBoxDP
- FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override;
-
- FX_FLOAT m_fBoxHeight;
- CFX_WideString m_wsCaption;
- };
-
- CFWL_CheckBoxDP m_checkboxData;
+ private:
+ FX_FLOAT m_fBoxHeight;
+ CFX_WideString m_wsCaption;
};
#endif // XFA_FWL_CORE_CFWL_CHECKBOX_H_
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 60b6e507d1..fa2698be6e 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -24,7 +24,8 @@ const IFWL_ComboBox* ToComboBox(const IFWL_Widget* widget) {
} // namespace
-CFWL_ComboBox::CFWL_ComboBox(const IFWL_App* app) : CFWL_Widget(app) {}
+CFWL_ComboBox::CFWL_ComboBox(const IFWL_App* app)
+ : CFWL_Widget(app), m_fMaxListHeight(0), m_fItemHeight(0) {}
CFWL_ComboBox::~CFWL_ComboBox() {}
@@ -32,7 +33,7 @@ void CFWL_ComboBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_ComboBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_comboBoxData));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
@@ -41,8 +42,8 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem);
pItem->m_wsText = wsText;
pItem->m_dwStyles = 0;
- m_comboBoxData.m_ItemArray.push_back(std::move(pItem));
- return m_comboBoxData.m_ItemArray.size() - 1;
+ m_ItemArray.push_back(std::move(pItem));
+ return m_ItemArray.size() - 1;
}
int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
@@ -51,31 +52,30 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
pItem->m_wsText = wsText;
pItem->m_dwStyles = 0;
pItem->m_pDIB = pIcon;
- m_comboBoxData.m_ItemArray.push_back(std::move(pItem));
- return m_comboBoxData.m_ItemArray.size() - 1;
+ m_ItemArray.push_back(std::move(pItem));
+ return m_ItemArray.size() - 1;
}
bool CFWL_ComboBox::RemoveAt(int32_t iIndex) {
- if (iIndex < 0 ||
- static_cast<size_t>(iIndex) >= m_comboBoxData.m_ItemArray.size()) {
+ if (iIndex < 0 || static_cast<size_t>(iIndex) >= m_ItemArray.size()) {
return false;
}
- m_comboBoxData.m_ItemArray.erase(m_comboBoxData.m_ItemArray.begin() + iIndex);
+ m_ItemArray.erase(m_ItemArray.begin() + iIndex);
return true;
}
void CFWL_ComboBox::RemoveAll() {
- m_comboBoxData.m_ItemArray.clear();
+ m_ItemArray.clear();
}
int32_t CFWL_ComboBox::CountItems() {
- return m_comboBoxData.CountItems(GetWidget());
+ return CountItems(GetWidget());
}
FWL_Error CFWL_ComboBox::GetTextByIndex(int32_t iIndex,
CFX_WideString& wsText) {
- CFWL_ComboBoxItem* pItem = static_cast<CFWL_ComboBoxItem*>(
- m_comboBoxData.GetItem(m_pIface.get(), iIndex));
+ CFWL_ComboBoxItem* pItem =
+ static_cast<CFWL_ComboBoxItem*>(GetItem(m_pIface.get(), iIndex));
if (!pItem)
return FWL_Error::Indefinite;
wsText = pItem->m_wsText;
@@ -141,13 +141,13 @@ bool CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
}
FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) {
- m_comboBoxData.m_fMaxListHeight = fMaxHeight;
+ m_fMaxListHeight = fMaxHeight;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
- CFWL_ComboBoxItem* pItem = static_cast<CFWL_ComboBoxItem*>(
- m_comboBoxData.GetItem(m_pIface.get(), iIndex));
+ CFWL_ComboBoxItem* pItem =
+ static_cast<CFWL_ComboBoxItem*>(GetItem(m_pIface.get(), iIndex));
if (!pItem)
return FWL_Error::Indefinite;
pItem->m_pData = pData;
@@ -155,8 +155,8 @@ FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
}
void* CFWL_ComboBox::GetItemData(int32_t iIndex) {
- CFWL_ComboBoxItem* pItem = static_cast<CFWL_ComboBoxItem*>(
- m_comboBoxData.GetItem(m_pIface.get(), iIndex));
+ CFWL_ComboBoxItem* pItem =
+ static_cast<CFWL_ComboBoxItem*>(GetItem(m_pIface.get(), iIndex));
return pItem ? pItem->m_pData : nullptr;
}
@@ -237,34 +237,25 @@ FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
: FWL_Error::Indefinite;
}
-CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() {
- m_fItemHeight = 0;
- m_fMaxListHeight = 0;
-}
-
-CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {}
-
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(const IFWL_Widget* pWidget) {
+int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) {
return m_ItemArray.size();
}
-IFWL_ListItem* CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(
- const IFWL_Widget* pWidget,
- int32_t nIndex) {
+IFWL_ListItem* CFWL_ComboBox::GetItem(const IFWL_Widget* pWidget,
+ int32_t nIndex) {
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
return nullptr;
return m_ItemArray[nIndex].get();
}
-int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+int32_t CFWL_ComboBox::GetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
auto it = std::find_if(
m_ItemArray.begin(), m_ItemArray.end(),
[pItem](const std::unique_ptr<CFWL_ComboBoxItem>& candidate) {
@@ -273,9 +264,9 @@ int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget,
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
-bool CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- int32_t nIndex) {
+bool CFWL_ComboBox::SetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ int32_t nIndex) {
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
return false;
@@ -283,25 +274,25 @@ bool CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget,
return true;
}
-uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
if (!pItem)
return 0;
return static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_WideString& wsText) {
+FWL_Error CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_WideString& wsText) {
if (!pItem)
return FWL_Error::Indefinite;
wsText = static_cast<CFWL_ComboBoxItem*>(pItem)->m_wsText;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtItem) {
+FWL_Error CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtItem) {
if (!pItem)
return FWL_Error::Indefinite;
CFWL_ComboBoxItem* pComboItem = static_cast<CFWL_ComboBoxItem*>(pItem);
@@ -310,78 +301,73 @@ FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
return FWL_Error::Succeeded;
}
-void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+void* CFWL_ComboBox::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) {
return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pData : nullptr;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwStyle) {
+FWL_Error CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwStyle) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles = dwStyle;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const FX_WCHAR* pszText) {
+FWL_Error CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ComboBoxItem*>(pItem)->m_wsText = pszText;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtItem) {
+FWL_Error CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtItem = rtItem;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
+FX_FLOAT CFWL_ComboBox::GetItemHeight(IFWL_Widget* pWidget) {
return m_fItemHeight;
}
-CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+CFX_DIBitmap* CFWL_ComboBox::GetItemIcon(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pDIB : nullptr;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) {
+FWL_Error CFWL_ComboBox::GetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) {
rtCheck = static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) {
+FWL_Error CFWL_ComboBox::SetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) {
static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox = rtCheck;
return FWL_Error::Succeeded;
}
-uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+uint32_t CFWL_ComboBox::GetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
return static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwCheckState;
}
-FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwCheckState) {
+FWL_Error CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwCheckState) {
static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwCheckState = dwCheckState;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) {
+FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) {
return m_fMaxListHeight;
}
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index c85b0e7bca..cd409ffbc1 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -13,11 +13,21 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_combobox.h"
-class IFWL_ComboBoxDP;
-class CFWL_ComboBoxDP;
-class CFWL_ComboBoxItem;
+class CFWL_ComboBoxItem : public IFWL_ListItem {
+ public:
+ CFWL_ComboBoxItem();
+ ~CFWL_ComboBoxItem();
-class CFWL_ComboBox : public CFWL_Widget {
+ CFX_RectF m_rtItem;
+ uint32_t m_dwStyles;
+ CFX_WideString m_wsText;
+ CFX_DIBitmap* m_pDIB;
+ uint32_t m_dwCheckState;
+ CFX_RectF m_rtCheckBox;
+ void* m_pData;
+};
+
+class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP {
public:
CFWL_ComboBox(const IFWL_App*);
~CFWL_ComboBox() override;
@@ -68,78 +78,57 @@ class CFWL_ComboBox : public CFWL_Widget {
FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
- protected:
- class CFWL_ComboBoxDP : public IFWL_ComboBoxDP {
- public:
- CFWL_ComboBoxDP();
- ~CFWL_ComboBoxDP() override;
-
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
-
- // IFWL_ListBoxDP
- int32_t CountItems(const IFWL_Widget* pWidget) override;
- IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
- int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- bool SetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- int32_t nIndex) override;
-
- uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- FWL_Error GetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_WideString& wsText) override;
- FWL_Error GetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtItem) override;
- void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwStyle) override;
- FWL_Error SetItemText(IFWL_Widget* pWidget,
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
+
+ // IFWL_ListBoxDP
+ int32_t CountItems(const IFWL_Widget* pWidget) override;
+ IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ bool SetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ int32_t nIndex) override;
+
+ uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ FWL_Error GetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_WideString& wsText) override;
+ FWL_Error GetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtItem) override;
+ void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ FWL_Error SetItemStyles(IFWL_Widget* pWidget,
IFWL_ListItem* pItem,
- const FX_WCHAR* pszText) override;
- FWL_Error SetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtItem) override;
- FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
- CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) override;
- FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) override;
- FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) override;
- uint32_t GetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) override;
- FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwCheckState) override;
-
- // IFWL_ComboBoxDP
- FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override;
-
- std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray;
- FX_FLOAT m_fMaxListHeight;
- FX_FLOAT m_fItemHeight;
- };
- CFWL_ComboBoxDP m_comboBoxData;
-};
-
-class CFWL_ComboBoxItem : public IFWL_ListItem {
- public:
- CFWL_ComboBoxItem();
- ~CFWL_ComboBoxItem();
-
- CFX_RectF m_rtItem;
- uint32_t m_dwStyles;
- CFX_WideString m_wsText;
- CFX_DIBitmap* m_pDIB;
- uint32_t m_dwCheckState;
- CFX_RectF m_rtCheckBox;
- void* m_pData;
+ uint32_t dwStyle) override;
+ FWL_Error SetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) override;
+ FWL_Error SetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) override;
+ FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) override;
+ FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) override;
+ FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) override;
+ uint32_t GetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) override;
+ FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwCheckState) override;
+
+ // IFWL_ComboBoxDP
+ FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override;
+
+ private:
+ std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray;
+ FX_FLOAT m_fMaxListHeight;
+ FX_FLOAT m_fItemHeight;
};
#endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index fba04b6fd5..554a16b258 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -22,7 +22,7 @@ IFWL_DateTimePicker* ToDateTimePicker(IFWL_Widget* widget) {
} // namespace
CFWL_DateTimePicker::CFWL_DateTimePicker(const IFWL_App* app)
- : CFWL_Widget(app) {}
+ : CFWL_Widget(app), m_iYear(2011), m_iMonth(1), m_iDay(1) {}
CFWL_DateTimePicker::~CFWL_DateTimePicker() {}
@@ -30,7 +30,7 @@ void CFWL_DateTimePicker::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_DateTimePicker>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_DateTimePickerDP));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
@@ -38,9 +38,9 @@ void CFWL_DateTimePicker::Initialize() {
FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- m_DateTimePickerDP.m_iYear = iYear;
- m_DateTimePickerDP.m_iMonth = iMonth;
- m_DateTimePickerDP.m_iDay = iDay;
+ m_iYear = iYear;
+ m_iMonth = iMonth;
+ m_iDay = iDay;
return FWL_Error::Succeeded;
}
@@ -72,24 +72,16 @@ FWL_Error CFWL_DateTimePicker::SetCurSel(int32_t iYear,
return ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay);
}
-CFWL_DateTimePicker::CFWL_DateTimePickerDP::CFWL_DateTimePickerDP() {
- m_iYear = 2011;
- m_iMonth = 1;
- m_iDay = 1;
-}
-
-FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsData;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday(
- IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+FWL_Error CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget,
+ int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_iYear;
iMonth = m_iMonth;
iDay = m_iDay;
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index 327364ce6a..2b5277f495 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -10,7 +10,7 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_datetimepicker.h"
-class CFWL_DateTimePicker : public CFWL_Widget {
+class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP {
public:
CFWL_DateTimePicker(const IFWL_App*);
~CFWL_DateTimePicker() override;
@@ -42,27 +42,21 @@ class CFWL_DateTimePicker : public CFWL_Widget {
FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
- protected:
- class CFWL_DateTimePickerDP : public IFWL_DateTimePickerDP {
- public:
- CFWL_DateTimePickerDP();
-
- // IFWL_DataProvider
- FWL_Error 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;
- int32_t m_iYear;
- int32_t m_iMonth;
- int32_t m_iDay;
- CFX_WideString m_wsData;
- };
-
- CFWL_DateTimePickerDP m_DateTimePickerDP;
+ // IFWL_DataProvider
+ FWL_Error 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;
+
+ private:
+ int32_t m_iYear;
+ int32_t m_iMonth;
+ int32_t m_iDay;
+ CFX_WideString m_wsData;
};
#endif // XFA_FWL_CORE_CFWL_DATETIMEPICKER_H_
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 859054005f..458a0eb647 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -27,7 +27,7 @@ void CFWL_ListBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_ListBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_ListBoxDP), nullptr);
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this), nullptr);
CFWL_Widget::Initialize();
}
@@ -43,17 +43,16 @@ IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
pItem->m_dwStates = 0;
pItem->m_wsText = wsAdd;
pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0;
- m_ListBoxDP.m_ItemArray.push_back(std::move(pItem));
- return m_ListBoxDP.m_ItemArray.back().get();
+ m_ItemArray.push_back(std::move(pItem));
+ return m_ItemArray.back().get();
}
bool CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) {
- int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), pItem);
- if (nIndex < 0 ||
- static_cast<size_t>(nIndex) >= m_ListBoxDP.m_ItemArray.size()) {
+ int32_t nIndex = GetItemIndex(GetWidget(), pItem);
+ if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) {
return false;
}
- int32_t iCount = m_ListBoxDP.CountItems(m_pIface.get());
+ int32_t iCount = CountItems(m_pIface.get());
int32_t iSel = nIndex + 1;
if (iSel >= iCount) {
iSel = nIndex - 1;
@@ -63,15 +62,15 @@ bool CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) {
}
if (iSel >= 0) {
CFWL_ListItem* pSel =
- static_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface.get(), iSel));
+ static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iSel));
pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected;
}
- m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex);
+ m_ItemArray.erase(m_ItemArray.begin() + nIndex);
return true;
}
void CFWL_ListBox::DeleteAll() {
- m_ListBoxDP.m_ItemArray.clear();
+ m_ItemArray.clear();
}
int32_t CFWL_ListBox::CountSelItems() {
@@ -112,12 +111,12 @@ FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
}
FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
- m_ListBoxDP.m_fItemHeight = fItemHeight;
+ m_fItemHeight = fItemHeight;
return FWL_Error::Succeeded;
}
IFWL_ListItem* CFWL_ListBox::GetFocusItem() {
- for (const auto& pItem : m_ListBoxDP.m_ItemArray) {
+ for (const auto& pItem : m_ItemArray) {
if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
return pItem.get();
}
@@ -125,20 +124,20 @@ IFWL_ListItem* CFWL_ListBox::GetFocusItem() {
}
FWL_Error CFWL_ListBox::SetFocusItem(IFWL_ListItem* pItem) {
- int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), pItem);
- m_ListBoxDP.m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
+ int32_t nIndex = GetItemIndex(GetWidget(), pItem);
+ m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused;
return FWL_Error::Succeeded;
}
int32_t CFWL_ListBox::CountItems() {
- return pdfium::CollectionSize<int32_t>(m_ListBoxDP.m_ItemArray);
+ return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
IFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems())
return nullptr;
- return m_ListBoxDP.m_ItemArray[nIndex].get();
+ return m_ItemArray[nIndex].get();
}
FWL_Error CFWL_ListBox::SetItemString(IFWL_ListItem* pItem,
@@ -177,14 +176,14 @@ IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
FX_FLOAT fPosY = 0;
ToListBox(GetWidget())->GetScrollPos(fx);
ToListBox(GetWidget())->GetScrollPos(fy, false);
- int32_t nCount = m_ListBoxDP.CountItems(nullptr);
+ int32_t nCount = CountItems(nullptr);
for (int32_t i = 0; i < nCount; i++) {
- IFWL_ListItem* pItem = m_ListBoxDP.GetItem(nullptr, i);
+ IFWL_ListItem* pItem = GetItem(nullptr, i);
if (!pItem) {
continue;
}
CFX_RectF rtItem;
- m_ListBoxDP.GetItemRect(nullptr, pItem, rtItem);
+ GetItemRect(nullptr, pItem, rtItem);
rtItem.Offset(-fPosX, -fPosY);
if (rtItem.Contains(fx, fy)) {
return pItem;
@@ -200,30 +199,25 @@ uint32_t CFWL_ListBox::GetItemStates(IFWL_ListItem* pItem) {
return pListItem->m_dwStates | pListItem->m_dwCheckState;
}
-CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {}
-
-CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {}
-
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsData;
return FWL_Error::Succeeded;
}
-int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(const IFWL_Widget* pWidget) {
+int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
-IFWL_ListItem* CFWL_ListBox::CFWL_ListBoxDP::GetItem(const IFWL_Widget* pWidget,
- int32_t nIndex) {
+IFWL_ListItem* CFWL_ListBox::GetItem(const IFWL_Widget* pWidget,
+ int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return nullptr;
return m_ItemArray[nIndex].get();
}
-int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+int32_t CFWL_ListBox::GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) {
auto it = std::find_if(
m_ItemArray.begin(), m_ItemArray.end(),
[pItem](const std::unique_ptr<CFWL_ListItem>& candidate) {
@@ -232,105 +226,102 @@ int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget,
return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
}
-bool CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- int32_t nIndex) {
+bool CFWL_ListBox::SetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return false;
m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(pItem));
return true;
}
-uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
if (!pItem)
return 0;
return static_cast<CFWL_ListItem*>(pItem)->m_dwStates;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_WideString& wsText) {
+FWL_Error CFWL_ListBox::GetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_WideString& wsText) {
if (!pItem)
return FWL_Error::Indefinite;
wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtItem) {
+FWL_Error CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtItem) {
if (!pItem)
return FWL_Error::Indefinite;
rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
return FWL_Error::Succeeded;
}
-void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) {
return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwStyle) {
+FWL_Error CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwStyle) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const FX_WCHAR* pszText) {
+FWL_Error CFWL_ListBox::SetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtItem) {
+FWL_Error CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) {
if (!pItem)
return FWL_Error::Indefinite;
static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
+FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) {
return m_fItemHeight;
}
-CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
return static_cast<CFWL_ListItem*>(pItem)->m_pDIB;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) {
+FWL_Error CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) {
rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) {
+FWL_Error CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) {
static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck;
return FWL_Error::Succeeded;
}
-uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) {
+uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) {
return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
}
-FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(
- IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwCheckState) {
+FWL_Error CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwCheckState) {
static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
return FWL_Error::Succeeded;
}
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index cb77f90a63..d91ddff328 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -15,9 +15,21 @@
#include "xfa/fwl/core/ifwl_listbox.h"
#include "xfa/fwl/core/ifwl_widget.h"
-class CFWL_ListItem;
+class CFWL_ListItem : public IFWL_ListItem {
+ public:
+ CFWL_ListItem();
+ ~CFWL_ListItem();
-class CFWL_ListBox : public CFWL_Widget {
+ CFX_RectF m_rtItem;
+ uint32_t m_dwStates;
+ CFX_WideString m_wsText;
+ CFX_DIBitmap* m_pDIB;
+ void* m_pData;
+ uint32_t m_dwCheckState;
+ CFX_RectF m_rtCheckBox;
+};
+
+class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
public:
CFWL_ListBox(const IFWL_App*);
~CFWL_ListBox() override;
@@ -46,75 +58,53 @@ class CFWL_ListBox : public CFWL_Widget {
IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
uint32_t GetItemStates(IFWL_ListItem* pItem);
- protected:
- class CFWL_ListBoxDP : public IFWL_ListBoxDP {
- public:
- CFWL_ListBoxDP();
- ~CFWL_ListBoxDP() override;
-
- // IFWL_DataProvider:
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
-
- // IFWL_ListBoxDP:
- int32_t CountItems(const IFWL_Widget* pWidget) override;
- IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
- int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- bool SetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- int32_t nIndex) override;
- uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- FWL_Error GetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_WideString& wsText) override;
- FWL_Error GetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtItem) override;
- void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
- FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwStyle) override;
- FWL_Error SetItemText(IFWL_Widget* pWidget,
+ // IFWL_DataProvider:
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
+
+ // IFWL_ListBoxDP:
+ int32_t CountItems(const IFWL_Widget* pWidget) override;
+ IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ bool SetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ int32_t nIndex) override;
+ uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ FWL_Error GetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_WideString& wsText) override;
+ FWL_Error GetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtItem) override;
+ void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
+ FWL_Error SetItemStyles(IFWL_Widget* pWidget,
IFWL_ListItem* pItem,
- const FX_WCHAR* pszText) override;
- FWL_Error SetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtItem) override;
- FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
- CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) override;
- FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) override;
- FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) override;
- uint32_t GetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) override;
- FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwCheckState) override;
-
- std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
- CFX_WideString m_wsData;
- FX_FLOAT m_fItemHeight;
- };
-
- CFWL_ListBoxDP m_ListBoxDP;
-};
-
-class CFWL_ListItem : public IFWL_ListItem {
- public:
- CFWL_ListItem();
- ~CFWL_ListItem();
-
- CFX_RectF m_rtItem;
- uint32_t m_dwStates;
- CFX_WideString m_wsText;
- CFX_DIBitmap* m_pDIB;
- void* m_pData;
- uint32_t m_dwCheckState;
- CFX_RectF m_rtCheckBox;
+ uint32_t dwStyle) override;
+ FWL_Error SetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) override;
+ FWL_Error SetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) override;
+ FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) override;
+ FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) override;
+ FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) override;
+ uint32_t GetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) override;
+ FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwCheckState) override;
+
+ private:
+ std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
+ CFX_WideString m_wsData;
+ FX_FLOAT m_fItemHeight;
};
#endif // XFA_FWL_CORE_CFWL_LISTBOX_H_
diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp
index a0e1c30c6c..28d31864c7 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -10,7 +10,16 @@
#include "third_party/base/ptr_util.h"
-CFWL_PictureBox::CFWL_PictureBox(const IFWL_App* app) : CFWL_Widget(app) {}
+CFWL_PictureBox::CFWL_PictureBox(const IFWL_App* app)
+ : CFWL_Widget(app),
+ m_pBitmap(nullptr),
+ m_iOpacity(0),
+ m_iFlipMode(0),
+ m_fRotation(0.0f),
+ m_fScaleX(1.0f),
+ m_fScaleY(1.0f),
+ m_fOffSetX(0.0f),
+ m_fOffSetY(0.0f) {}
CFWL_PictureBox::~CFWL_PictureBox() {}
@@ -18,111 +27,96 @@ void CFWL_PictureBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_PictureBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_PictureBoxDP));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
- return m_PictureBoxDP.m_pBitmap;
+ return m_pBitmap;
}
FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
- m_PictureBoxDP.m_pBitmap = pBitmap;
+ m_pBitmap = pBitmap;
return FWL_Error::Succeeded;
}
FX_FLOAT CFWL_PictureBox::GetRotation() {
- return m_PictureBoxDP.m_fRotation;
+ return m_fRotation;
}
FWL_Error CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
- m_PictureBoxDP.m_fRotation = fRotation;
+ m_fRotation = fRotation;
return FWL_Error::Succeeded;
}
int32_t CFWL_PictureBox::GetFlipMode() {
- return m_PictureBoxDP.GetFlipMode(m_pIface.get());
+ return GetFlipMode(m_pIface.get());
}
FWL_Error CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
- m_PictureBoxDP.m_iFlipMode = iFlipMode;
+ m_iFlipMode = iFlipMode;
return FWL_Error::Succeeded;
}
int32_t CFWL_PictureBox::GetOpacity() {
- return m_PictureBoxDP.GetOpacity(m_pIface.get());
+ return GetOpacity(m_pIface.get());
}
FWL_Error CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
- m_PictureBoxDP.m_iOpacity = iOpacity;
+ m_iOpacity = iOpacity;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix(m_pIface.get(), matrix);
+ GetMatrix(m_pIface.get(), matrix);
matrix.Scale(fScaleX, fScaleY);
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
- m_PictureBoxDP.m_fScaleX = fScaleX;
- m_PictureBoxDP.m_fScaleY = fScaleY;
+ m_fScaleX = fScaleX;
+ m_fScaleY = fScaleY;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix(m_pIface.get(), matrix);
+ GetMatrix(m_pIface.get(), matrix);
fx = matrix.e;
fy = matrix.f;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
- m_PictureBoxDP.m_fOffSetX = fx;
- m_PictureBoxDP.m_fOffSetY = fy;
+ m_fOffSetX = fx;
+ m_fOffSetY = fy;
return FWL_Error::Succeeded;
}
-CFWL_PictureBox::CFWL_PictureBoxDP::CFWL_PictureBoxDP()
- : m_pBitmap(nullptr),
- m_iOpacity(0),
- m_iFlipMode(0),
- m_fRotation(0.0f),
- m_fScaleX(1.0f),
- m_fScaleY(1.0f),
- m_fOffSetX(0.0f),
- m_fOffSetY(0.0f) {}
-
-FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetErrorPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PictureBox::GetInitialPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
-int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) {
+int32_t CFWL_PictureBox::GetOpacity(IFWL_Widget* pWidget) {
return m_iOpacity;
}
-FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
- CFX_Matrix& matrix) {
+FWL_Error CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) {
CFX_RectF rect;
pWidget->GetClientRect(rect);
FX_FLOAT fLen = rect.width / 2;
@@ -136,6 +130,6 @@ FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
return FWL_Error::Succeeded;
}
-int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
+int32_t CFWL_PictureBox::GetFlipMode(IFWL_Widget* pWidget) {
return m_iFlipMode;
}
diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h
index f8fcdfbb13..5cd7c6fffc 100644
--- a/xfa/fwl/core/cfwl_picturebox.h
+++ b/xfa/fwl/core/cfwl_picturebox.h
@@ -11,7 +11,7 @@
#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/ifwl_picturebox.h"
-class CFWL_PictureBox : public CFWL_Widget {
+class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP {
public:
CFWL_PictureBox(const IFWL_App*);
~CFWL_PictureBox() override;
@@ -31,35 +31,28 @@ class CFWL_PictureBox : public CFWL_Widget {
FWL_Error GetOffset(FX_FLOAT& fx, FX_FLOAT& fy);
FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy);
- protected:
- class CFWL_PictureBoxDP : public IFWL_PictureBoxDP {
- public:
- CFWL_PictureBoxDP();
-
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
-
- // IFWL_PictureBoxDP
- CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
- CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) override;
- CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) override;
- int32_t GetOpacity(IFWL_Widget* pWidget) override;
- int32_t GetFlipMode(IFWL_Widget* pWidget) override;
- FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override;
-
- CFX_DIBitmap* m_pBitmap;
- int32_t m_iOpacity;
- int32_t m_iFlipMode;
- FX_FLOAT m_fRotation;
- FX_FLOAT m_fScaleX;
- FX_FLOAT m_fScaleY;
- FX_FLOAT m_fOffSetX;
- FX_FLOAT m_fOffSetY;
- CFX_WideString m_wsData;
- };
-
- CFWL_PictureBoxDP m_PictureBoxDP;
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
+
+ // IFWL_PictureBoxDP
+ CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) override;
+ CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) override;
+ int32_t GetOpacity(IFWL_Widget* pWidget) override;
+ int32_t GetFlipMode(IFWL_Widget* pWidget) override;
+ FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override;
+
+ private:
+ CFX_DIBitmap* m_pBitmap;
+ int32_t m_iOpacity;
+ int32_t m_iFlipMode;
+ FX_FLOAT m_fRotation;
+ FX_FLOAT m_fScaleX;
+ FX_FLOAT m_fScaleY;
+ FX_FLOAT m_fOffSetX;
+ FX_FLOAT m_fOffSetY;
+ CFX_WideString m_wsData;
};
#endif // XFA_FWL_CORE_CFWL_PICTUREBOX_H_
diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp
index 1b98d2514e..888c127782 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -10,7 +10,8 @@
#include "third_party/base/ptr_util.h"
-CFWL_PushButton::CFWL_PushButton(const IFWL_App* app) : CFWL_Widget(app) {}
+CFWL_PushButton::CFWL_PushButton(const IFWL_App* app)
+ : CFWL_Widget(app), m_pBitmap(nullptr) {}
CFWL_PushButton::~CFWL_PushButton() {}
@@ -18,38 +19,36 @@ void CFWL_PushButton::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_PushButton>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_buttonData));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) {
- wsCaption = m_buttonData.m_wsCaption;
+ wsCaption = m_wsCaption;
return FWL_Error::Succeeded;
}
FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) {
- m_buttonData.m_wsCaption = wsCaption;
+ m_wsCaption = wsCaption;
return FWL_Error::Succeeded;
}
CFX_DIBitmap* CFWL_PushButton::GetPicture() {
- return m_buttonData.m_pBitmap;
+ return m_pBitmap;
}
FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) {
- m_buttonData.m_pBitmap = pBitmap;
+ m_pBitmap = pBitmap;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PushButton::CFWL_PushButtonDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_PushButton::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_Error::Succeeded;
}
-CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture(
- IFWL_Widget* pWidget) {
+CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) {
return m_pBitmap;
}
diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h
index 1c4b6b47a1..a146efc54e 100644
--- a/xfa/fwl/core/cfwl_pushbutton.h
+++ b/xfa/fwl/core/cfwl_pushbutton.h
@@ -10,7 +10,7 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_pushbutton.h"
-class CFWL_PushButton : public CFWL_Widget {
+class CFWL_PushButton : public CFWL_Widget, public IFWL_PushButtonDP {
public:
CFWL_PushButton(const IFWL_App*);
~CFWL_PushButton() override;
@@ -22,23 +22,16 @@ class CFWL_PushButton : public CFWL_Widget {
CFX_DIBitmap* GetPicture();
FWL_Error SetPicture(CFX_DIBitmap* pBitmap);
- protected:
- class CFWL_PushButtonDP : public IFWL_PushButtonDP {
- public:
- CFWL_PushButtonDP() : m_pBitmap(nullptr) {}
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override;
+ // IFWL_PushButtonDP
+ CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
- // IFWL_PushButtonDP
- CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override;
-
- CFX_WideString m_wsCaption;
- CFX_DIBitmap* m_pBitmap;
- };
-
- CFWL_PushButtonDP m_buttonData;
+ private:
+ CFX_WideString m_wsCaption;
+ CFX_DIBitmap* m_pBitmap;
};
#endif // XFA_FWL_CORE_CFWL_PUSHBUTTON_H_
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 86a1ca8e44..fc7523a8b3 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -637,58 +637,6 @@ void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) {
}
}
-class CFWL_CoreToolTipDP : public IFWL_ToolTipDP {
- public:
- CFWL_CoreToolTipDP(int32_t iInitDelayTime, int32_t iAutoDelayTime);
-
- // IFWL_ToolTipDP
- FWL_Error 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;
- CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override;
-
- CFX_RectF GetAnchor();
-
- CFX_WideString m_wsCaption;
- int32_t m_nInitDelayTime;
- int32_t m_nAutoPopDelayTime;
- CFX_RectF m_fAnchor;
-};
-
-CFWL_CoreToolTipDP::CFWL_CoreToolTipDP(int32_t iInitDelayTime,
- int32_t iAutoDelayTime)
- : m_nInitDelayTime(iInitDelayTime), m_nAutoPopDelayTime(iAutoDelayTime) {
- m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
-}
-
-FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
- wsCaption = m_wsCaption;
- return FWL_Error::Succeeded;
-}
-
-int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) {
- return m_nInitDelayTime;
-}
-
-int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) {
- return m_nAutoPopDelayTime;
-}
-
-CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) {
- return nullptr;
-}
-
-CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) {
- return CFX_SizeF();
-}
-
-CFX_RectF CFWL_CoreToolTipDP::GetAnchor() {
- return m_fAnchor;
-}
-
CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver,
IFWL_Widget* pListener)
: m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {}
@@ -759,10 +707,38 @@ bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) {
CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr;
CFWL_ToolTipContainer::CFWL_ToolTipContainer()
- : m_pToolTipDp(new CFWL_CoreToolTipDP(0, 2000)) {}
+ : m_nInitDelayTime(0), m_nAutoPopDelayTime(2000) {
+ m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
+}
CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {}
+FWL_Error CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
+ wsCaption = m_wsCaption;
+ return FWL_Error::Succeeded;
+}
+
+int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) {
+ return m_nInitDelayTime;
+}
+
+int32_t CFWL_ToolTipContainer::GetAutoPopDelay(IFWL_Widget* pWidget) {
+ return m_nAutoPopDelayTime;
+}
+
+CFX_DIBitmap* CFWL_ToolTipContainer::GetToolTipIcon(IFWL_Widget* pWidget) {
+ return nullptr;
+}
+
+CFX_SizeF CFWL_ToolTipContainer::GetToolTipIconSize(IFWL_Widget* pWidget) {
+ return CFX_SizeF();
+}
+
+CFX_RectF CFWL_ToolTipContainer::GetAnchor() {
+ return m_fAnchor;
+}
+
// static
CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
if (!s_pInstance)
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index e9a738aa87..0b99dba80c 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -13,10 +13,10 @@
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_tooltip.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_graphics.h"
-class CFWL_CoreToolTipDP;
class CFWL_EventTarget;
class CFWL_MsgActivate;
class CFWL_MsgDeactivate;
@@ -127,19 +127,31 @@ class CFWL_EventTarget {
bool m_bInvalid;
};
-class CFWL_ToolTipContainer final {
+class CFWL_ToolTipContainer final : public IFWL_ToolTipDP {
public:
static CFWL_ToolTipContainer* getInstance();
static void DeleteInstance();
+ // IFWL_ToolTipDP
+ FWL_Error 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;
+ CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override;
+
protected:
CFWL_ToolTipContainer();
- ~CFWL_ToolTipContainer();
+ ~CFWL_ToolTipContainer() override;
- std::unique_ptr<CFWL_CoreToolTipDP> m_pToolTipDp;
+ CFX_RectF GetAnchor();
private:
static CFWL_ToolTipContainer* s_pInstance;
+ CFX_WideString m_wsCaption;
+ int32_t m_nInitDelayTime;
+ int32_t m_nAutoPopDelayTime;
+ CFX_RectF m_fAnchor;
};
#endif // XFA_FWL_CORE_FWL_NOTEIMP_H_
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 8a59b0034d..915449aa79 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -32,13 +32,15 @@ IFWL_DateTimePicker::IFWL_DateTimePicker(
m_iYear(-1),
m_iMonth(-1),
m_iDay(-1),
- m_bLBtnDown(false) {
+ m_bLBtnDown(false),
+ m_iCurYear(2010),
+ m_iCurMonth(3),
+ m_iCurDay(29) {
m_rtBtn.Set(0, 0, 0, 0);
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
- auto monthProp =
- pdfium::MakeUnique<CFWL_WidgetProperties>(&m_MonthCalendarDP);
+ auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(this);
monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
monthProp->m_pParent = this;
@@ -112,8 +114,7 @@ FWL_Error IFWL_DateTimePicker::Update() {
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
- pData->GetToday(this, m_MonthCalendarDP.m_iCurYear,
- m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
+ pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay);
}
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, true);
@@ -464,7 +465,7 @@ void IFWL_DateTimePicker::DisForm_InitDateTimeCalendar() {
if (m_pMonthCal)
return;
- auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(&m_MonthCalendarDP);
+ 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;
@@ -575,8 +576,7 @@ FWL_Error IFWL_DateTimePicker::DisForm_Update() {
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
- pData->GetToday(this, m_MonthCalendarDP.m_iCurYear,
- m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
+ pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay);
}
FX_FLOAT* pWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -788,29 +788,19 @@ void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg,
Repaint(&rtInvalidate);
}
-IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() {
- m_iCurYear = 2010;
- m_iCurMonth = 3;
- m_iCurDay = 29;
-}
-
-FWL_Error IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCaption(
- IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error IFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurDay(
- IFWL_Widget* pWidget) {
+int32_t IFWL_DateTimePicker::GetCurDay(IFWL_Widget* pWidget) {
return m_iCurDay;
}
-int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurMonth(
- IFWL_Widget* pWidget) {
+int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) {
return m_iCurMonth;
}
-int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurYear(
- IFWL_Widget* pWidget) {
+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 8ebe54ad25..5e4ca5eeb7 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -60,7 +60,7 @@ class IFWL_DateTimePickerDP : public IFWL_DataProvider {
int32_t& iDay) = 0;
};
-class IFWL_DateTimePicker : public IFWL_Widget {
+class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP {
public:
explicit IFWL_DateTimePicker(
const IFWL_App* app,
@@ -113,25 +113,16 @@ class IFWL_DateTimePicker : public IFWL_Widget {
IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); }
- protected:
- class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP {
- public:
- CFWL_MonthCalendarImpDP();
-
- // IFWL_DataProvider
- FWL_Error 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;
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override;
- int32_t m_iCurDay;
- int32_t m_iCurYear;
- int32_t m_iCurMonth;
- };
+ // 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 DrawDropDownButton(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
@@ -153,7 +144,6 @@ class IFWL_DateTimePicker : public IFWL_Widget {
std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal;
std::unique_ptr<IFWL_FormProxy> m_pForm;
FX_FLOAT m_fBtn;
- CFWL_MonthCalendarImpDP m_MonthCalendarDP;
private:
FWL_Error DisForm_Initialize();
@@ -175,6 +165,10 @@ class IFWL_DateTimePicker : public IFWL_Widget {
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_