diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-15 12:33:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-15 12:33:06 -0800 |
commit | 38eaf4b11383e24a00192132b683cc07e38622a6 (patch) | |
tree | 169f9d48784035519ddee9191aa412cc817a4531 /xfa | |
parent | 05b9a317d66c29f740e4b0e89ea87143a11d61fc (diff) | |
download | pdfium-38eaf4b11383e24a00192132b683cc07e38622a6.tar.xz |
Cleanup cfwl_* files.
This Cl cleans up the visibility, method usage and return values in the
remaining CFWL files.
Review-Url: https://codereview.chromium.org/2498163002
Diffstat (limited to 'xfa')
27 files changed, 68 insertions, 515 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index a4cfab2983..e0e788144a 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -160,11 +160,11 @@ int32_t CFDE_TxtEdtEngine::GetTextLength() const { void CFDE_TxtEdtEngine::GetText(CFX_WideString& wsText, int32_t nStart, - int32_t nCount) { + int32_t nCount) const { int32_t nTextBufLength = GetTextBufLength(); - if (nCount == -1) { + if (nCount == -1) nCount = nTextBufLength - nStart; - } + m_pTxtBuf->GetRange(wsText, nStart, nCount); RecoverParagEnd(wsText); } @@ -646,11 +646,11 @@ void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) { m_Param.pEventSink->On_SelChanged(this); } -int32_t CFDE_TxtEdtEngine::CountSelRanges() { +int32_t CFDE_TxtEdtEngine::CountSelRanges() const { return m_SelRangePtrArr.GetSize(); } -int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t& nStart) { +int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t& nStart) const { nStart = m_SelRangePtrArr[nIndex]->nStart; return m_SelRangePtrArr[nIndex]->nCount; } @@ -1190,7 +1190,7 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, return bPreIsCR; } -void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { +void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const { FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { CFX_ArrayTemplate<int32_t> PosArr; diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 8f0e855f52..587402d414 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -31,7 +31,9 @@ class CFDE_TxtEdtEngine { void SetTextByStream(IFX_Stream* pStream); void SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; - void GetText(CFX_WideString& wsText, int32_t nStart, int32_t nCount = -1); + void GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount = -1) const; void ClearText(); int32_t GetCaretRect(CFX_RectF& rtCaret) const; @@ -57,8 +59,8 @@ class CFDE_TxtEdtEngine { void RemoveSelRange(int32_t nStart, int32_t nCount = -1); void AddSelRange(int32_t nStart, int32_t nCount = -1); - int32_t CountSelRanges(); - int32_t GetSelRange(int32_t nIndex, int32_t& nStart); + int32_t CountSelRanges() const; + int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const; void ClearSelection(); bool Redo(const IFDE_TxtEdtDoRecord* pRecord); @@ -126,7 +128,7 @@ class CFDE_TxtEdtEngine { bool ReplaceParagEnd(FX_WCHAR*& lpText, int32_t& nLength, bool bPreIsCR = false); - void RecoverParagEnd(CFX_WideString& wsText); + void RecoverParagEnd(CFX_WideString& wsText) const; int32_t MovePage2Char(int32_t nIndex); void TextPos2ParagPos(int32_t nIndex, FDE_TXTEDTPARAGPOS& ParagPos) const; int32_t MoveForward(bool& bBefore); diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 30d158c2e8..b309780f37 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -13,7 +13,7 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { public: - CFWL_Barcode(const IFWL_App*); + explicit CFWL_Barcode(const IFWL_App* pApp); ~CFWL_Barcode() override; void Initialize(); diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index 08371fca4a..97f963b327 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -12,7 +12,7 @@ #include "xfa/fwl/core/fwl_error.h" CFWL_CheckBox::CFWL_CheckBox(const IFWL_App* app) - : CFWL_Widget(app), m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {} + : CFWL_Widget(app), m_fBoxHeight(16.0f) {} CFWL_CheckBox::~CFWL_CheckBox() {} @@ -31,7 +31,7 @@ void CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { void CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { - wsCaption = m_wsCaption; + wsCaption = L"Check box"; } FX_FLOAT CFWL_CheckBox::GetBoxSize(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index fb7a9ae1bf..306d6d0814 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -12,7 +12,7 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { public: - CFWL_CheckBox(const IFWL_App*); + explicit CFWL_CheckBox(const IFWL_App* pApp); ~CFWL_CheckBox() override; void Initialize(); @@ -27,7 +27,6 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { 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 d59cd4bd12..d1f95035d6 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -25,7 +25,7 @@ const IFWL_ComboBox* ToComboBox(const IFWL_Widget* widget) { } // namespace CFWL_ComboBox::CFWL_ComboBox(const IFWL_App* app) - : CFWL_Widget(app), m_fMaxListHeight(0), m_fItemHeight(0) {} + : CFWL_Widget(app), m_fMaxListHeight(0) {} CFWL_ComboBox::~CFWL_ComboBox() {} @@ -181,16 +181,6 @@ int32_t CFWL_ComboBox::GetItemIndex(IFWL_Widget* pWidget, return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; } -bool CFWL_ComboBox::SetItemIndex(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - int32_t nIndex) { - if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) - return false; - - m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(pItem)); - return true; -} - uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { if (!pItem) @@ -226,13 +216,6 @@ void CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget, static_cast<CFWL_ListItem*>(pItem)->m_dwStyles = dwStyle; } -void CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const FX_WCHAR* pszText) { - if (pItem) - static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText; -} - void CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget, CFWL_ListItem* pItem, const CFX_RectF& rtItem) { @@ -240,10 +223,6 @@ void CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget, static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem; } -FX_FLOAT CFWL_ComboBox::GetItemHeight(IFWL_Widget* pWidget) { - return m_fItemHeight; -} - CFX_DIBitmap* CFWL_ComboBox::GetItemIcon(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pDIB : nullptr; diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 9361bbf642..5b4f821155 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -15,7 +15,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { public: - CFWL_ComboBox(const IFWL_App*); + explicit CFWL_ComboBox(const IFWL_App* pApp); ~CFWL_ComboBox() override; void Initialize(); @@ -28,10 +28,6 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const override; int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; - bool SetItemIndex(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - int32_t nIndex) override; - uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; void GetItemText(IFWL_Widget* pWidget, CFWL_ListItem* pItem, @@ -43,13 +39,9 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { void SetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem, uint32_t dwStyle) override; - void SetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const FX_WCHAR* pszText) override; void SetItemRect(IFWL_Widget* pWidget, CFWL_ListItem* pItem, const CFX_RectF& rtItem) override; - FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; void GetItemCheckRect(IFWL_Widget* pWidget, @@ -103,7 +95,6 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { private: std::vector<std::unique_ptr<CFWL_ListItem>> 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 efc2b62cf7..cead9045d9 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), m_iYear(2011), m_iMonth(1), m_iDay(1) {} + : CFWL_Widget(app) {} CFWL_DateTimePicker::~CFWL_DateTimePicker() {} @@ -66,9 +66,9 @@ void CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget, int32_t& iYear, int32_t& iMonth, int32_t& iDay) { - iYear = m_iYear; - iMonth = m_iMonth; - iDay = m_iDay; + iYear = 2011; + iMonth = 1; + iDay = 1; } void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 5003cb2ea5..f27082fa60 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -12,7 +12,7 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { public: - CFWL_DateTimePicker(const IFWL_App*); + explicit CFWL_DateTimePicker(const IFWL_App* pApp); ~CFWL_DateTimePicker() override; void Initialize(); @@ -38,9 +38,6 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); private: - int32_t m_iYear; - int32_t m_iMonth; - int32_t m_iDay; CFX_WideString m_wsData; }; diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index c7acf18f77..dc01e2213a 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -17,6 +17,10 @@ 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) {} @@ -39,20 +43,20 @@ void CFWL_Edit::SetText(const CFX_WideString& wsText) { void CFWL_Edit::GetText(CFX_WideString& wsText, int32_t nStart, - int32_t nCount) { + int32_t nCount) const { if (GetWidget()) ToEdit(GetWidget())->GetText(wsText, nStart, nCount); } -int32_t CFWL_Edit::CountSelRanges() { +int32_t CFWL_Edit::CountSelRanges() const { return GetWidget() ? ToEdit(GetWidget())->CountSelRanges() : 0; } -int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { +int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) const { return GetWidget() ? ToEdit(GetWidget())->GetSelRange(nIndex, nStart) : 0; } -int32_t CFWL_Edit::GetLimit() { +int32_t CFWL_Edit::GetLimit() const { return GetWidget() ? ToEdit(GetWidget())->GetLimit() : -1; } diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h index a3a77a7f52..f7dc5e7319 100644 --- a/xfa/fwl/core/cfwl_edit.h +++ b/xfa/fwl/core/cfwl_edit.h @@ -16,18 +16,24 @@ class IFDE_TxtEdtDoRecord; class CFWL_Edit : public CFWL_Widget { public: - CFWL_Edit(const IFWL_App*); + explicit CFWL_Edit(const IFWL_App*); ~CFWL_Edit() override; void Initialize(); void SetText(const CFX_WideString& wsText); - void GetText(CFX_WideString& wsText, int32_t nStart = 0, int32_t nCount = -1); - int32_t CountSelRanges(); - int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - int32_t GetLimit(); + void GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + + int32_t CountSelRanges() const; + int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const; + + int32_t GetLimit() const; void SetLimit(int32_t nLimit); + void SetAliasChar(FX_WCHAR wAlias); + void SetScrollOffset(FX_FLOAT fScrollOffset); }; diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 7dfff9e5d1..8742729080 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -69,15 +69,11 @@ void CFWL_ListBox::DeleteAll() { } int32_t CFWL_ListBox::CountSelItems() { - if (!GetWidget()) - return 0; - return ToListBox(GetWidget())->CountSelItems(); + return GetWidget() ? ToListBox(GetWidget())->CountSelItems() : 0; } CFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { - if (!GetWidget()) - return nullptr; - return ToListBox(GetWidget())->GetSelItem(nIndexSel); + return GetWidget() ? ToListBox(GetWidget())->GetSelItem(nIndexSel) : nullptr; } int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { @@ -96,17 +92,8 @@ void CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { ToListBox(GetWidget())->GetItemText(pItem, wsText); } -void CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { - if (GetWidget()) - ToListBox(GetWidget())->GetScrollPos(fPos, bVert); -} - -int32_t CFWL_ListBox::CountItems() const { - return pdfium::CollectionSize<int32_t>(m_ItemArray); -} - CFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) { - if (nIndex < 0 || nIndex >= CountItems()) + if (nIndex < 0 || nIndex >= CountItems(nullptr)) return nullptr; return m_ItemArray[nIndex].get(); @@ -131,7 +118,6 @@ CFWL_ListItem* CFWL_ListBox::GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const { if (nIndex < 0 || nIndex >= CountItems(pWidget)) return nullptr; - return m_ItemArray[nIndex].get(); } @@ -144,20 +130,9 @@ int32_t CFWL_ListBox::GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; } -bool CFWL_ListBox::SetItemIndex(IFWL_Widget* pWidget, - CFWL_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::GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { - if (!pItem) - return 0; - return static_cast<CFWL_ListItem*>(pItem)->m_dwStates; + return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_dwStates : 0; } void CFWL_ListBox::GetItemText(IFWL_Widget* pWidget, @@ -185,13 +160,6 @@ void CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget, static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle; } -void CFWL_ListBox::SetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const FX_WCHAR* pszText) { - if (pItem) - static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText; -} - void CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget, CFWL_ListItem* pItem, const CFX_RectF& rtItem) { @@ -199,10 +167,6 @@ void CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget, static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem; } -FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) { - return 20; -} - CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { return static_cast<CFWL_ListItem*>(pItem)->m_pDIB; diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index f8f3c586f4..35ba060ca2 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -17,7 +17,7 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { public: - CFWL_ListBox(const IFWL_App*); + explicit CFWL_ListBox(const IFWL_App* pApp); ~CFWL_ListBox() override; void Initialize(); @@ -30,9 +30,6 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const override; int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; - bool SetItemIndex(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - int32_t nIndex) override; uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; void GetItemText(IFWL_Widget* pWidget, CFWL_ListItem* pItem, @@ -44,13 +41,9 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { void SetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem, uint32_t dwStyle) override; - void SetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const FX_WCHAR* pszText) override; void SetItemRect(IFWL_Widget* pWidget, CFWL_ListItem* pItem, const CFX_RectF& rtItem) override; - FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; void GetItemCheckRect(IFWL_Widget* pWidget, @@ -70,20 +63,15 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { void DeleteAll(); int32_t CountSelItems(); - void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true); CFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); - CFWL_ListItem* GetItem(int32_t nIndex); void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); uint32_t GetItemStates(CFWL_ListItem* pItem); private: - int32_t CountItems() const; - std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; }; diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp index b701ae7eba..4b8bf70d07 100644 --- a/xfa/fwl/core/cfwl_picturebox.cpp +++ b/xfa/fwl/core/cfwl_picturebox.cpp @@ -10,16 +10,7 @@ #include "third_party/base/ptr_util.h" -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(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_PictureBox::~CFWL_PictureBox() {} @@ -32,101 +23,5 @@ void CFWL_PictureBox::Initialize() { CFWL_Widget::Initialize(); } -CFX_DIBitmap* CFWL_PictureBox::GetPicture() { - return m_pBitmap; -} - -FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { - m_pBitmap = pBitmap; - return FWL_Error::Succeeded; -} - -FX_FLOAT CFWL_PictureBox::GetRotation() { - return m_fRotation; -} - -FWL_Error CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) { - m_fRotation = fRotation; - return FWL_Error::Succeeded; -} - -int32_t CFWL_PictureBox::GetFlipMode() { - return GetFlipMode(m_pIface.get()); -} - -FWL_Error CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) { - m_iFlipMode = iFlipMode; - return FWL_Error::Succeeded; -} - -int32_t CFWL_PictureBox::GetOpacity() { - return GetOpacity(m_pIface.get()); -} - -FWL_Error CFWL_PictureBox::SetOpacity(int32_t iOpacity) { - m_iOpacity = iOpacity; - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) { - CFX_Matrix 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_fScaleX = fScaleX; - m_fScaleY = fScaleY; - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) { - CFX_Matrix 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_fOffSetX = fx; - m_fOffSetY = fy; - return FWL_Error::Succeeded; -} - void CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) {} - -CFX_DIBitmap* CFWL_PictureBox::GetPicture(IFWL_Widget* pWidget) { - return m_pBitmap; -} - -CFX_DIBitmap* CFWL_PictureBox::GetErrorPicture(IFWL_Widget* pWidget) { - return m_pBitmap; -} - -CFX_DIBitmap* CFWL_PictureBox::GetInitialPicture(IFWL_Widget* pWidget) { - return m_pBitmap; -} - -int32_t CFWL_PictureBox::GetOpacity(IFWL_Widget* pWidget) { - return m_iOpacity; -} - -void CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { - CFX_RectF rect; - pWidget->GetClientRect(rect); - FX_FLOAT fLen = rect.width / 2; - FX_FLOAT fWid = rect.height / 2; - matrix.SetIdentity(); - matrix.Translate(-fLen, -fWid); - matrix.Rotate(m_fRotation); - matrix.Translate(fLen, fWid); - matrix.Scale(m_fScaleX, m_fScaleY); - matrix.Translate(m_fOffSetX, m_fOffSetY); -} - -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 861372149e..12a8b632ff 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -8,51 +8,17 @@ #define XFA_FWL_CORE_CFWL_PICTUREBOX_H_ #include "xfa/fwl/core/cfwl_widget.h" -#include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_picturebox.h" class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP { public: - CFWL_PictureBox(const IFWL_App*); + explicit CFWL_PictureBox(const IFWL_App* pApp); ~CFWL_PictureBox() override; void Initialize(); // IFWL_DataProvider void 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; - void GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; - - CFX_DIBitmap* GetPicture(); - FWL_Error SetPicture(CFX_DIBitmap* pBitmap); - FX_FLOAT GetRotation(); - FWL_Error SetRotation(FX_FLOAT fRotation); - int32_t GetFlipMode(); - FWL_Error SetFlipMode(int32_t iFlipMode); - int32_t GetOpacity(); - FWL_Error SetOpacity(int32_t iOpacity); - FWL_Error GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY); - FWL_Error SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY); - FWL_Error GetOffset(FX_FLOAT& fx, FX_FLOAT& fy); - FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy); - - - 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 1fc6191d3d..90c8ab4941 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -10,8 +10,7 @@ #include "third_party/base/ptr_util.h" -CFWL_PushButton::CFWL_PushButton(const IFWL_App* app) - : CFWL_Widget(app), m_pBitmap(nullptr) {} +CFWL_PushButton::CFWL_PushButton(const IFWL_App* app) : CFWL_Widget(app) {} CFWL_PushButton::~CFWL_PushButton() {} @@ -24,25 +23,7 @@ void CFWL_PushButton::Initialize() { CFWL_Widget::Initialize(); } -FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { - m_wsCaption = wsCaption; - return FWL_Error::Succeeded; -} - -CFX_DIBitmap* CFWL_PushButton::GetPicture() { - return m_pBitmap; -} - -FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { - m_pBitmap = pBitmap; - return FWL_Error::Succeeded; -} - void CFWL_PushButton::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { - wsCaption = m_wsCaption; -} - -CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) { - return m_pBitmap; + wsCaption = L""; } diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h index b6beb14bab..ad17406d12 100644 --- a/xfa/fwl/core/cfwl_pushbutton.h +++ b/xfa/fwl/core/cfwl_pushbutton.h @@ -12,24 +12,13 @@ class CFWL_PushButton : public CFWL_Widget, public IFWL_PushButtonDP { public: - CFWL_PushButton(const IFWL_App*); + explicit CFWL_PushButton(const IFWL_App*); ~CFWL_PushButton() override; void Initialize(); - FWL_Error SetCaption(const CFX_WideStringC& wsCaption); - CFX_DIBitmap* GetPicture(); - FWL_Error SetPicture(CFX_DIBitmap* pBitmap); - // IFWL_DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - - // IFWL_PushButtonDP - CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; - - private: - CFX_WideString m_wsCaption; - CFX_DIBitmap* m_pBitmap; }; #endif // XFA_FWL_CORE_CFWL_PUSHBUTTON_H_ diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index 5ea5aebead..fb44ded269 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -18,10 +18,7 @@ #define FWL_WGT_CalcWidth 2048 #define FWL_WGT_CalcMultiLineDefWidth 120.0f -CFWL_Widget::CFWL_Widget(const IFWL_App* app) - : m_pApp(app), m_pWidgetMgr(app->GetWidgetMgr()) { - ASSERT(m_pWidgetMgr); -} +CFWL_Widget::CFWL_Widget(const IFWL_App* app) : m_pApp(app) {} CFWL_Widget::~CFWL_Widget() {} diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index a4a0e94c1d..5461f480fd 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -20,7 +20,7 @@ class CFWL_WidgetMgr; class CFWL_Widget { public: - CFWL_Widget(const IFWL_App*); + explicit CFWL_Widget(const IFWL_App*); virtual ~CFWL_Widget(); IFWL_Widget* GetWidget(); @@ -35,7 +35,6 @@ class CFWL_Widget { uint32_t GetStates(); void SetStates(uint32_t dwStates, bool bSet = true); - void SetLayoutItem(void* pItem); void Update(); @@ -43,7 +42,6 @@ class CFWL_Widget { void UnlockUpdate(); FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); IFWL_WidgetDelegate* GetDelegate() const; @@ -54,7 +52,6 @@ class CFWL_Widget { const IFWL_App* m_pApp; std::unique_ptr<IFWL_Widget> m_pIface; - CFWL_WidgetMgr* const m_pWidgetMgr; }; #endif // XFA_FWL_CORE_CFWL_WIDGET_H_ diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index aa3fdcec39..55ee785845 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -297,7 +297,7 @@ int32_t IFWL_Edit::GetTextLength() const { void IFWL_Edit::GetText(CFX_WideString& wsText, int32_t nStart, - int32_t nCount) { + int32_t nCount) const { m_EdtEngine.GetText(wsText, nStart, nCount); } @@ -309,11 +309,11 @@ void IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { m_EdtEngine.AddSelRange(nStart, nCount); } -int32_t IFWL_Edit::CountSelRanges() { +int32_t IFWL_Edit::CountSelRanges() const { return m_EdtEngine.CountSelRanges(); } -int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { +int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) const { return m_EdtEngine.GetSelRange(nIndex, nStart); } @@ -321,7 +321,7 @@ void IFWL_Edit::ClearSelections() { m_EdtEngine.ClearSelection(); } -int32_t IFWL_Edit::GetLimit() { +int32_t IFWL_Edit::GetLimit() const { return m_nLimit; } diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h index 65c660332d..2acc3856d4 100644 --- a/xfa/fwl/core/ifwl_edit.h +++ b/xfa/fwl/core/ifwl_edit.h @@ -116,14 +116,16 @@ class IFWL_Edit : public IFWL_Widget { virtual void SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; - void GetText(CFX_WideString& wsText, int32_t nStart = 0, int32_t nCount = -1); + void GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; void ClearText(); void AddSelRange(int32_t nStart, int32_t nCount = -1); - int32_t CountSelRanges(); - int32_t GetSelRange(int32_t nIndex, int32_t& nStart); + int32_t CountSelRanges() const; + int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const; void ClearSelections(); - int32_t GetLimit(); + int32_t GetLimit() const; void SetLimit(int32_t nLimit); void SetAliasChar(FX_WCHAR wAlias); bool Copy(CFX_WideString& wsCopy); diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index e468602cdf..041e008065 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -235,14 +235,6 @@ void IFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { pData->GetItemText(this, pItem, wsText); } -void IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { - if ((bVert && IsShowScrollBar(true)) || (!bVert && IsShowScrollBar(false))) { - IFWL_ScrollBar* pScrollBar = - bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); - fPos = pScrollBar->GetPos(); - } -} - CFWL_ListItem* IFWL_ListBox::GetItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) { CFWL_ListItem* hRet = nullptr; switch (dwKeyCode) { diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h index 32865c116e..42886d17e0 100644 --- a/xfa/fwl/core/ifwl_listbox.h +++ b/xfa/fwl/core/ifwl_listbox.h @@ -55,9 +55,6 @@ class IFWL_ListBoxDP : public IFWL_DataProvider { virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const = 0; virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; - virtual bool SetItemIndex(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - int32_t nIndex) = 0; virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; virtual void GetItemText(IFWL_Widget* pWidget, @@ -70,13 +67,9 @@ class IFWL_ListBoxDP : public IFWL_DataProvider { virtual void SetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem, uint32_t dwStyle) = 0; - virtual void SetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const FX_WCHAR* pszText) = 0; virtual void SetItemRect(IFWL_Widget* pWidget, CFWL_ListItem* pItem, const CFX_RectF& rtItem) = 0; - virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; virtual void GetItemCheckRect(IFWL_Widget* pWidget, @@ -117,7 +110,6 @@ class IFWL_ListBox : public IFWL_Widget { int32_t GetSelIndex(int32_t nIndex); void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true); void GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText); - void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); FX_FLOAT GetItemHeight() const { return m_fItemHeight; } FX_FLOAT CalcItemHeight(); diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index b7a4c61118..19db6f59fa 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -30,13 +30,6 @@ void IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pDataProvider) return; - CFX_DIBitmap* pBitmap = - static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider) - ->GetPicture(this); - if (pBitmap) { - rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(), - (FX_FLOAT)pBitmap->GetHeight()); - } IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; @@ -72,29 +65,7 @@ void IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { - IFWL_PictureBoxDP* pPictureDP = - static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider); - if (!pPictureDP) - return; - - CFX_DIBitmap* pPicture = pPictureDP->GetPicture(this); - CFX_Matrix matrix; - pPictureDP->GetMatrix(this, matrix); - if (!pPicture) - return; - - matrix.Concat(*pMatrix); - FX_FLOAT fx = (FX_FLOAT)pPicture->GetWidth(); - FX_FLOAT fy = (FX_FLOAT)pPicture->GetHeight(); - if (fx > m_rtClient.width) { - fx = m_rtClient.width; - } - if (fy > m_rtClient.height) { - fy = m_rtClient.height; - } - pGraphics->DrawImage(pPicture, CFX_PointF((m_rtClient.width - fx) / 2, - (m_rtClient.height - fy) / 2), - &matrix); + return; } void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 41b09f4f03..752880f40a 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -29,15 +29,7 @@ class CFX_DIBitmap; class IFWL_Widget; -class IFWL_PictureBoxDP : public IFWL_DataProvider { - public: - virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0; - virtual CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) = 0; - virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) = 0; - virtual int32_t GetOpacity(IFWL_Widget* pWidget) = 0; - virtual int32_t GetFlipMode(IFWL_Widget* pWidget) = 0; - virtual void GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; -}; +class IFWL_PictureBoxDP : public IFWL_DataProvider {}; class IFWL_PictureBox : public IFWL_Widget { public: diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index 0b3b574743..03bc7060d7 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -89,7 +89,6 @@ void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, return; IFWL_PushButtonDP* pData = static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); - CFX_DIBitmap* pPicture = nullptr; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, @@ -102,8 +101,7 @@ void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, DrawBkground(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); CFX_Matrix matrix; matrix.Concat(*pMatrix); - FX_FLOAT iPicwidth = 0; - FX_FLOAT ipicheight = 0; + CFX_WideString wsCaption; if (pData) { pData->GetCaption(this, wsCaption); @@ -118,153 +116,7 @@ void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); break; case FWL_STYLEEXT_PSB_IconOnly: - if (pData) { - pPicture = pData->GetPicture(this); - } - if (pPicture) { - CFX_PointF point; - switch (m_iTTOAlign) { - case 0: { - point.x = m_rtClient.left; - point.y = m_rtClient.top; - break; - } - case 1: { - point.x = m_rtClient.left + - (m_rtClient.width / 2 - pPicture->GetWidth() / 2); - point.y = m_rtClient.top; - break; - } - case 2: - point.x = m_rtClient.left + m_rtClient.width - pPicture->GetWidth(); - point.y = m_rtClient.top; - break; - case 4: - point.x = m_rtClient.left; - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - break; - case 5: - point.x = m_rtClient.left + - (m_rtClient.width / 2 - pPicture->GetWidth() / 2); - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - break; - case 6: - point.x = m_rtClient.left + m_rtClient.width - pPicture->GetWidth(); - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - break; - case 8: - point.x = m_rtClient.left; - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - break; - case 9: - point.x = m_rtClient.left + - (m_rtClient.width / 2 - pPicture->GetWidth() / 2); - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - break; - case 10: - point.x = m_rtClient.left + m_rtClient.width - pPicture->GetWidth(); - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - break; - } - pGraphics->DrawImage(pPicture, point, &matrix); - } - break; case FWL_STYLEEXT_PSB_TextIcon: - if (pPicture) { - CFX_PointF point; - switch (m_iTTOAlign) { - case 0: { - point.x = m_rtClient.left; - point.y = m_rtClient.top; - iPicwidth = (FX_FLOAT)(pPicture->GetWidth() - 7); - ipicheight = - pPicture->GetHeight() / 2 - m_rtCaption.top - rtText.height / 2; - break; - } - case 1: { - point.x = - m_rtClient.left + (m_rtClient.width / 2 - - (pPicture->GetWidth() + rtText.width) / 2); - point.y = m_rtClient.top; - iPicwidth = pPicture->GetWidth() - - ((m_rtClient.width) / 2 - rtText.width / 2 - point.x) + - rtText.width / 2 - 7; - ipicheight = - pPicture->GetHeight() / 2 - m_rtCaption.top - rtText.height / 2; - break; - } - case 2: - point.x = m_rtClient.left + m_rtClient.width - - pPicture->GetWidth() - rtText.width; - point.y = m_rtClient.top; - iPicwidth = m_rtClient.left + m_rtClient.width - point.x - - pPicture->GetWidth() - rtText.width + 7; - ipicheight = - pPicture->GetHeight() / 2 - m_rtCaption.top - rtText.height / 2; - break; - case 4: - point.x = m_rtClient.left; - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - iPicwidth = m_rtClient.left + pPicture->GetWidth() - 7; - break; - case 5: - point.x = - m_rtClient.left + (m_rtClient.width / 2 - - (pPicture->GetWidth() + rtText.width) / 2); - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - iPicwidth = pPicture->GetWidth() - - ((m_rtClient.width) / 2 - rtText.width / 2 - point.x) + - rtText.width / 2 - 7; - break; - case 6: - point.x = m_rtClient.left + m_rtClient.width - - pPicture->GetWidth() - rtText.width; - point.y = m_rtClient.top + m_rtClient.height / 2 - - pPicture->GetHeight() / 2; - iPicwidth = m_rtClient.left + m_rtClient.width - point.x - - pPicture->GetWidth() - rtText.width + 7; - break; - case 8: - point.x = m_rtClient.left; - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - iPicwidth = (FX_FLOAT)(pPicture->GetWidth() - 7); - ipicheight -= rtText.height / 2; - break; - case 9: - point.x = - m_rtClient.left + (m_rtClient.width / 2 - - (pPicture->GetWidth() + rtText.width) / 2); - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - iPicwidth = pPicture->GetWidth() - - ((m_rtClient.width) / 2 - rtText.width / 2 - point.x) + - rtText.width / 2 - 7; - ipicheight -= rtText.height / 2; - break; - case 10: - point.x = m_rtClient.left + m_rtClient.width - - pPicture->GetWidth() - rtText.width; - point.y = - m_rtClient.top + m_rtClient.height - pPicture->GetHeight(); - iPicwidth = m_rtClient.left + m_rtClient.width - point.x - - pPicture->GetWidth() - rtText.width + 7; - ipicheight -= rtText.height / 2; - break; - } - pGraphics->DrawImage(pPicture, point, &matrix); - } - matrix.e += m_rtClient.left + iPicwidth; - matrix.f += m_rtClient.top + ipicheight; - DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); break; } } diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h index d717997c18..0c63592f11 100644 --- a/xfa/fwl/core/ifwl_pushbutton.h +++ b/xfa/fwl/core/ifwl_pushbutton.h @@ -31,10 +31,7 @@ class CFWL_MsgMouse; class CFX_DIBitmap; class IFWL_Widget; -class IFWL_PushButtonDP : public IFWL_DataProvider { - public: - virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0; -}; +class IFWL_PushButtonDP : public IFWL_DataProvider {}; class IFWL_PushButton : public IFWL_Widget { public: |