diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-02 13:38:17 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-03 20:20:35 +0000 |
commit | b38c5dfcbb76dc5b731fb969423e4bedcbca19f6 (patch) | |
tree | ffed4142823008f5985fb70e73f00885c8262a18 | |
parent | c8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d (diff) | |
download | pdfium-b38c5dfcbb76dc5b731fb969423e4bedcbca19f6.tar.xz |
Remove CFWL_ListBox::GetDataProviderItemText
This method just proxies to the provided item now. Remove the method and call
GetText() directly if possible.
Change-Id: Ida49e0e878f859a69f7d5bec9d0f734feb7a763d
Reviewed-on: https://pdfium-review.googlesource.com/2130
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | xfa/fwl/cfwl_combobox.cpp | 23 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.h | 1 |
3 files changed, 8 insertions, 20 deletions
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index ae49896f09..c07e0cf246 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -173,7 +173,6 @@ void CFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, return; CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel); - CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem); CFWL_ThemeText theme_text; theme_text.m_pWidget = this; @@ -185,7 +184,7 @@ void CFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, theme_text.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) ? CFWL_PartState_Selected : CFWL_PartState_Normal; - theme_text.m_wsText = wsText; + theme_text.m_wsText = hItem ? hItem->GetText() : L""; theme_text.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; theme_text.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; pTheme->DrawText(&theme_text); @@ -229,8 +228,7 @@ void CFWL_ComboBox::SetCurSel(int32_t iSel) { m_pEdit->SetText(CFX_WideString()); } else { CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel); - CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem); - m_pEdit->SetText(wsText); + m_pEdit->SetText(hItem ? hItem->GetText() : L""); } m_pEdit->Update(); } @@ -268,7 +266,7 @@ CFX_WideString CFWL_ComboBox::GetEditText() const { return L""; CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel); - return m_pListBox->GetDataProviderItemText(hItem); + return hItem ? hItem->GetText() : L""; } void CFWL_ComboBox::OpenDropDownList(bool bActivate) { @@ -372,8 +370,7 @@ void CFWL_ComboBox::MatchEditText() { void CFWL_ComboBox::SyncEditText(int32_t iListItem) { CFWL_ListItem* hItem = m_pListBox->GetItem(this, iListItem); - CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem); - m_pEdit->SetText(wsText); + m_pEdit->SetText(hItem ? hItem->GetText() : L""); m_pEdit->Update(); m_pEdit->SetSelected(); } @@ -401,9 +398,8 @@ void CFWL_ComboBox::Layout() { if (m_iCurSel >= 0) { CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel); - CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem); m_pEdit->LockUpdate(); - m_pEdit->SetText(wsText); + m_pEdit->SetText(hItem ? hItem->GetText() : L""); m_pEdit->UnlockUpdate(); } m_pEdit->Update(); @@ -713,9 +709,8 @@ void CFWL_ComboBox::DisForm_Layout() { if (m_iCurSel >= 0) { CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel); - CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem); m_pEdit->LockUpdate(); - m_pEdit->SetText(wsText); + m_pEdit->SetText(hItem ? hItem->GetText() : L""); m_pEdit->UnlockUpdate(); } m_pEdit->Update(); @@ -890,8 +885,7 @@ void CFWL_ComboBox::DoSubCtrlKey(CFWL_MessageKey* pMsg) { iCurSel = m_pListBox->MatchItem(wsText); if (iCurSel >= 0) { CFWL_ListItem* hItem = m_pListBox->GetItem(this, iCurSel); - CFX_WideString wsTemp = m_pListBox->GetDataProviderItemText(hItem); - bMatchEqual = wsText == wsTemp; + bMatchEqual = wsText == (hItem ? hItem->GetText() : L""); } } if (iCurSel < 0) { @@ -1020,8 +1014,7 @@ void CFWL_ComboBox::DisForm_OnKey(CFWL_MessageKey* pMsg) { iCurSel = pComboList->MatchItem(wsText); if (iCurSel >= 0) { CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel); - CFX_WideString wsTemp = m_pListBox->GetDataProviderItemText(item); - bMatchEqual = wsText == wsTemp; + bMatchEqual = wsText == (item ? item->GetText() : L""); } } if (iCurSel < 0) { diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 28888af9af..d79e48991e 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -176,10 +176,6 @@ void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) { SetSelection(pItem, pItem, bSelect); } -CFX_WideString CFWL_ListBox::GetDataProviderItemText(CFWL_ListItem* pItem) { - return pItem ? pItem->GetText() : L""; -} - CFWL_ListItem* CFWL_ListBox::GetListItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) { CFWL_ListItem* hRet = nullptr; diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h index c46108b9d6..95d8ad9900 100644 --- a/xfa/fwl/cfwl_listbox.h +++ b/xfa/fwl/cfwl_listbox.h @@ -62,7 +62,6 @@ class CFWL_ListBox : public CFWL_Widget { CFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); void SetSelItem(CFWL_ListItem* hItem, bool bSelect); - CFX_WideString GetDataProviderItemText(CFWL_ListItem* hItem); FX_FLOAT GetItemHeight() const { return m_fItemHeight; } FX_FLOAT CalcItemHeight(); |