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

Side by Side Diff: xfa/fxfa/app/xfa_ffcheckbutton.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_ffcheckbutton.h" 7 #include "xfa/fxfa/app/xfa_ffcheckbutton.h"
8 8
9 #include "xfa/fwl/core/cfwl_checkbox.h" 9 #include "xfa/fwl/core/cfwl_checkbox.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
11 #include "xfa/fwl/core/cfwl_widgetmgr.h" 11 #include "xfa/fwl/core/cfwl_widgetmgr.h"
12 #include "xfa/fwl/core/fwl_noteimp.h" 12 #include "xfa/fwl/core/fwl_noteimp.h"
13 #include "xfa/fxfa/app/xfa_ffexclgroup.h" 13 #include "xfa/fxfa/app/xfa_ffexclgroup.h"
14 #include "xfa/fxfa/app/xfa_fffield.h" 14 #include "xfa/fxfa/app/xfa_fffield.h"
15 #include "xfa/fxfa/xfa_ffapp.h" 15 #include "xfa/fxfa/xfa_ffapp.h"
16 #include "xfa/fxfa/xfa_ffdoc.h" 16 #include "xfa/fxfa/xfa_ffdoc.h"
17 #include "xfa/fxfa/xfa_ffdocview.h" 17 #include "xfa/fxfa/xfa_ffdocview.h"
18 #include "xfa/fxfa/xfa_ffpageview.h" 18 #include "xfa/fxfa/xfa_ffpageview.h"
19 #include "xfa/fxfa/xfa_ffwidget.h" 19 #include "xfa/fxfa/xfa_ffwidget.h"
20 20
21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, 21 CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView,
22 CXFA_WidgetAcc* pDataAcc) 22 CXFA_WidgetAcc* pDataAcc)
23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) { 23 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {
24 m_rtCheckBox.Set(0, 0, 0, 0); 24 m_rtCheckBox.Set(0, 0, 0, 0);
25 } 25 }
26
26 CXFA_FFCheckButton::~CXFA_FFCheckButton() {} 27 CXFA_FFCheckButton::~CXFA_FFCheckButton() {}
28
27 FX_BOOL CXFA_FFCheckButton::LoadWidget() { 29 FX_BOOL CXFA_FFCheckButton::LoadWidget() {
28 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox; 30 CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp());
29 pCheckBox->Initialize(); 31 pCheckBox->Initialize(nullptr);
30 m_pNormalWidget = pCheckBox; 32 m_pNormalWidget = pCheckBox;
31 m_pNormalWidget->SetLayoutItem(this); 33 m_pNormalWidget->SetLayoutItem(this);
34
32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 35 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 36 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
34 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 37 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
35 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 38 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
36 if (m_pDataAcc->IsRadioButton()) { 39 if (m_pDataAcc->IsRadioButton()) {
37 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF); 40 pCheckBox->ModifyStylesEx(FWL_STYLEEXT_CKB_RadioButton, 0xFFFFFFFF);
38 } 41 }
39 m_pNormalWidget->LockUpdate(); 42 m_pNormalWidget->LockUpdate();
40 UpdateWidgetProperty(); 43 UpdateWidgetProperty();
41 SetFWLCheckState(m_pDataAcc->GetCheckState()); 44 SetFWLCheckState(m_pDataAcc->GetCheckState());
42 m_pNormalWidget->UnlockUpdate(); 45 m_pNormalWidget->UnlockUpdate();
43 return CXFA_FFField::LoadWidget(); 46 return CXFA_FFField::LoadWidget();
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 default: 328 default:
326 break; 329 break;
327 } 330 }
328 m_pOldDelegate->OnProcessEvent(pEvent); 331 m_pOldDelegate->OnProcessEvent(pEvent);
329 } 332 }
330 333
331 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, 334 void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics,
332 const CFX_Matrix* pMatrix) { 335 const CFX_Matrix* pMatrix) {
333 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 336 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
334 } 337 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698