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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 delete m_pNoteLoop; | 83 delete m_pNoteLoop; |
84 ClearInvalidEventTargets(TRUE); | 84 ClearInvalidEventTargets(TRUE); |
85 } | 85 } |
86 | 86 |
87 FX_BOOL CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { | 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 if (CFWL_EventType::Mouse == pNote->GetClassID()) { | 91 if (CFWL_EventType::Mouse == pNote->GetClassID()) { |
92 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); | 92 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); |
93 if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { | 93 if (FWL_MouseCommand::Hover == pMouse->m_dwCmd) { |
94 if (m_pNoteLoop->GetForm() && | 94 if (m_pNoteLoop->GetForm() && |
95 CFWL_ToolTipContainer::getInstance()->ProcessEnter( | 95 CFWL_ToolTipContainer::getInstance()->ProcessEnter( |
96 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { | 96 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { |
97 } | 97 } |
98 } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { | 98 } else if (FWL_MouseCommand::Leave == pMouse->m_dwCmd) { |
99 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); | 99 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
100 } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && | 100 } else if ((FWL_MouseCommand::LeftButtonDown <= pMouse->m_dwCmd) && |
101 (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { | 101 (FWL_MouseCommand::MiddleButtonDblClk >= pMouse->m_dwCmd)) { |
102 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); | 102 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
103 } | 103 } |
104 } | 104 } |
105 m_sendEventCalled++; | 105 m_sendEventCalled++; |
106 FX_POSITION pos = m_eventTargets.GetStartPosition(); | 106 FX_POSITION pos = m_eventTargets.GetStartPosition(); |
107 while (pos) { | 107 while (pos) { |
108 void* key = nullptr; | 108 void* key = nullptr; |
109 void* value = nullptr; | 109 void* value = nullptr; |
110 m_eventTargets.GetNextAssoc(pos, key, value); | 110 m_eventTargets.GetNextAssoc(pos, key, value); |
111 | 111 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (m_pFocus == pMsg->m_pDstTarget) { | 529 if (m_pFocus == pMsg->m_pDstTarget) { |
530 m_pFocus = NULL; | 530 m_pFocus = NULL; |
531 return TRUE; | 531 return TRUE; |
532 } | 532 } |
533 } | 533 } |
534 } | 534 } |
535 return FALSE; | 535 return FALSE; |
536 } | 536 } |
537 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { | 537 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { |
538 #if (_FX_OS_ != _FX_MACOSX_) | 538 #if (_FX_OS_ != _FX_MACOSX_) |
539 if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown && | 539 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && |
540 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 540 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
541 CFWL_WidgetMgr* pWidgetMgr = | 541 CFWL_WidgetMgr* pWidgetMgr = |
542 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 542 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
543 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); | 543 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); |
544 IFWL_Widget* pFocus = m_pFocus; | 544 IFWL_Widget* pFocus = m_pFocus; |
545 if (m_pFocus) { | 545 if (m_pFocus) { |
546 if (pWidgetMgr->GetWidget(m_pFocus, FWL_WGTRELATION_SystemForm) != | 546 if (pWidgetMgr->GetWidget(m_pFocus, FWL_WGTRELATION_SystemForm) != |
547 pForm) { | 547 pForm) { |
548 pFocus = NULL; | 548 pFocus = NULL; |
549 } | 549 } |
550 } | 550 } |
551 FX_BOOL bFind = FALSE; | 551 FX_BOOL bFind = FALSE; |
552 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); | 552 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); |
553 if (!pNextTabStop) { | 553 if (!pNextTabStop) { |
554 bFind = FALSE; | 554 bFind = FALSE; |
555 pNextTabStop = pWidgetMgr->nextTab(pForm, NULL, bFind); | 555 pNextTabStop = pWidgetMgr->nextTab(pForm, NULL, bFind); |
556 } | 556 } |
557 if (pNextTabStop == pFocus) { | 557 if (pNextTabStop == pFocus) { |
558 return TRUE; | 558 return TRUE; |
559 } | 559 } |
560 if (pNextTabStop) { | 560 if (pNextTabStop) { |
561 SetFocus(pNextTabStop); | 561 SetFocus(pNextTabStop); |
562 } | 562 } |
563 return TRUE; | 563 return TRUE; |
564 } | 564 } |
565 #endif | 565 #endif |
566 if (!m_pFocus) { | 566 if (!m_pFocus) { |
567 if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown && | 567 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && |
568 pMsg->m_dwKeyCode == FWL_VKEY_Return) { | 568 pMsg->m_dwKeyCode == FWL_VKEY_Return) { |
569 CFWL_WidgetMgr* pWidgetMgr = | 569 CFWL_WidgetMgr* pWidgetMgr = |
570 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 570 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
571 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); | 571 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); |
572 if (defButton) { | 572 if (defButton) { |
573 pMsg->m_pDstTarget = defButton; | 573 pMsg->m_pDstTarget = defButton; |
574 return TRUE; | 574 return TRUE; |
575 } | 575 } |
576 } | 576 } |
577 return FALSE; | 577 return FALSE; |
578 } | 578 } |
579 pMsg->m_pDstTarget = m_pFocus; | 579 pMsg->m_pDstTarget = m_pFocus; |
580 return TRUE; | 580 return TRUE; |
581 } | 581 } |
582 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, | 582 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, |
583 IFWL_Widget* pMessageForm) { | 583 IFWL_Widget* pMessageForm) { |
584 if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseLeave || | 584 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || |
585 pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseHover || | 585 pMsg->m_dwCmd == FWL_MouseCommand::Hover || |
586 pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseEnter) { | 586 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { |
587 return pMsg->m_pDstTarget != NULL; | 587 return pMsg->m_pDstTarget != NULL; |
588 } | 588 } |
589 if (pMsg->m_pDstTarget != pMessageForm) { | 589 if (pMsg->m_pDstTarget != pMessageForm) { |
590 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 590 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); |
591 } | 591 } |
592 if (!DoMouseEx(pMsg, pMessageForm)) { | 592 if (!DoMouseEx(pMsg, pMessageForm)) { |
593 pMsg->m_pDstTarget = pMessageForm; | 593 pMsg->m_pDstTarget = pMessageForm; |
594 } | 594 } |
595 return TRUE; | 595 return TRUE; |
596 } | 596 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 if (pTarget == m_pHover) { | 652 if (pTarget == m_pHover) { |
653 return; | 653 return; |
654 } | 654 } |
655 if (m_pHover) { | 655 if (m_pHover) { |
656 CFWL_MsgMouse msLeave; | 656 CFWL_MsgMouse msLeave; |
657 msLeave.m_pDstTarget = m_pHover; | 657 msLeave.m_pDstTarget = m_pHover; |
658 msLeave.m_fx = pMsg->m_fx; | 658 msLeave.m_fx = pMsg->m_fx; |
659 msLeave.m_fy = pMsg->m_fy; | 659 msLeave.m_fy = pMsg->m_fy; |
660 pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); | 660 pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); |
661 msLeave.m_dwFlags = 0; | 661 msLeave.m_dwFlags = 0; |
662 msLeave.m_dwCmd = FWL_MSGMOUSECMD_MouseLeave; | 662 msLeave.m_dwCmd = FWL_MouseCommand::Leave; |
663 DispatchMessage(&msLeave, NULL); | 663 DispatchMessage(&msLeave, NULL); |
664 } | 664 } |
665 if (pTarget->GetClassID() == FWL_CLASSHASH_Form) { | 665 if (pTarget->GetClassID() == FWL_CLASSHASH_Form) { |
666 m_pHover = NULL; | 666 m_pHover = NULL; |
667 return; | 667 return; |
668 } | 668 } |
669 m_pHover = pTarget; | 669 m_pHover = pTarget; |
670 CFWL_MsgMouse msHover; | 670 CFWL_MsgMouse msHover; |
671 msHover.m_pDstTarget = pTarget; | 671 msHover.m_pDstTarget = pTarget; |
672 msHover.m_fx = pMsg->m_fx; | 672 msHover.m_fx = pMsg->m_fx; |
673 msHover.m_fy = pMsg->m_fy; | 673 msHover.m_fy = pMsg->m_fy; |
674 msHover.m_dwFlags = 0; | 674 msHover.m_dwFlags = 0; |
675 msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; | 675 msHover.m_dwCmd = FWL_MouseCommand::Hover; |
676 DispatchMessage(&msHover, NULL); | 676 DispatchMessage(&msHover, NULL); |
677 } | 677 } |
678 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { | 678 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { |
679 if (pMessage->GetClassID() == CFWL_MessageType::Post) | 679 if (pMessage->GetClassID() == CFWL_MessageType::Post) |
680 return TRUE; | 680 return TRUE; |
681 | 681 |
682 int32_t iCount = m_noteLoopQueue.GetSize(); | 682 int32_t iCount = m_noteLoopQueue.GetSize(); |
683 for (int32_t i = 0; i < iCount; i++) { | 683 for (int32_t i = 0; i < iCount; i++) { |
684 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); | 684 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); |
685 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); | 685 CFWL_WidgetImp* pForm = pNoteLoop->GetForm(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 968 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
969 m_pToolTipImp->Hide(); | 969 m_pToolTipImp->Hide(); |
970 pCurTarget = NULL; | 970 pCurTarget = NULL; |
971 return TRUE; | 971 return TRUE; |
972 } | 972 } |
973 return FALSE; | 973 return FALSE; |
974 } | 974 } |
975 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 975 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
976 return pCurTarget; | 976 return pCurTarget; |
977 } | 977 } |
OLD | NEW |