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

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

Issue 2466273003: Change IFWL_Widget to store a single delegate. (Closed)
Patch Set: Fix Mac Created 4 years, 1 month 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
« no previous file with comments | « xfa/fxfa/app/cxfa_ffcheckbuttondelegate.h ('k') | xfa/fxfa/app/cxfa_ffcomboboxdelegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "xfa/fxfa/app/cxfa_ffcheckbuttondelegate.h"
8
9 #include "xfa/fxfa/cxfa_eventparam.h"
10 #include "xfa/fxfa/xfa_ffdocview.h"
11 #include "xfa/fxfa/app/xfa_ffcheckbutton.h"
12
13 CXFA_FFCheckButtonDelegate::CXFA_FFCheckButtonDelegate(
14 std::unique_ptr<IFWL_WidgetDelegate> pDelegate,
15 CXFA_FFCheckButton* const pWidget)
16 : CXFA_FFFieldDelegate(std::move(pDelegate), pWidget) {}
17
18 CXFA_FFCheckButtonDelegate::~CXFA_FFCheckButtonDelegate() {}
19
20 void CXFA_FFCheckButtonDelegate::OnProcessMessage(CFWL_Message* pMessage) {
21 m_pDelegate->OnProcessMessage(pMessage);
22 }
23
24 void CXFA_FFCheckButtonDelegate::OnProcessEvent(CFWL_Event* pEvent) {
25 CXFA_FFFieldDelegate::OnProcessEvent(pEvent);
26
27 CXFA_FFCheckButton* widget = static_cast<CXFA_FFCheckButton*>(m_pWidget);
28 switch (pEvent->GetClassID()) {
29 case CFWL_EventType::CheckStateChanged: {
30 CXFA_EventParam eParam;
31 eParam.m_eType = XFA_EVENT_Change;
32 m_pWidget->GetDataAcc()->GetValue(eParam.m_wsNewText,
33 XFA_VALUEPICTURE_Raw);
34 CXFA_WidgetAcc* pFFExclGroup = m_pWidget->GetDataAcc()->GetExclGroup();
35 if (widget->ProcessCommittedData()) {
36 eParam.m_pTarget = pFFExclGroup;
37 if (pFFExclGroup) {
38 m_pWidget->GetDocView()->AddValidateWidget(pFFExclGroup);
39 m_pWidget->GetDocView()->AddCalculateWidgetAcc(pFFExclGroup);
40 pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
41 }
42 eParam.m_pTarget = m_pWidget->GetDataAcc();
43 m_pWidget->GetDataAcc()->ProcessEvent(XFA_ATTRIBUTEENUM_Change,
44 &eParam);
45 } else {
46 widget->SetFWLCheckState(m_pWidget->GetDataAcc()->GetCheckState());
47 }
48
49 if (pFFExclGroup) {
50 eParam.m_pTarget = pFFExclGroup;
51 pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
52 }
53 eParam.m_pTarget = m_pWidget->GetDataAcc();
54 m_pWidget->GetDataAcc()->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
55 break;
56 }
57 default:
58 break;
59 }
60 m_pDelegate->OnProcessEvent(pEvent);
61 }
62
63 void CXFA_FFCheckButtonDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
64 const CFX_Matrix* pMatrix) {
65 m_pDelegate->OnDrawWidget(pGraphics, pMatrix);
66 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/cxfa_ffcheckbuttondelegate.h ('k') | xfa/fxfa/app/cxfa_ffcomboboxdelegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698