| OLD | NEW |
| 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 Loading... |
| 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 IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr); | 147 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetCurrentDelegate()) |
| 148 if (pDelegate) { | |
| 149 pDelegate->OnProcessMessage(&ms); | 148 pDelegate->OnProcessMessage(&ms); |
| 150 } | |
| 151 } | 149 } |
| 152 if (pFocus) { | 150 if (pFocus) { |
| 153 IFWL_Widget* pWidget = | 151 IFWL_Widget* pWidget = |
| 154 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); | 152 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); |
| 155 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); | 153 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); |
| 156 if (pForm) | 154 if (pForm) |
| 157 pForm->SetSubFocus(pFocus); | 155 pForm->SetSubFocus(pFocus); |
| 158 | 156 |
| 159 CFWL_MsgSetFocus ms; | 157 CFWL_MsgSetFocus ms; |
| 160 ms.m_pDstTarget = pFocus; | 158 ms.m_pDstTarget = pFocus; |
| 161 if (bNotify) { | 159 if (bNotify) { |
| 162 ms.m_dwExtend = 1; | 160 ms.m_dwExtend = 1; |
| 163 } | 161 } |
| 164 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr); | 162 |
| 165 if (pDelegate) { | 163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetCurrentDelegate()) |
| 166 pDelegate->OnProcessMessage(&ms); | 164 pDelegate->OnProcessMessage(&ms); |
| 167 } | |
| 168 } | 165 } |
| 169 return TRUE; | 166 return TRUE; |
| 170 } | 167 } |
| 171 FWL_Error CFWL_NoteDriver::Run() { | 168 FWL_Error CFWL_NoteDriver::Run() { |
| 172 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
| 173 _FX_OS_ == _FX_WIN64_) | 170 _FX_OS_ == _FX_WIN64_) |
| 174 CFWL_NoteLoop* pTopLoop = nullptr; | 171 CFWL_NoteLoop* pTopLoop = nullptr; |
| 175 for (;;) { | 172 for (;;) { |
| 176 pTopLoop = GetTopLoop(); | 173 pTopLoop = GetTopLoop(); |
| 177 if (!pTopLoop || !pTopLoop->ContinueModal()) | 174 if (!pTopLoop || !pTopLoop->ContinueModal()) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 bRet = | 353 bRet = |
| 357 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); | 354 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); |
| 358 break; | 355 break; |
| 359 } | 356 } |
| 360 default: { | 357 default: { |
| 361 bRet = TRUE; | 358 bRet = TRUE; |
| 362 break; | 359 break; |
| 363 } | 360 } |
| 364 } | 361 } |
| 365 if (bRet) { | 362 if (bRet) { |
| 366 IFWL_WidgetDelegate* pDelegate = | 363 if (IFWL_WidgetDelegate* pDelegate = |
| 367 pMessage->m_pDstTarget->SetDelegate(nullptr); | 364 pMessage->m_pDstTarget->GetCurrentDelegate()) { |
| 368 if (pDelegate) | |
| 369 pDelegate->OnProcessMessage(pMessage); | 365 pDelegate->OnProcessMessage(pMessage); |
| 366 } |
| 370 } | 367 } |
| 371 return bRet; | 368 return bRet; |
| 372 } | 369 } |
| 373 | 370 |
| 374 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, | 371 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, |
| 375 IFWL_Widget* pMessageForm) { | 372 IFWL_Widget* pMessageForm) { |
| 376 pMsg->m_pDstTarget = pMessageForm; | 373 pMsg->m_pDstTarget = pMessageForm; |
| 377 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); | 374 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); |
| 378 } | 375 } |
| 379 | 376 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 700 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
| 704 uint32_t dwFilter) { | 701 uint32_t dwFilter) { |
| 705 if (pSource) { | 702 if (pSource) { |
| 706 m_eventSources.SetAt(pSource, dwFilter); | 703 m_eventSources.SetAt(pSource, dwFilter); |
| 707 return m_eventSources.GetCount(); | 704 return m_eventSources.GetCount(); |
| 708 } | 705 } |
| 709 return 1; | 706 return 1; |
| 710 } | 707 } |
| 711 | 708 |
| 712 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { | 709 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { |
| 713 IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(nullptr); | 710 IFWL_WidgetDelegate* pDelegate = m_pListener->GetCurrentDelegate(); |
| 714 if (!pDelegate) | 711 if (!pDelegate) |
| 715 return FALSE; | 712 return FALSE; |
| 716 if (m_eventSources.GetCount() == 0) { | 713 if (m_eventSources.GetCount() == 0) { |
| 717 pDelegate->OnProcessEvent(pEvent); | 714 pDelegate->OnProcessEvent(pEvent); |
| 718 return TRUE; | 715 return TRUE; |
| 719 } | 716 } |
| 720 FX_POSITION pos = m_eventSources.GetStartPosition(); | 717 FX_POSITION pos = m_eventSources.GetStartPosition(); |
| 721 while (pos) { | 718 while (pos) { |
| 722 IFWL_Widget* pSource = nullptr; | 719 IFWL_Widget* pSource = nullptr; |
| 723 uint32_t dwFilter = 0; | 720 uint32_t dwFilter = 0; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 if (!s_pInstance) | 775 if (!s_pInstance) |
| 779 s_pInstance = new CFWL_ToolTipContainer; | 776 s_pInstance = new CFWL_ToolTipContainer; |
| 780 return s_pInstance; | 777 return s_pInstance; |
| 781 } | 778 } |
| 782 | 779 |
| 783 // static | 780 // static |
| 784 void CFWL_ToolTipContainer::DeleteInstance() { | 781 void CFWL_ToolTipContainer::DeleteInstance() { |
| 785 delete s_pInstance; | 782 delete s_pInstance; |
| 786 s_pInstance = nullptr; | 783 s_pInstance = nullptr; |
| 787 } | 784 } |
| OLD | NEW |