| 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/fwl_noteimp.h" |
| 10 #include "xfa/fwl/core/ifwl_app.h" | 11 #include "xfa/fwl/core/ifwl_app.h" |
| 11 #include "xfa/fwl/core/ifwl_notedriver.h" | |
| 12 #include "xfa/fwl/lightwidget/cfwl_combobox.h" | 12 #include "xfa/fwl/lightwidget/cfwl_combobox.h" |
| 13 #include "xfa/fwl/lightwidget/cfwl_listbox.h" | 13 #include "xfa/fwl/lightwidget/cfwl_listbox.h" |
| 14 #include "xfa/fxfa/app/xfa_fffield.h" | 14 #include "xfa/fxfa/app/xfa_fffield.h" |
| 15 #include "xfa/fxfa/app/xfa_fwladapter.h" | 15 #include "xfa/fxfa/app/xfa_fwladapter.h" |
| 16 #include "xfa/fxfa/include/xfa_ffdoc.h" | 16 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 17 #include "xfa/fxfa/include/xfa_ffdocview.h" | 17 #include "xfa/fxfa/include/xfa_ffdocview.h" |
| 18 #include "xfa/fxfa/include/xfa_ffpageview.h" | 18 #include "xfa/fxfa/include/xfa_ffpageview.h" |
| 19 #include "xfa/fxfa/include/xfa_ffwidget.h" | 19 #include "xfa/fxfa/include/xfa_ffwidget.h" |
| 20 | 20 |
| 21 CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, | 21 CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, |
| 22 CXFA_WidgetAcc* pDataAcc) | 22 CXFA_WidgetAcc* pDataAcc) |
| 23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} | 23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} |
| 24 CXFA_FFListBox::~CXFA_FFListBox() { | 24 CXFA_FFListBox::~CXFA_FFListBox() { |
| 25 if (m_pNormalWidget) { | 25 if (m_pNormalWidget) { |
| 26 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 26 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
| 27 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); | 27 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); |
| 28 pNoteDriver->UnregisterEventTarget(pWidget); | 28 pNoteDriver->UnregisterEventTarget(pWidget); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 FX_BOOL CXFA_FFListBox::LoadWidget() { | 31 FX_BOOL CXFA_FFListBox::LoadWidget() { |
| 32 CFWL_ListBox* pListBox = CFWL_ListBox::Create(); | 32 CFWL_ListBox* pListBox = CFWL_ListBox::Create(); |
| 33 pListBox->Initialize(); | 33 pListBox->Initialize(); |
| 34 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, | 34 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, |
| 35 0xFFFFFFFF); | 35 0xFFFFFFFF); |
| 36 m_pNormalWidget = (CFWL_Widget*)pListBox; | 36 m_pNormalWidget = (CFWL_Widget*)pListBox; |
| 37 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 37 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
| 38 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); | 38 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); |
| 39 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); | 39 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); |
| 40 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 40 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
| 41 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 41 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); |
| 42 m_pNormalWidget->LockUpdate(); | 42 m_pNormalWidget->LockUpdate(); |
| 43 CFX_WideStringArray wsLabelArray; | 43 CFX_WideStringArray wsLabelArray; |
| 44 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 44 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
| 45 int32_t iItems = wsLabelArray.GetSize(); | 45 int32_t iItems = wsLabelArray.GetSize(); |
| 46 for (int32_t i = 0; i < iItems; i++) { | 46 for (int32_t i = 0; i < iItems; i++) { |
| 47 pListBox->AddString(wsLabelArray[i].AsStringC()); | 47 pListBox->AddString(wsLabelArray[i].AsStringC()); |
| 48 } | 48 } |
| 49 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; | 49 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 return TRUE; | 225 return TRUE; |
| 226 } | 226 } |
| 227 return FALSE; | 227 return FALSE; |
| 228 } | 228 } |
| 229 FX_BOOL CXFA_FFComboBox::LoadWidget() { | 229 FX_BOOL CXFA_FFComboBox::LoadWidget() { |
| 230 CFWL_ComboBox* pComboBox = CFWL_ComboBox::Create(); | 230 CFWL_ComboBox* pComboBox = CFWL_ComboBox::Create(); |
| 231 pComboBox->Initialize(); | 231 pComboBox->Initialize(); |
| 232 m_pNormalWidget = (CFWL_Widget*)pComboBox; | 232 m_pNormalWidget = (CFWL_Widget*)pComboBox; |
| 233 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 233 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
| 234 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); | 234 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); |
| 235 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); | 235 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); |
| 236 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 236 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
| 237 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); | 237 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); |
| 238 m_pNormalWidget->LockUpdate(); | 238 m_pNormalWidget->LockUpdate(); |
| 239 CFX_WideStringArray wsLabelArray; | 239 CFX_WideStringArray wsLabelArray; |
| 240 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); | 240 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); |
| 241 int32_t iItems = wsLabelArray.GetSize(); | 241 int32_t iItems = wsLabelArray.GetSize(); |
| 242 for (int32_t i = 0; i < iItems; i++) { | 242 for (int32_t i = 0; i < iItems; i++) { |
| 243 pComboBox->AddString(wsLabelArray[i].AsStringC()); | 243 pComboBox->AddString(wsLabelArray[i].AsStringC()); |
| 244 } | 244 } |
| 245 CFX_Int32Array iSelArray; | 245 CFX_Int32Array iSelArray; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 default: | 524 default: |
| 525 break; | 525 break; |
| 526 } | 526 } |
| 527 return m_pOldDelegate->OnProcessEvent(pEvent); | 527 return m_pOldDelegate->OnProcessEvent(pEvent); |
| 528 } | 528 } |
| 529 | 529 |
| 530 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 530 FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
| 531 const CFX_Matrix* pMatrix) { | 531 const CFX_Matrix* pMatrix) { |
| 532 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 532 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
| 533 } | 533 } |
| OLD | NEW |