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 25 matching lines...) Expand all Loading... |
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 | 45 |
46 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 46 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
47 m_pNormalWidget->SetCurrentDelegate(this); | 47 m_pNormalWidget->SetDelegate(this); |
48 m_pNormalWidget->LockUpdate(); | 48 m_pNormalWidget->LockUpdate(); |
49 | 49 |
50 CFX_WideStringArray wsLabelArray; | 50 CFX_WideStringArray wsLabelArray; |
51 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 51 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
52 int32_t iItems = wsLabelArray.GetSize(); | 52 int32_t iItems = wsLabelArray.GetSize(); |
53 for (int32_t i = 0; i < iItems; i++) { | 53 for (int32_t i = 0; i < iItems; i++) { |
54 pListBox->AddString(wsLabelArray[i].AsStringC()); | 54 pListBox->AddString(wsLabelArray[i].AsStringC()); |
55 } | 55 } |
56 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; | 56 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; |
57 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { | 57 if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 FX_BOOL CXFA_FFComboBox::LoadWidget() { | 235 FX_BOOL CXFA_FFComboBox::LoadWidget() { |
236 CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); | 236 CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); |
237 pComboBox->Initialize(); | 237 pComboBox->Initialize(); |
238 m_pNormalWidget = (CFWL_Widget*)pComboBox; | 238 m_pNormalWidget = (CFWL_Widget*)pComboBox; |
239 m_pNormalWidget->SetLayoutItem(this); | 239 m_pNormalWidget->SetLayoutItem(this); |
240 | 240 |
241 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 241 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
242 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 242 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
243 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 243 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
244 | 244 |
245 m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate(); | 245 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
246 m_pNormalWidget->SetCurrentDelegate(this); | 246 m_pNormalWidget->SetDelegate(this); |
247 m_pNormalWidget->LockUpdate(); | 247 m_pNormalWidget->LockUpdate(); |
248 | 248 |
249 CFX_WideStringArray wsLabelArray; | 249 CFX_WideStringArray wsLabelArray; |
250 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 250 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
251 int32_t iItems = wsLabelArray.GetSize(); | 251 int32_t iItems = wsLabelArray.GetSize(); |
252 for (int32_t i = 0; i < iItems; i++) { | 252 for (int32_t i = 0; i < iItems; i++) { |
253 pComboBox->AddString(wsLabelArray[i].AsStringC()); | 253 pComboBox->AddString(wsLabelArray[i].AsStringC()); |
254 } | 254 } |
255 CFX_Int32Array iSelArray; | 255 CFX_Int32Array iSelArray; |
256 m_pDataAcc->GetSelectedItems(iSelArray); | 256 m_pDataAcc->GetSelectedItems(iSelArray); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 default: | 534 default: |
535 break; | 535 break; |
536 } | 536 } |
537 m_pOldDelegate->OnProcessEvent(pEvent); | 537 m_pOldDelegate->OnProcessEvent(pEvent); |
538 } | 538 } |
539 | 539 |
540 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 540 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
541 const CFX_Matrix* pMatrix) { | 541 const CFX_Matrix* pMatrix) { |
542 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 542 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
543 } | 543 } |
OLD | NEW |