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/core/cfwl_combobox.h" | 9 #include "xfa/fwl/core/cfwl_combobox.h" |
10 #include "xfa/fwl/core/cfwl_listbox.h" | 10 #include "xfa/fwl/core/cfwl_listbox.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp()); | 35 CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp()); |
36 pListBox->Initialize(); | 36 pListBox->Initialize(); |
37 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, | 37 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, |
38 0xFFFFFFFF); | 38 0xFFFFFFFF); |
39 m_pNormalWidget = (CFWL_Widget*)pListBox; | 39 m_pNormalWidget = (CFWL_Widget*)pListBox; |
40 m_pNormalWidget->SetLayoutItem(this); | 40 m_pNormalWidget->SetLayoutItem(this); |
41 | 41 |
42 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 42 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
43 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 43 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
44 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 44 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 45 |
| 46 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); |
| 47 m_pNormalWidget->SetCurrentDelegate(this); |
46 m_pNormalWidget->LockUpdate(); | 48 m_pNormalWidget->LockUpdate(); |
| 49 |
47 CFX_WideStringArray wsLabelArray; | 50 CFX_WideStringArray wsLabelArray; |
48 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 51 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
49 int32_t iItems = wsLabelArray.GetSize(); | 52 int32_t iItems = wsLabelArray.GetSize(); |
50 for (int32_t i = 0; i < iItems; i++) { | 53 for (int32_t i = 0; i < iItems; i++) { |
51 pListBox->AddString(wsLabelArray[i].AsStringC()); | 54 pListBox->AddString(wsLabelArray[i].AsStringC()); |
52 } | 55 } |
53 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; | 56 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; |
54 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { | 57 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { |
55 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; | 58 dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; |
56 } | 59 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 234 } |
232 FX_BOOL CXFA_FFComboBox::LoadWidget() { | 235 FX_BOOL CXFA_FFComboBox::LoadWidget() { |
233 CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); | 236 CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); |
234 pComboBox->Initialize(); | 237 pComboBox->Initialize(); |
235 m_pNormalWidget = (CFWL_Widget*)pComboBox; | 238 m_pNormalWidget = (CFWL_Widget*)pComboBox; |
236 m_pNormalWidget->SetLayoutItem(this); | 239 m_pNormalWidget->SetLayoutItem(this); |
237 | 240 |
238 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 241 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
239 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 242 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
240 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 243 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
241 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 244 |
| 245 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); |
| 246 m_pNormalWidget->SetCurrentDelegate(this); |
242 m_pNormalWidget->LockUpdate(); | 247 m_pNormalWidget->LockUpdate(); |
| 248 |
243 CFX_WideStringArray wsLabelArray; | 249 CFX_WideStringArray wsLabelArray; |
244 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 250 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
245 int32_t iItems = wsLabelArray.GetSize(); | 251 int32_t iItems = wsLabelArray.GetSize(); |
246 for (int32_t i = 0; i < iItems; i++) { | 252 for (int32_t i = 0; i < iItems; i++) { |
247 pComboBox->AddString(wsLabelArray[i].AsStringC()); | 253 pComboBox->AddString(wsLabelArray[i].AsStringC()); |
248 } | 254 } |
249 CFX_Int32Array iSelArray; | 255 CFX_Int32Array iSelArray; |
250 m_pDataAcc->GetSelectedItems(iSelArray); | 256 m_pDataAcc->GetSelectedItems(iSelArray); |
251 int32_t iSelCount = iSelArray.GetSize(); | 257 int32_t iSelCount = iSelArray.GetSize(); |
252 if (iSelCount > 0) { | 258 if (iSelCount > 0) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 default: | 534 default: |
529 break; | 535 break; |
530 } | 536 } |
531 m_pOldDelegate->OnProcessEvent(pEvent); | 537 m_pOldDelegate->OnProcessEvent(pEvent); |
532 } | 538 } |
533 | 539 |
534 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 540 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
535 const CFX_Matrix* pMatrix) { | 541 const CFX_Matrix* pMatrix) { |
536 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 542 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
537 } | 543 } |
OLD | NEW |