| 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/cfde_txtedtengine.h" | 9 #include "xfa/fde/cfde_txtedtengine.h" |
| 10 #include "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 param.m_rtPart = m_rtBtn; | 688 param.m_rtPart = m_rtBtn; |
| 689 pTheme->DrawBackground(¶m); | 689 pTheme->DrawBackground(¶m); |
| 690 } | 690 } |
| 691 return FWL_Error::Succeeded; | 691 return FWL_Error::Succeeded; |
| 692 } | 692 } |
| 693 FWL_Error CFWL_ComboBoxImp::SetThemeProvider( | 693 FWL_Error CFWL_ComboBoxImp::SetThemeProvider( |
| 694 IFWL_ThemeProvider* pThemeProvider) { | 694 IFWL_ThemeProvider* pThemeProvider) { |
| 695 if (!pThemeProvider) | 695 if (!pThemeProvider) |
| 696 return FWL_Error::Indefinite; | 696 return FWL_Error::Indefinite; |
| 697 m_pProperties->m_pThemeProvider = pThemeProvider; | 697 m_pProperties->m_pThemeProvider = pThemeProvider; |
| 698 if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { | 698 if (m_pListBox) |
| 699 m_pListBox->SetThemeProvider(pThemeProvider); | 699 m_pListBox->SetThemeProvider(pThemeProvider); |
| 700 } | 700 if (m_pEdit) |
| 701 if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { | |
| 702 m_pEdit->SetThemeProvider(pThemeProvider); | 701 m_pEdit->SetThemeProvider(pThemeProvider); |
| 703 } | |
| 704 return FWL_Error::Succeeded; | 702 return FWL_Error::Succeeded; |
| 705 } | 703 } |
| 706 int32_t CFWL_ComboBoxImp::GetCurSel() { | 704 int32_t CFWL_ComboBoxImp::GetCurSel() { |
| 707 return m_iCurSel; | 705 return m_iCurSel; |
| 708 } | 706 } |
| 709 FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { | 707 FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { |
| 710 int32_t iCount = | 708 int32_t iCount = |
| 711 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); | 709 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); |
| 712 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; | 710 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; |
| 713 FX_BOOL bDropDown = IsDropDownStyle(); | 711 FX_BOOL bDropDown = IsDropDownStyle(); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 } | 1033 } |
| 1036 m_pEdit->Update(); | 1034 m_pEdit->Update(); |
| 1037 } | 1035 } |
| 1038 } | 1036 } |
| 1039 void CFWL_ComboBoxImp::ReSetTheme() { | 1037 void CFWL_ComboBoxImp::ReSetTheme() { |
| 1040 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 1038 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 1041 if (!pTheme) { | 1039 if (!pTheme) { |
| 1042 pTheme = GetAvailableTheme(); | 1040 pTheme = GetAvailableTheme(); |
| 1043 m_pProperties->m_pThemeProvider = pTheme; | 1041 m_pProperties->m_pThemeProvider = pTheme; |
| 1044 } | 1042 } |
| 1045 if (m_pListBox) { | 1043 if (m_pListBox && !m_pListBox->GetThemeProvider()) |
| 1046 if (!m_pListBox->GetThemeProvider() && | 1044 m_pListBox->SetThemeProvider(pTheme); |
| 1047 pTheme->IsValidWidget(m_pListBox.get())) { | 1045 if (m_pEdit && !m_pEdit->GetThemeProvider()) |
| 1048 m_pListBox->SetThemeProvider(pTheme); | 1046 m_pEdit->SetThemeProvider(pTheme); |
| 1049 } | |
| 1050 } | |
| 1051 if (m_pEdit) { | |
| 1052 if (!m_pEdit->GetThemeProvider() && pTheme->IsValidWidget(m_pEdit.get())) { | |
| 1053 m_pEdit->SetThemeProvider(pTheme); | |
| 1054 } | |
| 1055 } | |
| 1056 } | 1047 } |
| 1057 void CFWL_ComboBoxImp::ReSetEditAlignment() { | 1048 void CFWL_ComboBoxImp::ReSetEditAlignment() { |
| 1058 if (!m_pEdit) | 1049 if (!m_pEdit) |
| 1059 return; | 1050 return; |
| 1060 uint32_t dwStylExes = m_pProperties->m_dwStyleExes; | 1051 uint32_t dwStylExes = m_pProperties->m_dwStyleExes; |
| 1061 uint32_t dwAdd = 0; | 1052 uint32_t dwAdd = 0; |
| 1062 switch (dwStylExes & FWL_STYLEEXT_CMB_EditHAlignMask) { | 1053 switch (dwStylExes & FWL_STYLEEXT_CMB_EditHAlignMask) { |
| 1063 case FWL_STYLEEXT_CMB_EditHCenter: { | 1054 case FWL_STYLEEXT_CMB_EditHCenter: { |
| 1064 dwAdd |= FWL_STYLEEXT_EDT_HCenter; | 1055 dwAdd |= FWL_STYLEEXT_EDT_HCenter; |
| 1065 break; | 1056 break; |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 m_pComboBox->ShowDropList(FALSE); | 1841 m_pComboBox->ShowDropList(FALSE); |
| 1851 } | 1842 } |
| 1852 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1843 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
| 1853 FX_BOOL bSet) { | 1844 FX_BOOL bSet) { |
| 1854 if (!bSet) { | 1845 if (!bSet) { |
| 1855 if (!pMsg->m_pSetFocus) { | 1846 if (!pMsg->m_pSetFocus) { |
| 1856 m_pComboBox->ShowDropList(FALSE); | 1847 m_pComboBox->ShowDropList(FALSE); |
| 1857 } | 1848 } |
| 1858 } | 1849 } |
| 1859 } | 1850 } |
| OLD | NEW |