diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-31 12:50:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-31 12:50:04 -0700 |
commit | 42cb64572198bf8a72de9b18eae9f9dd9a07beb7 (patch) | |
tree | c27bd79fe9e1f6c79842c48ea07c9feb1faceb58 /xfa/fwl/core | |
parent | 461b1d93f717e248ceb3c1e1bbb8285ba3258f8c (diff) | |
download | pdfium-42cb64572198bf8a72de9b18eae9f9dd9a07beb7.tar.xz |
Remove GetWidget() overrides
This Cl removes the various CFWL_*::GetWidget overrides and adds anonymous
To* methods as needed.
Review-Url: https://codereview.chromium.org/2467503003
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.cpp | 71 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.h | 73 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.cpp | 20 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.cpp | 89 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_datetimepicker.cpp | 61 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_datetimepicker.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_edit.cpp | 97 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_edit.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.cpp | 32 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_pushbutton.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_pushbutton.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_widget.h | 4 |
17 files changed, 236 insertions, 248 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index 996667d874..bf7baa37e8 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -8,6 +8,14 @@ #include <memory> +namespace { + +IFWL_Barcode* ToBarcode(IFWL_Widget* widget) { + return static_cast<IFWL_Barcode*>(widget); +} + +} // namespace + CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {} CFWL_Barcode::~CFWL_Barcode() {} @@ -22,21 +30,70 @@ void CFWL_Barcode::Initialize() { CFWL_Widget::Initialize(); } -IFWL_Barcode* CFWL_Barcode::GetWidget() { - return static_cast<IFWL_Barcode*>(m_pIface.get()); +void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; + m_barcodeData.m_eCharEncoding = encoding; } - -const IFWL_Barcode* CFWL_Barcode::GetWidget() const { - return static_cast<IFWL_Barcode*>(m_pIface.get()); +void CFWL_Barcode::SetModuleHeight(int32_t height) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT; + m_barcodeData.m_nModuleHeight = height; +} +void CFWL_Barcode::SetModuleWidth(int32_t width) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH; + m_barcodeData.m_nModuleWidth = width; +} +void CFWL_Barcode::SetDataLength(int32_t dataLength) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH; + m_barcodeData.m_nDataLength = dataLength; + ToBarcode(GetWidget())->SetLimit(dataLength); +} +void CFWL_Barcode::SetCalChecksum(FX_BOOL calChecksum) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM; + m_barcodeData.m_bCalChecksum = calChecksum; +} +void CFWL_Barcode::SetPrintChecksum(FX_BOOL printChecksum) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM; + m_barcodeData.m_bPrintChecksum = printChecksum; +} +void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION; + m_barcodeData.m_eTextLocation = location; +} +void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO; + m_barcodeData.m_nWideNarrowRatio = ratio; +} +void CFWL_Barcode::SetStartChar(FX_CHAR startChar) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR; + m_barcodeData.m_cStartChar = startChar; +} +void CFWL_Barcode::SetEndChar(FX_CHAR endChar) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR; + m_barcodeData.m_cEndChar = endChar; +} +void CFWL_Barcode::SetVersion(int32_t version) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION; + m_barcodeData.m_nVersion = version; +} +void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL; + m_barcodeData.m_nECLevel = ecLevel; +} +void CFWL_Barcode::SetTruncated(FX_BOOL truncated) { + m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED; + m_barcodeData.m_bTruncated = truncated; +} +void CFWL_Barcode::ResetBarcodeAttributes() { + m_barcodeData.m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE; } void CFWL_Barcode::SetType(BC_TYPE type) { if (GetWidget()) - GetWidget()->SetType(type); + ToBarcode(GetWidget())->SetType(type); } FX_BOOL CFWL_Barcode::IsProtectedType() { - return GetWidget() ? GetWidget()->IsProtectedType() : FALSE; + return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : FALSE; } CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP() diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index b610a27f51..06b52c2112 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -19,70 +19,25 @@ class CFWL_Barcode : public CFWL_Edit { CFWL_Barcode(const IFWL_App*); ~CFWL_Barcode() override; - IFWL_Barcode* GetWidget() override; - const IFWL_Barcode* GetWidget() const override; - void Initialize(); void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); - void SetCharEncoding(BC_CHAR_ENCODING encoding) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; - m_barcodeData.m_eCharEncoding = encoding; - } - void SetModuleHeight(int32_t height) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT; - m_barcodeData.m_nModuleHeight = height; - } - void SetModuleWidth(int32_t width) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH; - m_barcodeData.m_nModuleWidth = width; - } - void SetDataLength(int32_t dataLength) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH; - m_barcodeData.m_nDataLength = dataLength; - GetWidget()->SetLimit(dataLength); - } - void SetCalChecksum(FX_BOOL calChecksum) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM; - m_barcodeData.m_bCalChecksum = calChecksum; - } - void SetPrintChecksum(FX_BOOL printChecksum) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM; - m_barcodeData.m_bPrintChecksum = printChecksum; - } - void SetTextLocation(BC_TEXT_LOC location) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION; - m_barcodeData.m_eTextLocation = location; - } - void SetWideNarrowRatio(int32_t ratio) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO; - m_barcodeData.m_nWideNarrowRatio = ratio; - } - void SetStartChar(FX_CHAR startChar) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR; - m_barcodeData.m_cStartChar = startChar; - } - void SetEndChar(FX_CHAR endChar) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR; - m_barcodeData.m_cEndChar = endChar; - } - void SetVersion(int32_t version) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION; - m_barcodeData.m_nVersion = version; - } - void SetErrorCorrectionLevel(int32_t ecLevel) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL; - m_barcodeData.m_nECLevel = ecLevel; - } - void SetTruncated(FX_BOOL truncated) { - m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED; - m_barcodeData.m_bTruncated = truncated; - } - void ResetBarcodeAttributes() { - m_barcodeData.m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE; - } + void SetCharEncoding(BC_CHAR_ENCODING encoding); + void SetModuleHeight(int32_t height); + void SetModuleWidth(int32_t width); + void SetDataLength(int32_t dataLength); + void SetCalChecksum(FX_BOOL calChecksum); + void SetPrintChecksum(FX_BOOL printChecksum); + void SetTextLocation(BC_TEXT_LOC location); + void SetWideNarrowRatio(int32_t ratio); + void SetStartChar(FX_CHAR startChar); + void SetEndChar(FX_CHAR endChar); + void SetVersion(int32_t version); + void SetErrorCorrectionLevel(int32_t ecLevel); + void SetTruncated(FX_BOOL truncated); + void ResetBarcodeAttributes(); protected: class CFWL_BarcodeDP : public IFWL_BarcodeDP { diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index e1ff84f2d6..3a26c8ed87 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -10,6 +10,14 @@ #include "xfa/fwl/core/fwl_error.h" +namespace { + +IFWL_CheckBox* ToCheckBox(IFWL_Widget* widget) { + return static_cast<IFWL_CheckBox*>(widget); +} + +} // namespace + CFWL_CheckBox::CFWL_CheckBox(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_CheckBox::~CFWL_CheckBox() {} @@ -25,14 +33,6 @@ void CFWL_CheckBox::Initialize() { CFWL_Widget::Initialize(); } -IFWL_CheckBox* CFWL_CheckBox::GetWidget() { - return static_cast<IFWL_CheckBox*>(m_pIface.get()); -} - -const IFWL_CheckBox* CFWL_CheckBox::GetWidget() const { - return static_cast<IFWL_CheckBox*>(m_pIface.get()); -} - FWL_Error CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) { m_checkboxData.m_wsCaption = wsCaption; return FWL_Error::Succeeded; @@ -44,11 +44,11 @@ FWL_Error CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { } int32_t CFWL_CheckBox::GetCheckState() { - return GetWidget()->GetCheckState(); + return ToCheckBox(GetWidget())->GetCheckState(); } FWL_Error CFWL_CheckBox::SetCheckState(int32_t iCheck) { - return GetWidget()->SetCheckState(iCheck); + return ToCheckBox(GetWidget())->SetCheckState(iCheck); } CFWL_CheckBox::CFWL_CheckBoxDP::CFWL_CheckBoxDP() diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index 058c76be04..22574b4b9c 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -15,9 +15,6 @@ class CFWL_CheckBox : public CFWL_Widget { CFWL_CheckBox(const IFWL_App*); ~CFWL_CheckBox() override; - IFWL_CheckBox* GetWidget() override; - const IFWL_CheckBox* GetWidget() const override; - void Initialize(); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index d873d6b06e..ed5262ee29 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -11,6 +11,18 @@ #include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_widget.h" +namespace { + +IFWL_ComboBox* ToComboBox(IFWL_Widget* widget) { + return static_cast<IFWL_ComboBox*>(widget); +} + +const IFWL_ComboBox* ToComboBox(const IFWL_Widget* widget) { + return static_cast<const IFWL_ComboBox*>(widget); +} + +} // namespace + CFWL_ComboBox::CFWL_ComboBox(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_ComboBox::~CFWL_ComboBox() {} @@ -26,14 +38,6 @@ void CFWL_ComboBox::Initialize() { CFWL_Widget::Initialize(); } -IFWL_ComboBox* CFWL_ComboBox::GetWidget() { - return static_cast<IFWL_ComboBox*>(m_pIface.get()); -} - -const IFWL_ComboBox* CFWL_ComboBox::GetWidget() const { - return static_cast<IFWL_ComboBox*>(m_pIface.get()); -} - int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem); pItem->m_wsText = wsText; @@ -80,57 +84,61 @@ FWL_Error CFWL_ComboBox::GetTextByIndex(int32_t iIndex, } int32_t CFWL_ComboBox::GetCurSel() { - return GetWidget() ? GetWidget()->GetCurSel() : -1; + return GetWidget() ? ToComboBox(GetWidget())->GetCurSel() : -1; } FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { - return GetWidget() ? GetWidget()->SetCurSel(iSel) : FWL_Error::Indefinite; + return GetWidget() ? ToComboBox(GetWidget())->SetCurSel(iSel) + : FWL_Error::Indefinite; } FWL_Error CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { - return GetWidget() ? GetWidget()->SetEditText(wsText) : FWL_Error::Indefinite; + return GetWidget() ? ToComboBox(GetWidget())->SetEditText(wsText) + : FWL_Error::Indefinite; } int32_t CFWL_ComboBox::GetEditTextLength() const { - return GetWidget() ? GetWidget()->GetEditTextLength() : 0; + return GetWidget() ? ToComboBox(GetWidget())->GetEditTextLength() : 0; } FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText, int32_t nStart, int32_t nCount) const { - return GetWidget() ? GetWidget()->GetEditText(wsText, nStart, nCount) - : FWL_Error::Indefinite; + return GetWidget() + ? ToComboBox(GetWidget())->GetEditText(wsText, nStart, nCount) + : FWL_Error::Indefinite; } FWL_Error CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { - return GetWidget() ? GetWidget()->SetEditSelRange(nStart, nCount) + return GetWidget() ? ToComboBox(GetWidget())->SetEditSelRange(nStart, nCount) : FWL_Error::Indefinite; } int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { - return GetWidget() ? GetWidget()->GetEditSelRange(nIndex, nStart) : 0; + return GetWidget() ? ToComboBox(GetWidget())->GetEditSelRange(nIndex, nStart) + : 0; } int32_t CFWL_ComboBox::GetEditLimit() { - return GetWidget() ? GetWidget()->GetEditLimit() : 0; + return GetWidget() ? ToComboBox(GetWidget())->GetEditLimit() : 0; } FWL_Error CFWL_ComboBox::SetEditLimit(int32_t nLimit) { - return GetWidget() ? GetWidget()->SetEditLimit(nLimit) + return GetWidget() ? ToComboBox(GetWidget())->SetEditLimit(nLimit) : FWL_Error::Indefinite; } FWL_Error CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { - return GetWidget() ? GetWidget()->EditDoClipboard(iCmd) + return GetWidget() ? ToComboBox(GetWidget())->EditDoClipboard(iCmd) : FWL_Error::Indefinite; } FX_BOOL CFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() ? GetWidget()->EditRedo(pRecord) : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditRedo(pRecord) : FALSE; } FX_BOOL CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() ? GetWidget()->EditUndo(pRecord) : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditUndo(pRecord) : FALSE; } FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { @@ -154,78 +162,79 @@ void* CFWL_ComboBox::GetItemData(int32_t iIndex) { } FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { - return GetWidget()->GetListBoxt()->SetThemeProvider(pTheme); + return ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); } FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { - return GetWidget()->AfterFocusShowDropList(); + return ToComboBox(GetWidget())->AfterFocusShowDropList(); } FWL_Error CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { - return GetWidget()->OpenDropDownList(bActivate); + return ToComboBox(GetWidget())->OpenDropDownList(bActivate); } FX_BOOL CFWL_ComboBox::EditCanUndo() { - return GetWidget() ? GetWidget()->EditCanUndo() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCanUndo() : FALSE; } FX_BOOL CFWL_ComboBox::EditCanRedo() { - return GetWidget() ? GetWidget()->EditCanRedo() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCanRedo() : FALSE; } FX_BOOL CFWL_ComboBox::EditUndo() { - return GetWidget() ? GetWidget()->EditUndo() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditUndo() : FALSE; } FX_BOOL CFWL_ComboBox::EditRedo() { - return GetWidget() ? GetWidget()->EditRedo() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditRedo() : FALSE; } FX_BOOL CFWL_ComboBox::EditCanCopy() { - return GetWidget() ? GetWidget()->EditCanCopy() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCanCopy() : FALSE; } FX_BOOL CFWL_ComboBox::EditCanCut() { - return GetWidget() ? GetWidget()->EditCanCut() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCanCut() : FALSE; } FX_BOOL CFWL_ComboBox::EditCanSelectAll() { - return GetWidget() ? GetWidget()->EditCanSelectAll() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCanSelectAll() : FALSE; } FX_BOOL CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { - return GetWidget() ? GetWidget()->EditCopy(wsCopy) : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCopy(wsCopy) : FALSE; } FX_BOOL CFWL_ComboBox::EditCut(CFX_WideString& wsCut) { - return GetWidget() ? GetWidget()->EditCut(wsCut) : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditCut(wsCut) : FALSE; } FX_BOOL CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { - return GetWidget() ? GetWidget()->EditPaste(wsPaste) : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditPaste(wsPaste) : FALSE; } FX_BOOL CFWL_ComboBox::EditSelectAll() { - return GetWidget() ? GetWidget()->EditSelectAll() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditSelectAll() : FALSE; } FX_BOOL CFWL_ComboBox::EditDelete() { - return GetWidget() ? GetWidget()->EditDelete() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditDelete() : FALSE; } FX_BOOL CFWL_ComboBox::EditDeSelect() { - return GetWidget() ? GetWidget()->EditDeSelect() : FALSE; + return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : FALSE; } FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { - return GetWidget() ? GetWidget()->GetBBox(rect) : FWL_Error::Indefinite; + return GetWidget() ? ToComboBox(GetWidget())->GetBBox(rect) + : FWL_Error::Indefinite; } FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) { return GetWidget() - ? GetWidget()->EditModifyStylesEx(dwStylesExAdded, - dwStylesExRemoved) + ? ToComboBox(GetWidget()) + ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved) : FWL_Error::Indefinite; } diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 3a4d854442..82f1165dae 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -23,9 +23,6 @@ class CFWL_ComboBox : public CFWL_Widget { CFWL_ComboBox(const IFWL_App*); ~CFWL_ComboBox() override; - IFWL_ComboBox* GetWidget() override; - const IFWL_ComboBox* GetWidget() const override; - void Initialize(); int32_t AddString(const CFX_WideStringC& wsText); diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 8a0e8eba35..f794317279 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -12,6 +12,14 @@ #include "xfa/fwl/core/ifwl_datetimepicker.h" #include "xfa/fwl/core/ifwl_widget.h" +namespace { + +IFWL_DateTimePicker* ToDateTimePicker(IFWL_Widget* widget) { + return static_cast<IFWL_DateTimePicker*>(widget); +} + +} // namespace + CFWL_DateTimePicker::CFWL_DateTimePicker(const IFWL_App* app) : CFWL_Widget(app) {} @@ -28,14 +36,6 @@ void CFWL_DateTimePicker::Initialize() { CFWL_Widget::Initialize(); } -IFWL_DateTimePicker* CFWL_DateTimePicker::GetWidget() { - return static_cast<IFWL_DateTimePicker*>(m_pIface.get()); -} - -const IFWL_DateTimePicker* CFWL_DateTimePicker::GetWidget() const { - return static_cast<IFWL_DateTimePicker*>(m_pIface.get()); -} - FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear, int32_t iMonth, int32_t iDay) { @@ -46,31 +46,31 @@ FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear, } int32_t CFWL_DateTimePicker::CountSelRanges() { - return GetWidget()->CountSelRanges(); + return ToDateTimePicker(GetWidget())->CountSelRanges(); } int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { - return GetWidget()->GetSelRange(nIndex, nStart); + return ToDateTimePicker(GetWidget())->GetSelRange(nIndex, nStart); } FWL_Error CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { - return GetWidget()->GetEditText(wsText); + return ToDateTimePicker(GetWidget())->GetEditText(wsText); } FWL_Error CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { - return GetWidget()->SetEditText(wsText); + return ToDateTimePicker(GetWidget())->SetEditText(wsText); } FWL_Error CFWL_DateTimePicker::GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay) { - return GetWidget()->GetCurSel(iYear, iMonth, iDay); + return ToDateTimePicker(GetWidget())->GetCurSel(iYear, iMonth, iDay); } FWL_Error CFWL_DateTimePicker::SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay) { - return GetWidget()->SetCurSel(iYear, iMonth, iDay); + return ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay); } CFWL_DateTimePicker::CFWL_DateTimePickerDP::CFWL_DateTimePickerDP() { @@ -98,66 +98,67 @@ FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( } FX_BOOL CFWL_DateTimePicker::CanUndo() { - return GetWidget()->CanUndo(); + return ToDateTimePicker(GetWidget())->CanUndo(); } FX_BOOL CFWL_DateTimePicker::CanRedo() { - return GetWidget()->CanRedo(); + return ToDateTimePicker(GetWidget())->CanRedo(); } FX_BOOL CFWL_DateTimePicker::Undo() { - return GetWidget()->Undo(); + return ToDateTimePicker(GetWidget())->Undo(); } FX_BOOL CFWL_DateTimePicker::Redo() { - return GetWidget()->Redo(); + return ToDateTimePicker(GetWidget())->Redo(); } FX_BOOL CFWL_DateTimePicker::CanCopy() { - return GetWidget()->CanCopy(); + return ToDateTimePicker(GetWidget())->CanCopy(); } FX_BOOL CFWL_DateTimePicker::CanCut() { - return GetWidget()->CanCut(); + return ToDateTimePicker(GetWidget())->CanCut(); } FX_BOOL CFWL_DateTimePicker::CanSelectAll() { - return GetWidget()->CanSelectAll(); + return ToDateTimePicker(GetWidget())->CanSelectAll(); } FX_BOOL CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { - return GetWidget()->Copy(wsCopy); + return ToDateTimePicker(GetWidget())->Copy(wsCopy); } FX_BOOL CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { - return GetWidget()->Copy(wsCut); + return ToDateTimePicker(GetWidget())->Copy(wsCut); } FX_BOOL CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { - return GetWidget()->Paste(wsPaste); + return ToDateTimePicker(GetWidget())->Paste(wsPaste); } FX_BOOL CFWL_DateTimePicker::SelectAll() { - return GetWidget()->SelectAll(); + return ToDateTimePicker(GetWidget())->SelectAll(); } FX_BOOL CFWL_DateTimePicker::Delete() { - return GetWidget()->Delete(); + return ToDateTimePicker(GetWidget())->Delete(); } FX_BOOL CFWL_DateTimePicker::DeSelect() { - return GetWidget()->DeSelect(); + return ToDateTimePicker(GetWidget())->DeSelect(); } FWL_Error CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { - return GetWidget()->GetBBox(rect); + return ToDateTimePicker(GetWidget())->GetBBox(rect); } FWL_Error CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { - return GetWidget()->SetEditLimit(nLimit); + return ToDateTimePicker(GetWidget())->SetEditLimit(nLimit); } FWL_Error CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) { - return GetWidget()->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); + return ToDateTimePicker(GetWidget()) + ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 5091713dc2..e189e969a0 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -15,9 +15,6 @@ class CFWL_DateTimePicker : public CFWL_Widget { CFWL_DateTimePicker(const IFWL_App*); ~CFWL_DateTimePicker() override; - IFWL_DateTimePicker* GetWidget() override; - const IFWL_DateTimePicker* GetWidget() const override; - void Initialize(); FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index 50f99fe090..3ce1bcf247 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -9,6 +9,18 @@ #include <memory> #include <vector> +namespace { + +IFWL_Edit* ToEdit(IFWL_Widget* widget) { + return static_cast<IFWL_Edit*>(widget); +} + +const IFWL_Edit* ToEdit(const IFWL_Widget* widget) { + return static_cast<const IFWL_Edit*>(widget); +} + +} // namespace + CFWL_Edit::CFWL_Edit(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_Edit::~CFWL_Edit() {} @@ -24,24 +36,16 @@ void CFWL_Edit::Initialize() { CFWL_Widget::Initialize(); } -IFWL_Edit* CFWL_Edit::GetWidget() { - return static_cast<IFWL_Edit*>(m_pIface.get()); -} - -const IFWL_Edit* CFWL_Edit::GetWidget() const { - return static_cast<IFWL_Edit*>(m_pIface.get()); -} - FWL_Error CFWL_Edit::SetText(const CFX_WideString& wsText) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetText(wsText); + return ToEdit(GetWidget())->SetText(wsText); } int32_t CFWL_Edit::GetTextLength() const { if (!GetWidget()) return 0; - return GetWidget()->GetTextLength(); + return ToEdit(GetWidget())->GetTextLength(); } FWL_Error CFWL_Edit::GetText(CFX_WideString& wsText, @@ -49,75 +53,75 @@ FWL_Error CFWL_Edit::GetText(CFX_WideString& wsText, int32_t nCount) const { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->GetText(wsText, nStart, nCount); + return ToEdit(GetWidget())->GetText(wsText, nStart, nCount); } FWL_Error CFWL_Edit::ClearText() { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->ClearText(); + return ToEdit(GetWidget())->ClearText(); } int32_t CFWL_Edit::GetCaretPos() const { if (!GetWidget()) return -1; - return GetWidget()->GetCaretPos(); + return ToEdit(GetWidget())->GetCaretPos(); } int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { if (!GetWidget()) return -1; - return GetWidget()->SetCaretPos(nIndex, bBefore); + return ToEdit(GetWidget())->SetCaretPos(nIndex, bBefore); } int32_t CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { if (!GetWidget()) return -1; - GetWidget()->AddSelRange(nStart, nCount); + ToEdit(GetWidget())->AddSelRange(nStart, nCount); int32_t pos = 0; - int32_t sum = GetWidget()->GetTextLength(); + int32_t sum = ToEdit(GetWidget())->GetTextLength(); if (nCount == -1) { pos = sum; } else { pos = nStart + nCount; } - return GetWidget()->SetCaretPos(pos); + return ToEdit(GetWidget())->SetCaretPos(pos); } int32_t CFWL_Edit::CountSelRanges() { if (!GetWidget()) return 0; - return GetWidget()->CountSelRanges(); + return ToEdit(GetWidget())->CountSelRanges(); } int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { if (!GetWidget()) return 0; - return GetWidget()->GetSelRange(nIndex, nStart); + return ToEdit(GetWidget())->GetSelRange(nIndex, nStart); } FWL_Error CFWL_Edit::ClearSelections() { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->ClearSelections(); + return ToEdit(GetWidget())->ClearSelections(); } int32_t CFWL_Edit::GetLimit() { if (!GetWidget()) return -1; - return GetWidget()->GetLimit(); + return ToEdit(GetWidget())->GetLimit(); } FWL_Error CFWL_Edit::SetLimit(int32_t nLimit) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetLimit(nLimit); + return ToEdit(GetWidget())->SetLimit(nLimit); } FWL_Error CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetAliasChar(wAlias); + return ToEdit(GetWidget())->SetAliasChar(wAlias); } FWL_Error CFWL_Edit::Insert(int32_t nStart, @@ -125,19 +129,19 @@ FWL_Error CFWL_Edit::Insert(int32_t nStart, int32_t nLen) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->Insert(nStart, lpText, nLen); + return ToEdit(GetWidget())->Insert(nStart, lpText, nLen); } FWL_Error CFWL_Edit::DeleteSelections() { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->DeleteSelections(); + return ToEdit(GetWidget())->DeleteSelections(); } FWL_Error CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->DeleteRange(nStart, nCount); + return ToEdit(GetWidget())->DeleteRange(nStart, nCount); } FWL_Error CFWL_Edit::Replace(int32_t nStart, @@ -145,90 +149,89 @@ FWL_Error CFWL_Edit::Replace(int32_t nStart, const CFX_WideStringC& wsReplace) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->Replace(nStart, nLen, wsReplace); + return ToEdit(GetWidget())->Replace(nStart, nLen, wsReplace); } FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->DoClipboard(iCmd); + return ToEdit(GetWidget())->DoClipboard(iCmd); } FX_BOOL CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() && GetWidget()->Redo(pRecord); + return GetWidget() && ToEdit(GetWidget())->Redo(pRecord); } FX_BOOL CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() && GetWidget()->Undo(pRecord); + return GetWidget() && ToEdit(GetWidget())->Undo(pRecord); } FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetTabWidth(fTabWidth, bEquidistant); + return ToEdit(GetWidget())->SetTabWidth(fTabWidth, bEquidistant); } FWL_Error CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { - if (iMin > iMax) { + if (iMin > iMax) return FWL_Error::ParameterInvalid; - } - return GetWidget()->SetNumberRange(iMin, iMax); + return ToEdit(GetWidget())->SetNumberRange(iMin, iMax); } FWL_Error CFWL_Edit::SetBackColor(uint32_t dwColor) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetBackgroundColor(dwColor); + return ToEdit(GetWidget())->SetBackgroundColor(dwColor); } FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetFont(wsFont, fSize); + return ToEdit(GetWidget())->SetFont(wsFont, fSize); } FX_BOOL CFWL_Edit::CanUndo() { - return GetWidget()->CanUndo(); + return ToEdit(GetWidget())->CanUndo(); } FX_BOOL CFWL_Edit::CanRedo() { - return GetWidget()->CanRedo(); + return ToEdit(GetWidget())->CanRedo(); } FX_BOOL CFWL_Edit::Undo() { - return GetWidget()->Undo(); + return ToEdit(GetWidget())->Undo(); } FX_BOOL CFWL_Edit::Redo() { - return GetWidget()->Undo(); + return ToEdit(GetWidget())->Undo(); } FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) { - return GetWidget()->Copy(wsCopy); + return ToEdit(GetWidget())->Copy(wsCopy); } FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) { - return GetWidget()->Cut(wsCut); + return ToEdit(GetWidget())->Cut(wsCut); } FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) { - return GetWidget()->Paste(wsPaste); + return ToEdit(GetWidget())->Paste(wsPaste); } FX_BOOL CFWL_Edit::Delete() { - return GetWidget()->Delete(); + return ToEdit(GetWidget())->Delete(); } void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { - return GetWidget()->SetScrollOffset(fScrollOffset); + return ToEdit(GetWidget())->SetScrollOffset(fScrollOffset); } FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf, std::vector<CFX_ByteString>& sSuggest) { - return GetWidget()->GetSuggestWords(pointf, sSuggest); + return ToEdit(GetWidget())->GetSuggestWords(pointf, sSuggest); } FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, const CFX_ByteStringC& bsReplace) { - return GetWidget()->ReplaceSpellCheckWord(pointf, bsReplace); + return ToEdit(GetWidget())->ReplaceSpellCheckWord(pointf, bsReplace); } diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h index 016ac8f9da..c18420015f 100644 --- a/xfa/fwl/core/cfwl_edit.h +++ b/xfa/fwl/core/cfwl_edit.h @@ -20,9 +20,6 @@ class CFWL_Edit : public CFWL_Widget { CFWL_Edit(const IFWL_App*); ~CFWL_Edit() override; - IFWL_Edit* GetWidget() override; - const IFWL_Edit* GetWidget() const override; - void Initialize(); FWL_Error SetText(const CFX_WideString& wsText); diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 5820a27926..139c488830 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -10,6 +10,14 @@ #include "third_party/base/stl_util.h" +namespace { + +IFWL_ListBox* ToListBox(IFWL_Widget* widget) { + return static_cast<IFWL_ListBox*>(widget); +} + +} // namespace + CFWL_ListBox::CFWL_ListBox(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_ListBox::~CFWL_ListBox() {} @@ -25,14 +33,6 @@ void CFWL_ListBox::Initialize() { CFWL_Widget::Initialize(); } -IFWL_ListBox* CFWL_ListBox::GetWidget() { - return static_cast<IFWL_ListBox*>(m_pIface.get()); -} - -const IFWL_ListBox* CFWL_ListBox::GetWidget() const { - return static_cast<IFWL_ListBox*>(m_pIface.get()); -} - FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB; return FWL_Error::Succeeded; @@ -78,38 +78,38 @@ void CFWL_ListBox::DeleteAll() { int32_t CFWL_ListBox::CountSelItems() { if (!GetWidget()) return 0; - return GetWidget()->CountSelItems(); + return ToListBox(GetWidget())->CountSelItems(); } IFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { if (!GetWidget()) return nullptr; - return GetWidget()->GetSelItem(nIndexSel); + return ToListBox(GetWidget())->GetSelItem(nIndexSel); } int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { if (!GetWidget()) return 0; - return GetWidget()->GetSelIndex(nIndex); + return ToListBox(GetWidget())->GetSelIndex(nIndex); } FWL_Error CFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->SetSelItem(pItem, bSelect); + return ToListBox(GetWidget())->SetSelItem(pItem, bSelect); } FWL_Error CFWL_ListBox::GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->GetItemText(pItem, wsText); + return ToListBox(GetWidget())->GetItemText(pItem, wsText); } FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { if (!GetWidget()) return FWL_Error::Indefinite; - return GetWidget()->GetScrollPos(fPos, bVert); + return ToListBox(GetWidget())->GetScrollPos(fPos, bVert); } FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) { @@ -176,8 +176,8 @@ IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { fy -= rtClient.top; FX_FLOAT fPosX = 0; FX_FLOAT fPosY = 0; - GetWidget()->GetScrollPos(fx); - GetWidget()->GetScrollPos(fy, FALSE); + ToListBox(GetWidget())->GetScrollPos(fx); + ToListBox(GetWidget())->GetScrollPos(fy, FALSE); int32_t nCount = m_ListBoxDP.CountItems(nullptr); for (int32_t i = 0; i < nCount; i++) { IFWL_ListItem* pItem = m_ListBoxDP.GetItem(nullptr, i); diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index 436e8372bc..42740fbfbc 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -22,9 +22,6 @@ class CFWL_ListBox : public CFWL_Widget { CFWL_ListBox(const IFWL_App*); ~CFWL_ListBox() override; - IFWL_ListBox* GetWidget() override; - const IFWL_ListBox* GetWidget() const override; - void Initialize(); FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp index de6bf737b6..51f9d77ca1 100644 --- a/xfa/fwl/core/cfwl_picturebox.cpp +++ b/xfa/fwl/core/cfwl_picturebox.cpp @@ -23,14 +23,6 @@ void CFWL_PictureBox::Initialize() { CFWL_Widget::Initialize(); } -IFWL_PictureBox* CFWL_PictureBox::GetWidget() { - return static_cast<IFWL_PictureBox*>(m_pIface.get()); -} - -const IFWL_PictureBox* CFWL_PictureBox::GetWidget() const { - return static_cast<IFWL_PictureBox*>(m_pIface.get()); -} - CFX_DIBitmap* CFWL_PictureBox::GetPicture() { return m_PictureBoxDP.m_pBitmap; } diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h index d64be21e06..f8fcdfbb13 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -16,9 +16,6 @@ class CFWL_PictureBox : public CFWL_Widget { CFWL_PictureBox(const IFWL_App*); ~CFWL_PictureBox() override; - IFWL_PictureBox* GetWidget() override; - const IFWL_PictureBox* GetWidget() const override; - void Initialize(); CFX_DIBitmap* GetPicture(); diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp index 2d03e86412..3f81d8c449 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -23,14 +23,6 @@ void CFWL_PushButton::Initialize() { CFWL_Widget::Initialize(); } -IFWL_PushButton* CFWL_PushButton::GetWidget() { - return static_cast<IFWL_PushButton*>(m_pIface.get()); -} - -const IFWL_PushButton* CFWL_PushButton::GetWidget() const { - return static_cast<IFWL_PushButton*>(m_pIface.get()); -} - FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { wsCaption = m_buttonData.m_wsCaption; return FWL_Error::Succeeded; diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h index c20e5539af..1c4b6b47a1 100644 --- a/xfa/fwl/core/cfwl_pushbutton.h +++ b/xfa/fwl/core/cfwl_pushbutton.h @@ -15,9 +15,6 @@ class CFWL_PushButton : public CFWL_Widget { CFWL_PushButton(const IFWL_App*); ~CFWL_PushButton() override; - IFWL_PushButton* GetWidget() override; - const IFWL_PushButton* GetWidget() const override; - void Initialize(); FWL_Error GetCaption(CFX_WideString& wsCaption); diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index bf8f98e6e7..64e6dc66fa 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -24,8 +24,8 @@ class CFWL_Widget { CFWL_Widget(const IFWL_App*); virtual ~CFWL_Widget(); - virtual IFWL_Widget* GetWidget(); - virtual const IFWL_Widget* GetWidget() const; + IFWL_Widget* GetWidget(); + const IFWL_Widget* GetWidget() const; FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); FWL_Error SetWidgetRect(const CFX_RectF& rect); |