| 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/fxfa/app/xfa_ffchoicelist.h" | 7 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/ifwl_edit.h" | 9 #include "xfa/fwl/basewidget/ifwl_edit.h" |
| 10 #include "xfa/fwl/core/ifwl_app.h" | 10 #include "xfa/fwl/core/ifwl_app.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 pComboBox->AddString(wsLabelArray[i].AsStringC()); | 243 pComboBox->AddString(wsLabelArray[i].AsStringC()); |
| 244 } | 244 } |
| 245 CFX_Int32Array iSelArray; | 245 CFX_Int32Array iSelArray; |
| 246 m_pDataAcc->GetSelectedItems(iSelArray); | 246 m_pDataAcc->GetSelectedItems(iSelArray); |
| 247 int32_t iSelCount = iSelArray.GetSize(); | 247 int32_t iSelCount = iSelArray.GetSize(); |
| 248 if (iSelCount > 0) { | 248 if (iSelCount > 0) { |
| 249 pComboBox->SetCurSel(iSelArray[0]); | 249 pComboBox->SetCurSel(iSelArray[0]); |
| 250 } else { | 250 } else { |
| 251 CFX_WideString wsText; | 251 CFX_WideString wsText; |
| 252 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); | 252 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); |
| 253 pComboBox->SetEditText(wsText.AsStringC()); | 253 pComboBox->SetEditText(wsText); |
| 254 } | 254 } |
| 255 UpdateWidgetProperty(); | 255 UpdateWidgetProperty(); |
| 256 m_pNormalWidget->UnlockUpdate(); | 256 m_pNormalWidget->UnlockUpdate(); |
| 257 return CXFA_FFField::LoadWidget(); | 257 return CXFA_FFField::LoadWidget(); |
| 258 } | 258 } |
| 259 void CXFA_FFComboBox::UpdateWidgetProperty() { | 259 void CXFA_FFComboBox::UpdateWidgetProperty() { |
| 260 CFWL_ComboBox* pComboBox = (CFWL_ComboBox*)m_pNormalWidget; | 260 CFWL_ComboBox* pComboBox = (CFWL_ComboBox*)m_pNormalWidget; |
| 261 if (!pComboBox) { | 261 if (!pComboBox) { |
| 262 return; | 262 return; |
| 263 } | 263 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 CFX_Int32Array iSelArray; | 376 CFX_Int32Array iSelArray; |
| 377 m_pDataAcc->GetSelectedItems(iSelArray); | 377 m_pDataAcc->GetSelectedItems(iSelArray); |
| 378 int32_t iSelCount = iSelArray.GetSize(); | 378 int32_t iSelCount = iSelArray.GetSize(); |
| 379 if (iSelCount > 0) { | 379 if (iSelCount > 0) { |
| 380 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]); | 380 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]); |
| 381 } else { | 381 } else { |
| 382 CFX_WideString wsText; | 382 CFX_WideString wsText; |
| 383 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); | 383 ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); |
| 384 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); | 384 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); |
| 385 ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsStringC()); | 385 ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText); |
| 386 } | 386 } |
| 387 m_pNormalWidget->Update(); | 387 m_pNormalWidget->Update(); |
| 388 return TRUE; | 388 return TRUE; |
| 389 } | 389 } |
| 390 FX_BOOL CXFA_FFComboBox::CanUndo() { | 390 FX_BOOL CXFA_FFComboBox::CanUndo() { |
| 391 return m_pDataAcc->IsChoiceListAllowTextEntry() && | 391 return m_pDataAcc->IsChoiceListAllowTextEntry() && |
| 392 ((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo(); | 392 ((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo(); |
| 393 } | 393 } |
| 394 FX_BOOL CXFA_FFComboBox::CanRedo() { | 394 FX_BOOL CXFA_FFComboBox::CanRedo() { |
| 395 return m_pDataAcc->IsChoiceListAllowTextEntry() && | 395 return m_pDataAcc->IsChoiceListAllowTextEntry() && |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 break; | 522 break; |
| 523 } | 523 } |
| 524 default: {} | 524 default: {} |
| 525 } | 525 } |
| 526 return m_pOldDelegate->OnProcessEvent(pEvent); | 526 return m_pOldDelegate->OnProcessEvent(pEvent); |
| 527 } | 527 } |
| 528 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 528 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
| 529 const CFX_Matrix* pMatrix) { | 529 const CFX_Matrix* pMatrix) { |
| 530 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 530 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
| 531 } | 531 } |
| OLD | NEW |