| 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/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h" | 10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | 27 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) |
| 28 if (count <= 0) { | 28 if (count <= 0) { |
| 29 #endif | 29 #endif |
| 30 CFWL_EvtIdle ev; | 30 CFWL_EvtIdle ev; |
| 31 IFWL_App* pApp = FWL_GetApp(); | 31 IFWL_App* pApp = FWL_GetApp(); |
| 32 if (!pApp) | 32 if (!pApp) |
| 33 return FWL_ERR_Indefinite; | 33 return FWL_ERR_Indefinite; |
| 34 IFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 34 IFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 35 if (!pDriver) | 35 if (!pDriver) |
| 36 return FWL_ERR_Indefinite; | 36 return FWL_ERR_Indefinite; |
| 37 pDriver->SendNote(&ev); | 37 pDriver->SendEvent(&ev); |
| 38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | 38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) |
| 39 } | 39 } |
| 40 #endif | 40 #endif |
| 41 return FWL_ERR_Indefinite; | 41 return FWL_ERR_Indefinite; |
| 42 } | 42 } |
| 43 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { | 43 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { |
| 44 return m_pForm; | 44 return m_pForm; |
| 45 } | 45 } |
| 46 FX_BOOL CFWL_NoteLoop::ContinueModal() { | 46 FX_BOOL CFWL_NoteLoop::ContinueModal() { |
| 47 return m_bContinueModal; | 47 return m_bContinueModal; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 62 } | 62 } |
| 63 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { | 63 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { |
| 64 CFWL_EvtMenuCommand ev; | 64 CFWL_EvtMenuCommand ev; |
| 65 ev.m_iCommand = dwCommand; | 65 ev.m_iCommand = dwCommand; |
| 66 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); | 66 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); |
| 67 if (!pThread) | 67 if (!pThread) |
| 68 return; | 68 return; |
| 69 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); | 69 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); |
| 70 if (!pDriver) | 70 if (!pDriver) |
| 71 return; | 71 return; |
| 72 pDriver->SendNote(&ev); | 72 pDriver->SendEvent(&ev); |
| 73 } | 73 } |
| 74 CFWL_NoteDriver::CFWL_NoteDriver() | 74 CFWL_NoteDriver::CFWL_NoteDriver() |
| 75 : m_sendEventCalled(0), | 75 : m_sendEventCalled(0), |
| 76 m_bFullScreen(FALSE), | 76 m_bFullScreen(FALSE), |
| 77 m_pHover(nullptr), | 77 m_pHover(nullptr), |
| 78 m_pFocus(nullptr), | 78 m_pFocus(nullptr), |
| 79 m_pGrab(nullptr) { | 79 m_pGrab(nullptr) { |
| 80 m_pNoteLoop = new CFWL_NoteLoop; | 80 m_pNoteLoop = new CFWL_NoteLoop; |
| 81 PushNoteLoop(m_pNoteLoop); | 81 PushNoteLoop(m_pNoteLoop); |
| 82 } | 82 } |
| 83 CFWL_NoteDriver::~CFWL_NoteDriver() { | 83 CFWL_NoteDriver::~CFWL_NoteDriver() { |
| 84 delete m_pNoteLoop; | 84 delete m_pNoteLoop; |
| 85 ClearInvalidEventTargets(TRUE); | 85 ClearInvalidEventTargets(TRUE); |
| 86 } | 86 } |
| 87 FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) { | 87 |
| 88 if (pNote->IsEvent()) { | 88 FX_BOOL CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { |
| 89 int32_t iCount = m_eventTargets.GetCount(); | 89 int32_t iCount = m_eventTargets.GetCount(); |
| 90 if (iCount < 1) { | 90 if (iCount < 1) |
| 91 return TRUE; | 91 return TRUE; |
| 92 } | 92 if (CFWL_EventType::Mouse == pNote->GetClassID()) { |
| 93 if (FWL_EVTHASH_Mouse == static_cast<CFWL_Event*>(pNote)->GetClassID()) { | |
| 94 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); | 93 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); |
| 95 if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { | 94 if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { |
| 96 if (m_pNoteLoop->GetForm() && | 95 if (m_pNoteLoop->GetForm() && |
| 97 CFWL_ToolTipContainer::getInstance()->ProcessEnter( | 96 CFWL_ToolTipContainer::getInstance()->ProcessEnter( |
| 98 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { | 97 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { |
| 99 } | 98 } |
| 100 } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { | 99 } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { |
| 101 if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { | 100 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
| 102 } | |
| 103 } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && | 101 } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && |
| 104 (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { | 102 (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { |
| 105 if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { | 103 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
| 106 } | |
| 107 } | 104 } |
| 108 } | 105 } |
| 109 m_sendEventCalled++; | 106 m_sendEventCalled++; |
| 110 FX_POSITION pos = m_eventTargets.GetStartPosition(); | 107 FX_POSITION pos = m_eventTargets.GetStartPosition(); |
| 111 while (pos) { | 108 while (pos) { |
| 112 void* key = NULL; | 109 void* key = NULL; |
| 113 CFWL_EventTarget* pEventTarget; | 110 CFWL_EventTarget* pEventTarget; |
| 114 m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); | 111 m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); |
| 115 if (pEventTarget && !pEventTarget->IsInvalid()) { | 112 if (pEventTarget && !pEventTarget->IsInvalid()) { |
| 116 pEventTarget->ProcessEvent(static_cast<CFWL_Event*>(pNote)); | 113 pEventTarget->ProcessEvent(pNote); |
| 117 } | 114 } |
| 118 } | 115 } |
| 119 m_sendEventCalled--; | 116 m_sendEventCalled--; |
| 120 } else { | 117 return TRUE; |
| 121 if (!pNote->m_pDstTarget) | |
| 122 return FALSE; | |
| 123 IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL); | |
| 124 if (pDelegate) { | |
| 125 pDelegate->OnProcessMessage(static_cast<CFWL_Message*>(pNote)); | |
| 126 } | |
| 127 } | |
| 128 return TRUE; | |
| 129 } | 118 } |
| 130 | 119 |
| 131 #define FWL_NoteDriver_EventKey 1100 | 120 #define FWL_NoteDriver_EventKey 1100 |
| 132 FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, | 121 FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, |
| 133 IFWL_Widget* pEventSource, | 122 IFWL_Widget* pEventSource, |
| 134 uint32_t dwFilter) { | 123 uint32_t dwFilter) { |
| 135 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( | 124 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( |
| 136 (void*)(uintptr_t)FWL_NoteDriver_EventKey); | 125 (void*)(uintptr_t)FWL_NoteDriver_EventKey); |
| 137 if (dwkey == 0) { | 126 if (dwkey == 0) { |
| 138 void* random = FX_Random_MT_Start(0); | 127 void* random = FX_Random_MT_Start(0); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 376 } |
| 388 | 377 |
| 389 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { | 378 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { |
| 390 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 379 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 391 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() | 380 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() |
| 392 ? pMessage->m_pDstTarget | 381 ? pMessage->m_pDstTarget |
| 393 : GetMessageForm(pMessage->m_pDstTarget); | 382 : GetMessageForm(pMessage->m_pDstTarget); |
| 394 if (!pMessageForm) | 383 if (!pMessageForm) |
| 395 return FALSE; | 384 return FALSE; |
| 396 if (DispatchMessage(pMessage, pMessageForm)) { | 385 if (DispatchMessage(pMessage, pMessageForm)) { |
| 397 if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) { | 386 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) |
| 398 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); | 387 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); |
| 399 } | |
| 400 return TRUE; | 388 return TRUE; |
| 401 } | 389 } |
| 402 return FALSE; | 390 return FALSE; |
| 403 } | 391 } |
| 392 |
| 404 FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, | 393 FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, |
| 405 IFWL_Widget* pMessageForm) { | 394 IFWL_Widget* pMessageForm) { |
| 406 FX_BOOL bRet = FALSE; | 395 FX_BOOL bRet = FALSE; |
| 407 switch (pMessage->GetClassID()) { | 396 switch (pMessage->GetClassID()) { |
| 408 case FWL_MSGHASH_Activate: { | 397 case CFWL_MessageType::Activate: { |
| 409 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); | 398 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); |
| 410 break; | 399 break; |
| 411 } | 400 } |
| 412 case FWL_MSGHASH_Deactivate: { | 401 case CFWL_MessageType::Deactivate: { |
| 413 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), | 402 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), |
| 414 pMessageForm); | 403 pMessageForm); |
| 415 break; | 404 break; |
| 416 } | 405 } |
| 417 case FWL_MSGHASH_SetFocus: { | 406 case CFWL_MessageType::SetFocus: { |
| 418 bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm); | 407 bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm); |
| 419 break; | 408 break; |
| 420 } | 409 } |
| 421 case FWL_MSGHASH_KillFocus: { | 410 case CFWL_MessageType::KillFocus: { |
| 422 bRet = | 411 bRet = |
| 423 DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm); | 412 DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm); |
| 424 break; | 413 break; |
| 425 } | 414 } |
| 426 case FWL_MSGHASH_Key: { | 415 case CFWL_MessageType::Key: { |
| 427 bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm); | 416 bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm); |
| 428 break; | 417 break; |
| 429 } | 418 } |
| 430 case FWL_MSGHASH_Mouse: { | 419 case CFWL_MessageType::Mouse: { |
| 431 bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm); | 420 bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm); |
| 432 break; | 421 break; |
| 433 } | 422 } |
| 434 case FWL_MSGHASH_MouseWheel: { | 423 case CFWL_MessageType::MouseWheel: { |
| 435 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); | 424 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); |
| 436 break; | 425 break; |
| 437 } | 426 } |
| 438 case FWL_MSGHASH_Size: { | 427 case CFWL_MessageType::Size: { |
| 439 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); | 428 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); |
| 440 break; | 429 break; |
| 441 } | 430 } |
| 442 case FWL_MSGHASH_Cursor: { | 431 case CFWL_MessageType::Cursor: { |
| 443 bRet = TRUE; | 432 bRet = TRUE; |
| 444 break; | 433 break; |
| 445 } | 434 } |
| 446 case FWL_MSGHASH_WindowMove: { | 435 case CFWL_MessageType::WindowMove: { |
| 447 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), | 436 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), |
| 448 pMessageForm); | 437 pMessageForm); |
| 449 break; | 438 break; |
| 450 } | 439 } |
| 451 case FWL_MSGHASH_DropFiles: { | 440 case CFWL_MessageType::DropFiles: { |
| 452 bRet = | 441 bRet = |
| 453 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); | 442 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); |
| 454 break; | 443 break; |
| 455 } | 444 } |
| 456 default: { | 445 default: { |
| 457 bRet = TRUE; | 446 bRet = TRUE; |
| 458 break; | 447 break; |
| 459 } | 448 } |
| 460 } | 449 } |
| 461 if (bRet) { | 450 if (bRet) { |
| 462 IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); | 451 IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); |
| 463 if (pDelegate) { | 452 if (pDelegate) |
| 464 pDelegate->OnProcessMessage(pMessage); | 453 pDelegate->OnProcessMessage(pMessage); |
| 465 } | |
| 466 } | 454 } |
| 467 return bRet; | 455 return bRet; |
| 468 } | 456 } |
| 457 |
| 469 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, | 458 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, |
| 470 IFWL_Widget* pMessageForm) { | 459 IFWL_Widget* pMessageForm) { |
| 471 if (m_bFullScreen) { | 460 if (m_bFullScreen) { |
| 472 return FALSE; | 461 return FALSE; |
| 473 } | 462 } |
| 474 pMsg->m_pDstTarget = pMessageForm; | 463 pMsg->m_pDstTarget = pMessageForm; |
| 475 return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; | 464 return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; |
| 476 } | 465 } |
| 477 FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, | 466 FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, |
| 478 IFWL_Widget* pMessageForm) { | 467 IFWL_Widget* pMessageForm) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 m_pHover = pTarget; | 678 m_pHover = pTarget; |
| 690 CFWL_MsgMouse msHover; | 679 CFWL_MsgMouse msHover; |
| 691 msHover.m_pDstTarget = pTarget; | 680 msHover.m_pDstTarget = pTarget; |
| 692 msHover.m_fx = pMsg->m_fx; | 681 msHover.m_fx = pMsg->m_fx; |
| 693 msHover.m_fy = pMsg->m_fy; | 682 msHover.m_fy = pMsg->m_fy; |
| 694 msHover.m_dwFlags = 0; | 683 msHover.m_dwFlags = 0; |
| 695 msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; | 684 msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; |
| 696 DispatchMessage(&msHover, NULL); | 685 DispatchMessage(&msHover, NULL); |
| 697 } | 686 } |
| 698 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { | 687 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { |
| 699 if (pMessage->GetClassID() == FWL_MSGHASH_Post) { | 688 if (pMessage->GetClassID() == CFWL_MessageType::Post) |
| 700 return TRUE; | 689 return TRUE; |
| 701 } | 690 |
| 702 int32_t iCount = m_noteLoopQueue.GetSize(); | 691 int32_t iCount = m_noteLoopQueue.GetSize(); |
| 703 for (int32_t i = 0; i < iCount; i++) { | 692 for (int32_t i = 0; i < iCount; i++) { |
| 704 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); | 693 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); |
| 705 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); | 694 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); |
| 706 if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) { | 695 if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) |
| 707 return TRUE; | 696 return TRUE; |
| 708 } | |
| 709 } | 697 } |
| 710 iCount = m_forms.GetSize(); | 698 iCount = m_forms.GetSize(); |
| 711 for (int32_t j = 0; j < iCount; j++) { | 699 for (int32_t j = 0; j < iCount; j++) { |
| 712 CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]); | 700 CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]); |
| 713 if (pForm->GetInterface() == pMessage->m_pDstTarget) { | 701 if (pForm->GetInterface() == pMessage->m_pDstTarget) |
| 714 return TRUE; | 702 return TRUE; |
| 715 } | |
| 716 } | 703 } |
| 717 return FALSE; | 704 return FALSE; |
| 718 } | 705 } |
| 706 |
| 719 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { | 707 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { |
| 720 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); | 708 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); |
| 721 if (iTrackLoop <= 0) | 709 if (iTrackLoop <= 0) |
| 722 return NULL; | 710 return NULL; |
| 723 IFWL_Widget* pMessageForm = NULL; | 711 IFWL_Widget* pMessageForm = NULL; |
| 724 if (iTrackLoop > 1) { | 712 if (iTrackLoop > 1) { |
| 725 CFWL_NoteLoop* pNootLoop = | 713 CFWL_NoteLoop* pNootLoop = |
| 726 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); | 714 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); |
| 727 pMessageForm = pNootLoop->GetForm()->GetInterface(); | 715 pMessageForm = pNootLoop->GetForm()->GetInterface(); |
| 728 } else { | 716 } else { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 m_eventSources.RemoveAll(); | 782 m_eventSources.RemoveAll(); |
| 795 } | 783 } |
| 796 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 784 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
| 797 uint32_t dwFilter) { | 785 uint32_t dwFilter) { |
| 798 if (pSource) { | 786 if (pSource) { |
| 799 m_eventSources.SetAt(pSource, dwFilter); | 787 m_eventSources.SetAt(pSource, dwFilter); |
| 800 return m_eventSources.GetCount(); | 788 return m_eventSources.GetCount(); |
| 801 } | 789 } |
| 802 return 1; | 790 return 1; |
| 803 } | 791 } |
| 792 |
| 804 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { | 793 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { |
| 805 IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); | 794 IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); |
| 806 if (!pDelegate) | 795 if (!pDelegate) |
| 807 return FALSE; | 796 return FALSE; |
| 808 if (m_eventSources.GetCount() == 0) { | 797 if (m_eventSources.GetCount() == 0) { |
| 809 pDelegate->OnProcessEvent(pEvent); | 798 pDelegate->OnProcessEvent(pEvent); |
| 810 return TRUE; | 799 return TRUE; |
| 811 } | 800 } |
| 812 FX_POSITION pos = m_eventSources.GetStartPosition(); | 801 FX_POSITION pos = m_eventSources.GetStartPosition(); |
| 813 while (pos) { | 802 while (pos) { |
| 814 IFWL_Widget* pSource = NULL; | 803 IFWL_Widget* pSource = NULL; |
| 815 uint32_t dwFilter = 0; | 804 uint32_t dwFilter = 0; |
| 816 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); | 805 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); |
| 817 if (pSource == pEvent->m_pSrcTarget || | 806 if (pSource == pEvent->m_pSrcTarget || |
| 818 pEvent->GetClassID() == FWL_EVTHASH_Idle) { | 807 pEvent->GetClassID() == CFWL_EventType::Idle) { |
| 819 if (IsFilterEvent(pEvent, dwFilter)) { | 808 if (IsFilterEvent(pEvent, dwFilter)) { |
| 820 pDelegate->OnProcessEvent(pEvent); | 809 pDelegate->OnProcessEvent(pEvent); |
| 821 return TRUE; | 810 return TRUE; |
| 822 } | 811 } |
| 823 } | 812 } |
| 824 } | 813 } |
| 825 return FALSE; | 814 return FALSE; |
| 826 } | 815 } |
| 816 |
| 827 FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { | 817 FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { |
| 828 if (dwFilter == FWL_EVENT_ALL_MASK) { | 818 if (dwFilter == FWL_EVENT_ALL_MASK) |
| 829 return TRUE; | 819 return TRUE; |
| 830 } | 820 |
| 831 FX_BOOL bRet = FALSE; | 821 FX_BOOL bRet = FALSE; |
| 832 switch (pEvent->GetClassID()) { | 822 switch (pEvent->GetClassID()) { |
| 833 case FWL_EVTHASH_Mouse: { | 823 case CFWL_EventType::Mouse: { |
| 834 bRet = dwFilter & FWL_EVENT_MOUSE_MASK; | 824 bRet = dwFilter & FWL_EVENT_MOUSE_MASK; |
| 835 break; | 825 break; |
| 836 } | 826 } |
| 837 case FWL_EVTHASH_MouseWheel: { | 827 case CFWL_EventType::MouseWheel: { |
| 838 bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK; | 828 bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK; |
| 839 break; | 829 break; |
| 840 } | 830 } |
| 841 case FWL_EVTHASH_Key: { | 831 case CFWL_EventType::Key: { |
| 842 bRet = dwFilter & FWL_EVENT_KEY_MASK; | 832 bRet = dwFilter & FWL_EVENT_KEY_MASK; |
| 843 break; | 833 break; |
| 844 } | 834 } |
| 845 case FWL_EVTHASH_SetFocus: | 835 case CFWL_EventType::SetFocus: |
| 846 case FWL_EVTHASH_KillFocus: { | 836 case CFWL_EventType::KillFocus: { |
| 847 bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK; | 837 bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK; |
| 848 break; | 838 break; |
| 849 } | 839 } |
| 850 case FWL_EVTHASH_Draw: { | 840 case CFWL_EventType::Draw: { |
| 851 bRet = dwFilter & FWL_EVENT_DRAW_MASK; | 841 bRet = dwFilter & FWL_EVENT_DRAW_MASK; |
| 852 break; | 842 break; |
| 853 } | 843 } |
| 854 case FWL_EVTHASH_Close: { | 844 case CFWL_EventType::Close: { |
| 855 bRet = dwFilter & FWL_EVENT_CLOSE_MASK; | 845 bRet = dwFilter & FWL_EVENT_CLOSE_MASK; |
| 856 break; | 846 break; |
| 857 } | 847 } |
| 858 case FWL_EVTHASH_SizeChanged: { | 848 case CFWL_EventType::SizeChanged: { |
| 859 bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK; | 849 bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK; |
| 860 break; | 850 break; |
| 861 } | 851 } |
| 862 case FWL_EVTHASH_Idle: { | 852 case CFWL_EventType::Idle: { |
| 863 bRet = dwFilter & FWL_EVENT_IDLE_MASK; | 853 bRet = dwFilter & FWL_EVENT_IDLE_MASK; |
| 864 break; | 854 break; |
| 865 } | 855 } |
| 866 default: { | 856 default: { |
| 867 bRet = dwFilter & FWL_EVENT_CONTROL_MASK; | 857 bRet = dwFilter & FWL_EVENT_CONTROL_MASK; |
| 868 break; | 858 break; |
| 869 } | 859 } |
| 870 } | 860 } |
| 871 return bRet; | 861 return bRet; |
| 872 } | 862 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 976 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
| 987 m_pToolTipImp->Hide(); | 977 m_pToolTipImp->Hide(); |
| 988 pCurTarget = NULL; | 978 pCurTarget = NULL; |
| 989 return TRUE; | 979 return TRUE; |
| 990 } | 980 } |
| 991 return FALSE; | 981 return FALSE; |
| 992 } | 982 } |
| 993 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 983 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
| 994 return pCurTarget; | 984 return pCurTarget; |
| 995 } | 985 } |
| OLD | NEW |