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_pHover(nullptr), | 76 m_pHover(nullptr), |
77 m_pFocus(nullptr), | 77 m_pFocus(nullptr), |
78 m_pGrab(nullptr) { | 78 m_pGrab(nullptr) { |
79 m_pNoteLoop = new CFWL_NoteLoop; | 79 m_pNoteLoop = new CFWL_NoteLoop; |
80 PushNoteLoop(m_pNoteLoop); | 80 PushNoteLoop(m_pNoteLoop); |
81 } | 81 } |
82 CFWL_NoteDriver::~CFWL_NoteDriver() { | 82 CFWL_NoteDriver::~CFWL_NoteDriver() { |
83 delete m_pNoteLoop; | 83 delete m_pNoteLoop; |
84 ClearInvalidEventTargets(TRUE); | 84 ClearInvalidEventTargets(TRUE); |
85 } | 85 } |
86 FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) { | 86 |
87 if (pNote->IsEvent()) { | 87 FX_BOOL CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { |
88 int32_t iCount = m_eventTargets.GetCount(); | 88 int32_t iCount = m_eventTargets.GetCount(); |
89 if (iCount < 1) { | 89 if (iCount < 1) |
90 return TRUE; | 90 return TRUE; |
91 } | 91 if (CFWL_EventType::Mouse == pNote->GetClassID()) { |
92 if (FWL_EVTHASH_Mouse == static_cast<CFWL_Event*>(pNote)->GetClassID()) { | 92 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); |
93 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); | 93 if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { |
94 if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { | 94 if (m_pNoteLoop->GetForm() && |
95 if (m_pNoteLoop->GetForm() && | 95 CFWL_ToolTipContainer::getInstance()->ProcessEnter( |
96 CFWL_ToolTipContainer::getInstance()->ProcessEnter( | 96 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { |
97 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { | |
98 } | |
99 } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { | |
100 if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { | |
101 } | |
102 } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && | |
103 (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { | |
104 if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { | |
105 } | |
106 } | 97 } |
107 } | 98 } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { |
108 m_sendEventCalled++; | 99 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
109 FX_POSITION pos = m_eventTargets.GetStartPosition(); | 100 } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && |
110 while (pos) { | 101 (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { |
111 void* key = NULL; | 102 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
112 CFWL_EventTarget* pEventTarget; | |
113 m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); | |
114 if (pEventTarget && !pEventTarget->IsInvalid()) { | |
115 pEventTarget->ProcessEvent(static_cast<CFWL_Event*>(pNote)); | |
116 } | |
117 } | |
118 m_sendEventCalled--; | |
119 } else { | |
120 if (!pNote->m_pDstTarget) | |
121 return FALSE; | |
122 IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL); | |
123 if (pDelegate) { | |
124 pDelegate->OnProcessMessage(static_cast<CFWL_Message*>(pNote)); | |
125 } | 103 } |
126 } | 104 } |
| 105 m_sendEventCalled++; |
| 106 FX_POSITION pos = m_eventTargets.GetStartPosition(); |
| 107 while (pos) { |
| 108 void* key = nullptr; |
| 109 void* value = nullptr; |
| 110 m_eventTargets.GetNextAssoc(pos, key, value); |
| 111 |
| 112 CFWL_EventTarget* pEventTarget = static_cast<CFWL_EventTarget*>(value); |
| 113 if (pEventTarget && !pEventTarget->IsInvalid()) |
| 114 pEventTarget->ProcessEvent(pNote); |
| 115 } |
| 116 m_sendEventCalled--; |
127 return TRUE; | 117 return TRUE; |
128 } | 118 } |
129 | 119 |
130 #define FWL_NoteDriver_EventKey 1100 | 120 #define FWL_NoteDriver_EventKey 1100 |
131 FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, | 121 FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, |
132 IFWL_Widget* pEventSource, | 122 IFWL_Widget* pEventSource, |
133 uint32_t dwFilter) { | 123 uint32_t dwFilter) { |
134 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( | 124 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( |
135 (void*)(uintptr_t)FWL_NoteDriver_EventKey); | 125 (void*)(uintptr_t)FWL_NoteDriver_EventKey); |
136 if (dwkey == 0) { | 126 if (dwkey == 0) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 373 } |
384 | 374 |
385 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { | 375 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { |
386 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 376 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
387 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() | 377 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() |
388 ? pMessage->m_pDstTarget | 378 ? pMessage->m_pDstTarget |
389 : GetMessageForm(pMessage->m_pDstTarget); | 379 : GetMessageForm(pMessage->m_pDstTarget); |
390 if (!pMessageForm) | 380 if (!pMessageForm) |
391 return FALSE; | 381 return FALSE; |
392 if (DispatchMessage(pMessage, pMessageForm)) { | 382 if (DispatchMessage(pMessage, pMessageForm)) { |
393 if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) { | 383 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) |
394 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); | 384 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); |
395 } | |
396 return TRUE; | 385 return TRUE; |
397 } | 386 } |
398 return FALSE; | 387 return FALSE; |
399 } | 388 } |
| 389 |
400 FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, | 390 FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, |
401 IFWL_Widget* pMessageForm) { | 391 IFWL_Widget* pMessageForm) { |
402 FX_BOOL bRet = FALSE; | 392 FX_BOOL bRet = FALSE; |
403 switch (pMessage->GetClassID()) { | 393 switch (pMessage->GetClassID()) { |
404 case FWL_MSGHASH_Activate: { | 394 case CFWL_MessageType::Activate: { |
405 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); | 395 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); |
406 break; | 396 break; |
407 } | 397 } |
408 case FWL_MSGHASH_Deactivate: { | 398 case CFWL_MessageType::Deactivate: { |
409 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), | 399 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), |
410 pMessageForm); | 400 pMessageForm); |
411 break; | 401 break; |
412 } | 402 } |
413 case FWL_MSGHASH_SetFocus: { | 403 case CFWL_MessageType::SetFocus: { |
414 bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm); | 404 bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm); |
415 break; | 405 break; |
416 } | 406 } |
417 case FWL_MSGHASH_KillFocus: { | 407 case CFWL_MessageType::KillFocus: { |
418 bRet = | 408 bRet = |
419 DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm); | 409 DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm); |
420 break; | 410 break; |
421 } | 411 } |
422 case FWL_MSGHASH_Key: { | 412 case CFWL_MessageType::Key: { |
423 bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm); | 413 bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm); |
424 break; | 414 break; |
425 } | 415 } |
426 case FWL_MSGHASH_Mouse: { | 416 case CFWL_MessageType::Mouse: { |
427 bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm); | 417 bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm); |
428 break; | 418 break; |
429 } | 419 } |
430 case FWL_MSGHASH_MouseWheel: { | 420 case CFWL_MessageType::MouseWheel: { |
431 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); | 421 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); |
432 break; | 422 break; |
433 } | 423 } |
434 case FWL_MSGHASH_Size: { | 424 case CFWL_MessageType::Size: { |
435 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); | 425 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); |
436 break; | 426 break; |
437 } | 427 } |
438 case FWL_MSGHASH_Cursor: { | 428 case CFWL_MessageType::Cursor: { |
439 bRet = TRUE; | 429 bRet = TRUE; |
440 break; | 430 break; |
441 } | 431 } |
442 case FWL_MSGHASH_WindowMove: { | 432 case CFWL_MessageType::WindowMove: { |
443 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), | 433 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), |
444 pMessageForm); | 434 pMessageForm); |
445 break; | 435 break; |
446 } | 436 } |
447 case FWL_MSGHASH_DropFiles: { | 437 case CFWL_MessageType::DropFiles: { |
448 bRet = | 438 bRet = |
449 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); | 439 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); |
450 break; | 440 break; |
451 } | 441 } |
452 default: { | 442 default: { |
453 bRet = TRUE; | 443 bRet = TRUE; |
454 break; | 444 break; |
455 } | 445 } |
456 } | 446 } |
457 if (bRet) { | 447 if (bRet) { |
458 IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); | 448 IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); |
459 if (pDelegate) { | 449 if (pDelegate) |
460 pDelegate->OnProcessMessage(pMessage); | 450 pDelegate->OnProcessMessage(pMessage); |
461 } | |
462 } | 451 } |
463 return bRet; | 452 return bRet; |
464 } | 453 } |
| 454 |
465 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, | 455 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, |
466 IFWL_Widget* pMessageForm) { | 456 IFWL_Widget* pMessageForm) { |
467 pMsg->m_pDstTarget = pMessageForm; | 457 pMsg->m_pDstTarget = pMessageForm; |
468 return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; | 458 return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; |
469 } | 459 } |
470 FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, | 460 FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, |
471 IFWL_Widget* pMessageForm) { | 461 IFWL_Widget* pMessageForm) { |
472 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); | 462 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); |
473 if (iTrackLoop <= 0) | 463 if (iTrackLoop <= 0) |
474 return FALSE; | 464 return FALSE; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 m_pHover = pTarget; | 669 m_pHover = pTarget; |
680 CFWL_MsgMouse msHover; | 670 CFWL_MsgMouse msHover; |
681 msHover.m_pDstTarget = pTarget; | 671 msHover.m_pDstTarget = pTarget; |
682 msHover.m_fx = pMsg->m_fx; | 672 msHover.m_fx = pMsg->m_fx; |
683 msHover.m_fy = pMsg->m_fy; | 673 msHover.m_fy = pMsg->m_fy; |
684 msHover.m_dwFlags = 0; | 674 msHover.m_dwFlags = 0; |
685 msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; | 675 msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; |
686 DispatchMessage(&msHover, NULL); | 676 DispatchMessage(&msHover, NULL); |
687 } | 677 } |
688 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { | 678 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { |
689 if (pMessage->GetClassID() == FWL_MSGHASH_Post) { | 679 if (pMessage->GetClassID() == CFWL_MessageType::Post) |
690 return TRUE; | 680 return TRUE; |
691 } | 681 |
692 int32_t iCount = m_noteLoopQueue.GetSize(); | 682 int32_t iCount = m_noteLoopQueue.GetSize(); |
693 for (int32_t i = 0; i < iCount; i++) { | 683 for (int32_t i = 0; i < iCount; i++) { |
694 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); | 684 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); |
695 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); | 685 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); |
696 if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) { | 686 if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) |
697 return TRUE; | 687 return TRUE; |
698 } | |
699 } | 688 } |
700 iCount = m_forms.GetSize(); | 689 iCount = m_forms.GetSize(); |
701 for (int32_t j = 0; j < iCount; j++) { | 690 for (int32_t j = 0; j < iCount; j++) { |
702 CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]); | 691 CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]); |
703 if (pForm->GetInterface() == pMessage->m_pDstTarget) { | 692 if (pForm->GetInterface() == pMessage->m_pDstTarget) |
704 return TRUE; | 693 return TRUE; |
705 } | |
706 } | 694 } |
707 return FALSE; | 695 return FALSE; |
708 } | 696 } |
| 697 |
709 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { | 698 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { |
710 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); | 699 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); |
711 if (iTrackLoop <= 0) | 700 if (iTrackLoop <= 0) |
712 return NULL; | 701 return NULL; |
713 IFWL_Widget* pMessageForm = NULL; | 702 IFWL_Widget* pMessageForm = NULL; |
714 if (iTrackLoop > 1) { | 703 if (iTrackLoop > 1) { |
715 CFWL_NoteLoop* pNootLoop = | 704 CFWL_NoteLoop* pNootLoop = |
716 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); | 705 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); |
717 pMessageForm = pNootLoop->GetForm()->GetInterface(); | 706 pMessageForm = pNootLoop->GetForm()->GetInterface(); |
718 } else { | 707 } else { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 m_eventSources.RemoveAll(); | 773 m_eventSources.RemoveAll(); |
785 } | 774 } |
786 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 775 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
787 uint32_t dwFilter) { | 776 uint32_t dwFilter) { |
788 if (pSource) { | 777 if (pSource) { |
789 m_eventSources.SetAt(pSource, dwFilter); | 778 m_eventSources.SetAt(pSource, dwFilter); |
790 return m_eventSources.GetCount(); | 779 return m_eventSources.GetCount(); |
791 } | 780 } |
792 return 1; | 781 return 1; |
793 } | 782 } |
| 783 |
794 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { | 784 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { |
795 IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); | 785 IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); |
796 if (!pDelegate) | 786 if (!pDelegate) |
797 return FALSE; | 787 return FALSE; |
798 if (m_eventSources.GetCount() == 0) { | 788 if (m_eventSources.GetCount() == 0) { |
799 pDelegate->OnProcessEvent(pEvent); | 789 pDelegate->OnProcessEvent(pEvent); |
800 return TRUE; | 790 return TRUE; |
801 } | 791 } |
802 FX_POSITION pos = m_eventSources.GetStartPosition(); | 792 FX_POSITION pos = m_eventSources.GetStartPosition(); |
803 while (pos) { | 793 while (pos) { |
804 IFWL_Widget* pSource = NULL; | 794 IFWL_Widget* pSource = NULL; |
805 uint32_t dwFilter = 0; | 795 uint32_t dwFilter = 0; |
806 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); | 796 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); |
807 if (pSource == pEvent->m_pSrcTarget || | 797 if (pSource == pEvent->m_pSrcTarget || |
808 pEvent->GetClassID() == FWL_EVTHASH_Idle) { | 798 pEvent->GetClassID() == CFWL_EventType::Idle) { |
809 if (IsFilterEvent(pEvent, dwFilter)) { | 799 if (IsFilterEvent(pEvent, dwFilter)) { |
810 pDelegate->OnProcessEvent(pEvent); | 800 pDelegate->OnProcessEvent(pEvent); |
811 return TRUE; | 801 return TRUE; |
812 } | 802 } |
813 } | 803 } |
814 } | 804 } |
815 return FALSE; | 805 return FALSE; |
816 } | 806 } |
| 807 |
817 FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { | 808 FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { |
818 if (dwFilter == FWL_EVENT_ALL_MASK) { | 809 if (dwFilter == FWL_EVENT_ALL_MASK) |
819 return TRUE; | 810 return TRUE; |
820 } | 811 |
821 FX_BOOL bRet = FALSE; | 812 FX_BOOL bRet = FALSE; |
822 switch (pEvent->GetClassID()) { | 813 switch (pEvent->GetClassID()) { |
823 case FWL_EVTHASH_Mouse: { | 814 case CFWL_EventType::Mouse: { |
824 bRet = dwFilter & FWL_EVENT_MOUSE_MASK; | 815 bRet = dwFilter & FWL_EVENT_MOUSE_MASK; |
825 break; | 816 break; |
826 } | 817 } |
827 case FWL_EVTHASH_MouseWheel: { | 818 case CFWL_EventType::MouseWheel: { |
828 bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK; | 819 bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK; |
829 break; | 820 break; |
830 } | 821 } |
831 case FWL_EVTHASH_Key: { | 822 case CFWL_EventType::Key: { |
832 bRet = dwFilter & FWL_EVENT_KEY_MASK; | 823 bRet = dwFilter & FWL_EVENT_KEY_MASK; |
833 break; | 824 break; |
834 } | 825 } |
835 case FWL_EVTHASH_SetFocus: | 826 case CFWL_EventType::SetFocus: |
836 case FWL_EVTHASH_KillFocus: { | 827 case CFWL_EventType::KillFocus: { |
837 bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK; | 828 bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK; |
838 break; | 829 break; |
839 } | 830 } |
840 case FWL_EVTHASH_Draw: { | 831 case CFWL_EventType::Draw: { |
841 bRet = dwFilter & FWL_EVENT_DRAW_MASK; | 832 bRet = dwFilter & FWL_EVENT_DRAW_MASK; |
842 break; | 833 break; |
843 } | 834 } |
844 case FWL_EVTHASH_Close: { | 835 case CFWL_EventType::Close: { |
845 bRet = dwFilter & FWL_EVENT_CLOSE_MASK; | 836 bRet = dwFilter & FWL_EVENT_CLOSE_MASK; |
846 break; | 837 break; |
847 } | 838 } |
848 case FWL_EVTHASH_SizeChanged: { | 839 case CFWL_EventType::SizeChanged: { |
849 bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK; | 840 bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK; |
850 break; | 841 break; |
851 } | 842 } |
852 case FWL_EVTHASH_Idle: { | 843 case CFWL_EventType::Idle: { |
853 bRet = dwFilter & FWL_EVENT_IDLE_MASK; | 844 bRet = dwFilter & FWL_EVENT_IDLE_MASK; |
854 break; | 845 break; |
855 } | 846 } |
856 default: { | 847 default: { |
857 bRet = dwFilter & FWL_EVENT_CONTROL_MASK; | 848 bRet = dwFilter & FWL_EVENT_CONTROL_MASK; |
858 break; | 849 break; |
859 } | 850 } |
860 } | 851 } |
861 return bRet; | 852 return bRet; |
862 } | 853 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 967 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
977 m_pToolTipImp->Hide(); | 968 m_pToolTipImp->Hide(); |
978 pCurTarget = NULL; | 969 pCurTarget = NULL; |
979 return TRUE; | 970 return TRUE; |
980 } | 971 } |
981 return FALSE; | 972 return FALSE; |
982 } | 973 } |
983 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 974 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
984 return pCurTarget; | 975 return pCurTarget; |
985 } | 976 } |
OLD | NEW |