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/fwl/core/cfwl_listbox.cpp | |
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/fwl/core/cfwl_listbox.cpp')
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.cpp | 44 |
1 files changed, 4 insertions, 40 deletions
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; |