OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/basewidget/fwl_comboboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/fwl_editimp.h" | 10 #include "xfa/fwl/basewidget/fwl_editimp.h" |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 m_pOwner->m_pEdit->GetText(wsText); | 1549 m_pOwner->m_pEdit->GetText(wsText); |
1550 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) | 1550 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) |
1551 ->MatchItem(wsText); | 1551 ->MatchItem(wsText); |
1552 if (iCurSel >= 0) { | 1552 if (iCurSel >= 0) { |
1553 CFX_WideString wsTemp; | 1553 CFX_WideString wsTemp; |
1554 IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>( | 1554 IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>( |
1555 m_pOwner->m_pProperties->m_pDataProvider); | 1555 m_pOwner->m_pProperties->m_pDataProvider); |
1556 FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); | 1556 FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); |
1557 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) | 1557 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) |
1558 ->GetItemText(hItem, wsTemp); | 1558 ->GetItemText(hItem, wsTemp); |
1559 bMatchEqual = wsText.Equal(wsTemp); | 1559 bMatchEqual = wsText == wsTemp; |
1560 } | 1560 } |
1561 } | 1561 } |
1562 if (iCurSel < 0) { | 1562 if (iCurSel < 0) { |
1563 iCurSel = 0; | 1563 iCurSel = 0; |
1564 } else if (!bDropDown || bMatchEqual) { | 1564 } else if (!bDropDown || bMatchEqual) { |
1565 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { | 1565 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { |
1566 return; | 1566 return; |
1567 } | 1567 } |
1568 if (bUp) { | 1568 if (bUp) { |
1569 iCurSel--; | 1569 iCurSel--; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 FX_BOOL bMatchEqual = FALSE; | 1696 FX_BOOL bMatchEqual = FALSE; |
1697 int32_t iCurSel = m_pOwner->m_iCurSel; | 1697 int32_t iCurSel = m_pOwner->m_iCurSel; |
1698 if (m_pOwner->m_pEdit) { | 1698 if (m_pOwner->m_pEdit) { |
1699 CFX_WideString wsText; | 1699 CFX_WideString wsText; |
1700 m_pOwner->m_pEdit->GetText(wsText); | 1700 m_pOwner->m_pEdit->GetText(wsText); |
1701 iCurSel = pComboList->MatchItem(wsText); | 1701 iCurSel = pComboList->MatchItem(wsText); |
1702 if (iCurSel >= 0) { | 1702 if (iCurSel >= 0) { |
1703 CFX_WideString wsTemp; | 1703 CFX_WideString wsTemp; |
1704 FWL_HLISTITEM item = m_pOwner->m_pListBox->GetSelItem(iCurSel); | 1704 FWL_HLISTITEM item = m_pOwner->m_pListBox->GetSelItem(iCurSel); |
1705 m_pOwner->m_pListBox->GetItemText(item, wsTemp); | 1705 m_pOwner->m_pListBox->GetItemText(item, wsTemp); |
1706 bMatchEqual = wsText.Equal(wsTemp); | 1706 bMatchEqual = wsText == wsTemp; |
1707 } | 1707 } |
1708 } | 1708 } |
1709 if (iCurSel < 0) { | 1709 if (iCurSel < 0) { |
1710 iCurSel = 0; | 1710 iCurSel = 0; |
1711 } else if (bMatchEqual) { | 1711 } else if (bMatchEqual) { |
1712 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { | 1712 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { |
1713 return; | 1713 return; |
1714 } | 1714 } |
1715 if (bUp) { | 1715 if (bUp) { |
1716 iCurSel--; | 1716 iCurSel--; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 m_pComboBox->ShowDropList(FALSE); | 1815 m_pComboBox->ShowDropList(FALSE); |
1816 } | 1816 } |
1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
1818 FX_BOOL bSet) { | 1818 FX_BOOL bSet) { |
1819 if (!bSet) { | 1819 if (!bSet) { |
1820 if (pMsg->m_pSetFocus == NULL) { | 1820 if (pMsg->m_pSetFocus == NULL) { |
1821 m_pComboBox->ShowDropList(FALSE); | 1821 m_pComboBox->ShowDropList(FALSE); |
1822 } | 1822 } |
1823 } | 1823 } |
1824 } | 1824 } |
OLD | NEW |