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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/cxfa_ffcheckbuttondelegate.cpp
diff --git a/xfa/fxfa/app/cxfa_ffcheckbuttondelegate.cpp b/xfa/fxfa/app/cxfa_ffcheckbuttondelegate.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..24faee605e29e2348da6cffa45b6115c30e947e7
--- /dev/null
+++ b/xfa/fxfa/app/cxfa_ffcheckbuttondelegate.cpp
@@ -0,0 +1,66 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/app/cxfa_ffcheckbuttondelegate.h"
+
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/xfa_ffdocview.h"
+#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
+
+CXFA_FFCheckButtonDelegate::CXFA_FFCheckButtonDelegate(
+ std::unique_ptr<IFWL_WidgetDelegate> pDelegate,
+ CXFA_FFCheckButton* const pWidget)
+ : CXFA_FFFieldDelegate(std::move(pDelegate), pWidget) {}
+
+CXFA_FFCheckButtonDelegate::~CXFA_FFCheckButtonDelegate() {}
+
+void CXFA_FFCheckButtonDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ m_pDelegate->OnProcessMessage(pMessage);
+}
+
+void CXFA_FFCheckButtonDelegate::OnProcessEvent(CFWL_Event* pEvent) {
+ CXFA_FFFieldDelegate::OnProcessEvent(pEvent);
+
+ CXFA_FFCheckButton* widget = static_cast<CXFA_FFCheckButton*>(m_pWidget);
+ switch (pEvent->GetClassID()) {
+ case CFWL_EventType::CheckStateChanged: {
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Change;
+ m_pWidget->GetDataAcc()->GetValue(eParam.m_wsNewText,
+ XFA_VALUEPICTURE_Raw);
+ CXFA_WidgetAcc* pFFExclGroup = m_pWidget->GetDataAcc()->GetExclGroup();
+ if (widget->ProcessCommittedData()) {
+ eParam.m_pTarget = pFFExclGroup;
+ if (pFFExclGroup) {
+ m_pWidget->GetDocView()->AddValidateWidget(pFFExclGroup);
+ m_pWidget->GetDocView()->AddCalculateWidgetAcc(pFFExclGroup);
+ pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
+ }
+ eParam.m_pTarget = m_pWidget->GetDataAcc();
+ m_pWidget->GetDataAcc()->ProcessEvent(XFA_ATTRIBUTEENUM_Change,
+ &eParam);
+ } else {
+ widget->SetFWLCheckState(m_pWidget->GetDataAcc()->GetCheckState());
+ }
+
+ if (pFFExclGroup) {
+ eParam.m_pTarget = pFFExclGroup;
+ pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
+ }
+ eParam.m_pTarget = m_pWidget->GetDataAcc();
+ m_pWidget->GetDataAcc()->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
+ break;
+ }
+ default:
+ break;
+ }
+ m_pDelegate->OnProcessEvent(pEvent);
+}
+
+void CXFA_FFCheckButtonDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ m_pDelegate->OnDrawWidget(pGraphics, pMatrix);
+}
« 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