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

Side by Side Diff: xfa/fwl/core/fwl_noteimp.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/fwl/core/cfwl_widgetmgr.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fwl/core/fwl_noteimp.h" 7 #include "xfa/fwl/core/fwl_noteimp.h"
8 8
9 #include "core/fxcrt/fx_ext.h" 9 #include "core/fxcrt/fx_ext.h"
10 #include "third_party/base/stl_util.h" 10 #include "third_party/base/stl_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 IFWL_Widget* pPrev = m_pFocus; 138 IFWL_Widget* pPrev = m_pFocus;
139 m_pFocus = pFocus; 139 m_pFocus = pFocus;
140 if (pPrev) { 140 if (pPrev) {
141 CFWL_MsgKillFocus ms; 141 CFWL_MsgKillFocus ms;
142 ms.m_pDstTarget = pPrev; 142 ms.m_pDstTarget = pPrev;
143 ms.m_pSrcTarget = pPrev; 143 ms.m_pSrcTarget = pPrev;
144 if (bNotify) { 144 if (bNotify) {
145 ms.m_dwExtend = 1; 145 ms.m_dwExtend = 1;
146 } 146 }
147 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetCurrentDelegate()) 147 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate())
148 pDelegate->OnProcessMessage(&ms); 148 pDelegate->OnProcessMessage(&ms);
149 } 149 }
150 if (pFocus) { 150 if (pFocus) {
151 IFWL_Widget* pWidget = 151 IFWL_Widget* pWidget =
152 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); 152 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus);
153 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 153 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
154 if (pForm) 154 if (pForm)
155 pForm->SetSubFocus(pFocus); 155 pForm->SetSubFocus(pFocus);
156 156
157 CFWL_MsgSetFocus ms; 157 CFWL_MsgSetFocus ms;
158 ms.m_pDstTarget = pFocus; 158 ms.m_pDstTarget = pFocus;
159 if (bNotify) { 159 if (bNotify) {
160 ms.m_dwExtend = 1; 160 ms.m_dwExtend = 1;
161 } 161 }
162 162
163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetCurrentDelegate()) 163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate())
164 pDelegate->OnProcessMessage(&ms); 164 pDelegate->OnProcessMessage(&ms);
165 } 165 }
166 return TRUE; 166 return TRUE;
167 } 167 }
168 FWL_Error CFWL_NoteDriver::Run() { 168 FWL_Error CFWL_NoteDriver::Run() {
169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ 169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
170 _FX_OS_ == _FX_WIN64_) 170 _FX_OS_ == _FX_WIN64_)
171 CFWL_NoteLoop* pTopLoop = nullptr; 171 CFWL_NoteLoop* pTopLoop = nullptr;
172 for (;;) { 172 for (;;) {
173 pTopLoop = GetTopLoop(); 173 pTopLoop = GetTopLoop();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); 354 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm);
355 break; 355 break;
356 } 356 }
357 default: { 357 default: {
358 bRet = TRUE; 358 bRet = TRUE;
359 break; 359 break;
360 } 360 }
361 } 361 }
362 if (bRet) { 362 if (bRet) {
363 if (IFWL_WidgetDelegate* pDelegate = 363 if (IFWL_WidgetDelegate* pDelegate =
364 pMessage->m_pDstTarget->GetCurrentDelegate()) { 364 pMessage->m_pDstTarget->GetDelegate()) {
365 pDelegate->OnProcessMessage(pMessage); 365 pDelegate->OnProcessMessage(pMessage);
366 } 366 }
367 } 367 }
368 return bRet; 368 return bRet;
369 } 369 }
370 370
371 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, 371 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg,
372 IFWL_Widget* pMessageForm) { 372 IFWL_Widget* pMessageForm) {
373 pMsg->m_pDstTarget = pMessageForm; 373 pMsg->m_pDstTarget = pMessageForm;
374 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); 374 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, 700 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource,
701 uint32_t dwFilter) { 701 uint32_t dwFilter) {
702 if (pSource) { 702 if (pSource) {
703 m_eventSources.SetAt(pSource, dwFilter); 703 m_eventSources.SetAt(pSource, dwFilter);
704 return m_eventSources.GetCount(); 704 return m_eventSources.GetCount();
705 } 705 }
706 return 1; 706 return 1;
707 } 707 }
708 708
709 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { 709 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
710 IFWL_WidgetDelegate* pDelegate = m_pListener->GetCurrentDelegate(); 710 IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate();
711 if (!pDelegate) 711 if (!pDelegate)
712 return FALSE; 712 return FALSE;
713 if (m_eventSources.GetCount() == 0) { 713 if (m_eventSources.GetCount() == 0) {
714 pDelegate->OnProcessEvent(pEvent); 714 pDelegate->OnProcessEvent(pEvent);
715 return TRUE; 715 return TRUE;
716 } 716 }
717 FX_POSITION pos = m_eventSources.GetStartPosition(); 717 FX_POSITION pos = m_eventSources.GetStartPosition();
718 while (pos) { 718 while (pos) {
719 IFWL_Widget* pSource = nullptr; 719 IFWL_Widget* pSource = nullptr;
720 uint32_t dwFilter = 0; 720 uint32_t dwFilter = 0;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (!s_pInstance) 769 if (!s_pInstance)
770 s_pInstance = new CFWL_ToolTipContainer; 770 s_pInstance = new CFWL_ToolTipContainer;
771 return s_pInstance; 771 return s_pInstance;
772 } 772 }
773 773
774 // static 774 // static
775 void CFWL_ToolTipContainer::DeleteInstance() { 775 void CFWL_ToolTipContainer::DeleteInstance() {
776 delete s_pInstance; 776 delete s_pInstance;
777 s_pInstance = nullptr; 777 s_pInstance = nullptr;
778 } 778 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_widgetmgr.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698