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/fee/fde_txtedtengine.h" | 10 #include "xfa/fee/fde_txtedtengine.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } else { | 550 } else { |
551 rect = m_pProperties->m_rtWidget; | 551 rect = m_pProperties->m_rtWidget; |
552 } | 552 } |
553 return FWL_ERR_Succeeded; | 553 return FWL_ERR_Succeeded; |
554 } | 554 } |
555 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, | 555 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, |
556 uint32_t dwStylesExRemoved) { | 556 uint32_t dwStylesExRemoved) { |
557 if (m_pWidgetMgr->IsFormDisabled()) { | 557 if (m_pWidgetMgr->IsFormDisabled()) { |
558 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 558 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
559 } | 559 } |
560 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 560 bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); |
561 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 561 bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); |
562 if (bAddDropDown && !m_pEdit) { | 562 if (bAddDropDown && !m_pEdit) { |
563 CFWL_WidgetImpProperties prop; | 563 CFWL_WidgetImpProperties prop; |
564 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); | 564 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); |
565 m_pEdit->Initialize(); | 565 m_pEdit->Initialize(); |
566 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); | 566 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); |
567 m_pEdit->SetParent(m_pInterface); | 567 m_pEdit->SetParent(m_pInterface); |
568 } else if (bRemoveDropDown && m_pEdit) { | 568 } else if (bRemoveDropDown && m_pEdit) { |
569 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); | 569 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); |
570 } | 570 } |
571 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 571 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 Repaint(&rect); | 1225 Repaint(&rect); |
1226 } | 1226 } |
1227 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { | 1227 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { |
1228 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); | 1228 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); |
1229 } | 1229 } |
1230 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, | 1230 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
1231 uint32_t dwStylesExRemoved) { | 1231 uint32_t dwStylesExRemoved) { |
1232 if (!m_pEdit) { | 1232 if (!m_pEdit) { |
1233 DisForm_InitComboEdit(); | 1233 DisForm_InitComboEdit(); |
1234 } | 1234 } |
1235 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 1235 bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); |
1236 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 1236 bool bDelDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); |
1237 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; | 1237 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; |
1238 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; | 1238 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; |
1239 if (bAddDropDown) { | 1239 if (bAddDropDown) { |
1240 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); | 1240 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); |
1241 } else if (bDelDropDown) { | 1241 } else if (bDelDropDown) { |
1242 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); | 1242 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); |
1243 } | 1243 } |
1244 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 1244 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
1245 } | 1245 } |
1246 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { | 1246 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 m_pComboBox->ShowDropList(FALSE); | 1843 m_pComboBox->ShowDropList(FALSE); |
1844 } | 1844 } |
1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
1846 FX_BOOL bSet) { | 1846 FX_BOOL bSet) { |
1847 if (!bSet) { | 1847 if (!bSet) { |
1848 if (pMsg->m_pSetFocus == NULL) { | 1848 if (pMsg->m_pSetFocus == NULL) { |
1849 m_pComboBox->ShowDropList(FALSE); | 1849 m_pComboBox->ShowDropList(FALSE); |
1850 } | 1850 } |
1851 } | 1851 } |
1852 } | 1852 } |
OLD | NEW |