Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: xfa/fxfa/app/xfa_ffchoicelist.cpp

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: fix mac Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "xfa/fwl/core/fwl_noteimp.h" 11 #include "xfa/fwl/core/fwl_noteimp.h"
12 #include "xfa/fwl/core/ifwl_app.h" 12 #include "xfa/fwl/core/ifwl_app.h"
13 #include "xfa/fwl/core/ifwl_edit.h" 13 #include "xfa/fwl/core/ifwl_edit.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/cxfa_eventparam.h" 16 #include "xfa/fxfa/cxfa_eventparam.h"
17 #include "xfa/fxfa/xfa_ffdoc.h" 17 #include "xfa/fxfa/xfa_ffdoc.h"
18 #include "xfa/fxfa/xfa_ffdocview.h" 18 #include "xfa/fxfa/xfa_ffdocview.h"
19 #include "xfa/fxfa/xfa_ffpageview.h" 19 #include "xfa/fxfa/xfa_ffpageview.h"
20 #include "xfa/fxfa/xfa_ffwidget.h" 20 #include "xfa/fxfa/xfa_ffwidget.h"
21 21
22 CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, 22 CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView,
23 CXFA_WidgetAcc* pDataAcc) 23 CXFA_WidgetAcc* pDataAcc)
24 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {} 24 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
25
25 CXFA_FFListBox::~CXFA_FFListBox() { 26 CXFA_FFListBox::~CXFA_FFListBox() {
26 if (m_pNormalWidget) { 27 if (m_pNormalWidget) {
27 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 28 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
28 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 29 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
29 pNoteDriver->UnregisterEventTarget(pWidget); 30 pNoteDriver->UnregisterEventTarget(pWidget);
30 } 31 }
31 } 32 }
33
32 FX_BOOL CXFA_FFListBox::LoadWidget() { 34 FX_BOOL CXFA_FFListBox::LoadWidget() {
33 CFWL_ListBox* pListBox = new CFWL_ListBox; 35 CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp());
34 pListBox->Initialize(); 36 pListBox->Initialize(nullptr);
35 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, 37 pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
36 0xFFFFFFFF); 38 0xFFFFFFFF);
37 m_pNormalWidget = (CFWL_Widget*)pListBox; 39 m_pNormalWidget = (CFWL_Widget*)pListBox;
38 m_pNormalWidget->SetLayoutItem(this); 40 m_pNormalWidget->SetLayoutItem(this);
41
39 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 42 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
40 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 43 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
41 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 44 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
42 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
43 m_pNormalWidget->LockUpdate(); 46 m_pNormalWidget->LockUpdate();
44 CFX_WideStringArray wsLabelArray; 47 CFX_WideStringArray wsLabelArray;
45 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); 48 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
46 int32_t iItems = wsLabelArray.GetSize(); 49 int32_t iItems = wsLabelArray.GetSize();
47 for (int32_t i = 0; i < iItems; i++) { 50 for (int32_t i = 0; i < iItems; i++) {
48 pListBox->AddString(wsLabelArray[i].AsStringC()); 51 pListBox->AddString(wsLabelArray[i].AsStringC());
49 } 52 }
50 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; 53 uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return FALSE; 223 return FALSE;
221 } 224 }
222 CFX_RectF rtWidget; 225 CFX_RectF rtWidget;
223 ((CFWL_ComboBox*)m_pNormalWidget)->GetBBox(rtWidget); 226 ((CFWL_ComboBox*)m_pNormalWidget)->GetBBox(rtWidget);
224 if (rtWidget.Contains(fx, fy)) { 227 if (rtWidget.Contains(fx, fy)) {
225 return TRUE; 228 return TRUE;
226 } 229 }
227 return FALSE; 230 return FALSE;
228 } 231 }
229 FX_BOOL CXFA_FFComboBox::LoadWidget() { 232 FX_BOOL CXFA_FFComboBox::LoadWidget() {
230 CFWL_ComboBox* pComboBox = new CFWL_ComboBox; 233 CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp());
231 pComboBox->Initialize(); 234 pComboBox->Initialize(nullptr);
232 m_pNormalWidget = (CFWL_Widget*)pComboBox; 235 m_pNormalWidget = (CFWL_Widget*)pComboBox;
233 m_pNormalWidget->SetLayoutItem(this); 236 m_pNormalWidget->SetLayoutItem(this);
237
234 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 238 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
235 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 239 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
236 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 240 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
237 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 241 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
238 m_pNormalWidget->LockUpdate(); 242 m_pNormalWidget->LockUpdate();
239 CFX_WideStringArray wsLabelArray; 243 CFX_WideStringArray wsLabelArray;
240 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); 244 m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
241 int32_t iItems = wsLabelArray.GetSize(); 245 int32_t iItems = wsLabelArray.GetSize();
242 for (int32_t i = 0; i < iItems; i++) { 246 for (int32_t i = 0; i < iItems; i++) {
243 pComboBox->AddString(wsLabelArray[i].AsStringC()); 247 pComboBox->AddString(wsLabelArray[i].AsStringC());
244 } 248 }
245 CFX_Int32Array iSelArray; 249 CFX_Int32Array iSelArray;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 default: 528 default:
525 break; 529 break;
526 } 530 }
527 m_pOldDelegate->OnProcessEvent(pEvent); 531 m_pOldDelegate->OnProcessEvent(pEvent);
528 } 532 }
529 533
530 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, 534 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics,
531 const CFX_Matrix* pMatrix) { 535 const CFX_Matrix* pMatrix) {
532 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 536 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
533 } 537 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698