diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-16 07:01:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-16 07:01:26 -0800 |
commit | 72f957a0bafaf7c9628980e404c471b54f42de8f (patch) | |
tree | 1b6764bfdb0f87c01843397f16f191906d6810ec /xfa/fwl/core/cfwl_listbox.cpp | |
parent | f35650c8778522345d8a639f42add2874ffe44dd (diff) | |
download | pdfium-72f957a0bafaf7c9628980e404c471b54f42de8f.tar.xz |
Cleaning up nits in fwl/core files.chromium/2922
This Cl cleans up the nits in the first set of cfwl_* files. The unused Event
and Message classes are removed.
Review-Url: https://codereview.chromium.org/2505703003
Diffstat (limited to 'xfa/fwl/core/cfwl_listbox.cpp')
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 8742729080..c5bf881074 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -44,16 +44,15 @@ CFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, bool CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) { int32_t nIndex = GetItemIndex(GetWidget(), pItem); - if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) { + if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) return false; - } + int32_t iCount = CountItems(m_pIface.get()); int32_t iSel = nIndex + 1; if (iSel >= iCount) { iSel = nIndex - 1; - if (iSel < 0) { + if (iSel < 0) iSel = -1; - } } if (iSel >= 0) { CFWL_ListItem* pSel = @@ -77,9 +76,7 @@ CFWL_ListItem* CFWL_ListBox::GetSelItem(int32_t nIndexSel) { } int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { - if (!GetWidget()) - return 0; - return ToListBox(GetWidget())->GetSelIndex(nIndex); + return GetWidget() ? ToListBox(GetWidget())->GetSelIndex(nIndex) : 0; } void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) { @@ -95,15 +92,13 @@ void CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { CFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) { if (nIndex < 0 || nIndex >= CountItems(nullptr)) return nullptr; - return m_ItemArray[nIndex].get(); } uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { if (!pItem) return 0; - CFWL_ListItem* pListItem = static_cast<CFWL_ListItem*>(pItem); - return pListItem->m_dwStates | pListItem->m_dwCheckState; + return pItem->m_dwStates | pItem->m_dwCheckState; } void CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { |