| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 delete m_pNoteLoop; | 76 delete m_pNoteLoop; |
| 77 ClearInvalidEventTargets(TRUE); | 77 ClearInvalidEventTargets(TRUE); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { | 80 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { |
| 81 if (m_eventTargets.empty()) | 81 if (m_eventTargets.empty()) |
| 82 return; | 82 return; |
| 83 if (CFWL_EventType::Mouse == pNote->GetClassID()) { | 83 if (CFWL_EventType::Mouse == pNote->GetClassID()) { |
| 84 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); | 84 CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); |
| 85 if (FWL_MouseCommand::Hover == pMouse->m_dwCmd) { | 85 if (FWL_MouseCommand::Hover == pMouse->m_dwCmd) { |
| 86 if (m_pNoteLoop->GetForm() && | 86 if (m_pNoteLoop->GetForm()) { |
| 87 CFWL_ToolTipContainer::getInstance()->ProcessEnter( | 87 CFWL_ToolTipContainer::getInstance()->ProcessEnter( |
| 88 pMouse, m_pNoteLoop->GetForm()->GetInterface())) { | 88 pMouse, m_pNoteLoop->GetForm()->GetInterface()); |
| 89 } | 89 } |
| 90 } else if (FWL_MouseCommand::Leave == pMouse->m_dwCmd) { | 90 } else if (FWL_MouseCommand::Leave == pMouse->m_dwCmd) { |
| 91 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); | 91 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
| 92 } else if ((FWL_MouseCommand::LeftButtonDown <= pMouse->m_dwCmd) && | 92 } else if ((FWL_MouseCommand::LeftButtonDown <= pMouse->m_dwCmd) && |
| 93 (FWL_MouseCommand::MiddleButtonDblClk >= pMouse->m_dwCmd)) { | 93 (FWL_MouseCommand::MiddleButtonDblClk >= pMouse->m_dwCmd)) { |
| 94 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); | 94 CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 for (const auto& pair : m_eventTargets) { | 97 for (const auto& pair : m_eventTargets) { |
| 98 CFWL_EventTarget* pEventTarget = pair.second; | 98 CFWL_EventTarget* pEventTarget = pair.second; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (bNotify) { | 166 if (bNotify) { |
| 167 ms.m_dwExtend = 1; | 167 ms.m_dwExtend = 1; |
| 168 } | 168 } |
| 169 IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL); | 169 IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL); |
| 170 if (pDelegate) { | 170 if (pDelegate) { |
| 171 pDelegate->OnProcessMessage(&ms); | 171 pDelegate->OnProcessMessage(&ms); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 if (pFocus) { | 174 if (pFocus) { |
| 175 IFWL_Widget* pWidget = | 175 IFWL_Widget* pWidget = |
| 176 FWL_GetWidgetMgr()->GetWidget(pFocus, FWL_WGTRELATION_SystemForm); | 176 CFWL_WidgetMgr::GetInstance()->GetSystemFormWidget(pFocus); |
| 177 CFWL_FormImp* pForm = | 177 CFWL_FormImp* pForm = |
| 178 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 178 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; |
| 179 if (pForm) { | 179 if (pForm) { |
| 180 CFWL_WidgetImp* pNewFocus = | 180 CFWL_WidgetImp* pNewFocus = |
| 181 static_cast<CFWL_WidgetImp*>(pFocus->GetImpl()); | 181 static_cast<CFWL_WidgetImp*>(pFocus->GetImpl()); |
| 182 pForm->SetSubFocus(pNewFocus); | 182 pForm->SetSubFocus(pNewFocus); |
| 183 } | 183 } |
| 184 CFWL_MsgSetFocus ms; | 184 CFWL_MsgSetFocus ms; |
| 185 ms.m_pDstTarget = pFocus; | 185 ms.m_pDstTarget = pFocus; |
| 186 if (bNotify) { | 186 if (bNotify) { |
| 187 ms.m_dwExtend = 1; | 187 ms.m_dwExtend = 1; |
| 188 } | 188 } |
| 189 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); | 189 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); |
| 190 if (pDelegate) { | 190 if (pDelegate) { |
| 191 pDelegate->OnProcessMessage(&ms); | 191 pDelegate->OnProcessMessage(&ms); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 return TRUE; | 194 return TRUE; |
| 195 } | 195 } |
| 196 FWL_Error CFWL_NoteDriver::Run() { | 196 FWL_Error CFWL_NoteDriver::Run() { |
| 197 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 197 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 198 if (!pWidgetMgr) | 198 if (!pWidgetMgr) |
| 199 return FWL_Error::Indefinite; | 199 return FWL_Error::Indefinite; |
| 200 | 200 |
| 201 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 201 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
| 202 _FX_OS_ == _FX_WIN64_) | 202 _FX_OS_ == _FX_WIN64_) |
| 203 CFWL_NoteLoop* pTopLoop = NULL; | 203 CFWL_NoteLoop* pTopLoop = NULL; |
| 204 for (;;) { | 204 for (;;) { |
| 205 pTopLoop = GetTopLoop(); | 205 pTopLoop = GetTopLoop(); |
| 206 if (!pTopLoop || !pTopLoop->ContinueModal()) | 206 if (!pTopLoop || !pTopLoop->ContinueModal()) |
| 207 break; | 207 break; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 int32_t size = m_noteLoopQueue.GetSize(); | 312 int32_t size = m_noteLoopQueue.GetSize(); |
| 313 if (size <= 0) | 313 if (size <= 0) |
| 314 return nullptr; | 314 return nullptr; |
| 315 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); | 315 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); |
| 316 } | 316 } |
| 317 int32_t CFWL_NoteDriver::CountLoop() { | 317 int32_t CFWL_NoteDriver::CountLoop() { |
| 318 return m_noteLoopQueue.GetSize(); | 318 return m_noteLoopQueue.GetSize(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { | 321 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { |
| 322 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 322 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 323 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() | 323 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() |
| 324 ? pMessage->m_pDstTarget | 324 ? pMessage->m_pDstTarget |
| 325 : GetMessageForm(pMessage->m_pDstTarget); | 325 : GetMessageForm(pMessage->m_pDstTarget); |
| 326 if (!pMessageForm) | 326 if (!pMessageForm) |
| 327 return FALSE; | 327 return FALSE; |
| 328 if (DispatchMessage(pMessage, pMessageForm)) { | 328 if (DispatchMessage(pMessage, pMessageForm)) { |
| 329 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) | 329 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) |
| 330 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); | 330 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); |
| 331 return TRUE; | 331 return TRUE; |
| 332 } | 332 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { | 429 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { |
| 430 return TRUE; | 430 return TRUE; |
| 431 } | 431 } |
| 432 #endif | 432 #endif |
| 433 return pDst != pMessageForm && | 433 return pDst != pMessageForm && |
| 434 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && | 434 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && |
| 435 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); | 435 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); |
| 436 } | 436 } |
| 437 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, | 437 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, |
| 438 IFWL_Widget* pMessageForm) { | 438 IFWL_Widget* pMessageForm) { |
| 439 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 439 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 440 if (pWidgetMgr->IsFormDisabled()) { | 440 if (pWidgetMgr->IsFormDisabled()) { |
| 441 m_pFocus = pMsg->m_pDstTarget; | 441 m_pFocus = pMsg->m_pDstTarget; |
| 442 return TRUE; | 442 return TRUE; |
| 443 } else { | 443 } |
| 444 IFWL_Widget* pWidget = pMsg->m_pDstTarget; | 444 IFWL_Widget* pWidget = pMsg->m_pDstTarget; |
| 445 CFWL_FormImp* pForm = | 445 CFWL_FormImp* pForm = |
| 446 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 446 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; |
| 447 if (pForm) { | 447 if (pForm) { |
| 448 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 448 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); |
| 449 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { | 449 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { |
| 450 pMsg->m_pDstTarget = pSubFocus->GetInterface(); | 450 pMsg->m_pDstTarget = pSubFocus->GetInterface(); |
| 451 if (m_pFocus != pMsg->m_pDstTarget) { | 451 if (m_pFocus != pMsg->m_pDstTarget) { |
| 452 m_pFocus = pMsg->m_pDstTarget; | 452 m_pFocus = pMsg->m_pDstTarget; |
| 453 return TRUE; | 453 return TRUE; |
| 454 } | |
| 455 } | 454 } |
| 456 } | 455 } |
| 457 } | 456 } |
| 458 return FALSE; | 457 return FALSE; |
| 459 } | 458 } |
| 460 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, | 459 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, |
| 461 IFWL_Widget* pMessageForm) { | 460 IFWL_Widget* pMessageForm) { |
| 462 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 461 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 463 if (pWidgetMgr->IsFormDisabled()) { | 462 if (pWidgetMgr->IsFormDisabled()) { |
| 464 if (m_pFocus == pMsg->m_pDstTarget) { | 463 if (m_pFocus == pMsg->m_pDstTarget) { |
| 465 m_pFocus = NULL; | 464 m_pFocus = NULL; |
| 466 } | 465 } |
| 467 return TRUE; | 466 return TRUE; |
| 468 } | 467 } |
| 469 IFWL_Widget* pWidget = pMsg->m_pDstTarget; | 468 IFWL_Widget* pWidget = pMsg->m_pDstTarget; |
| 470 CFWL_FormImp* pForm = | 469 CFWL_FormImp* pForm = |
| 471 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 470 pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; |
| 472 if (pForm) { | 471 if (pForm) { |
| 473 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 472 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); |
| 474 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { | 473 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { |
| 475 pMsg->m_pDstTarget = pSubFocus->GetInterface(); | 474 pMsg->m_pDstTarget = pSubFocus->GetInterface(); |
| 476 if (m_pFocus == pMsg->m_pDstTarget) { | 475 if (m_pFocus == pMsg->m_pDstTarget) { |
| 477 m_pFocus = NULL; | 476 m_pFocus = NULL; |
| 478 return TRUE; | 477 return TRUE; |
| 479 } | 478 } |
| 480 } | 479 } |
| 481 } | 480 } |
| 482 return FALSE; | 481 return FALSE; |
| 483 } | 482 } |
| 484 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { | 483 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { |
| 485 #if (_FX_OS_ != _FX_MACOSX_) | 484 #if (_FX_OS_ != _FX_MACOSX_) |
| 486 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && | 485 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && |
| 487 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 486 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { |
| 488 CFWL_WidgetMgr* pWidgetMgr = | 487 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 489 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
| 490 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); | 488 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); |
| 491 IFWL_Widget* pFocus = m_pFocus; | 489 IFWL_Widget* pFocus = m_pFocus; |
| 492 if (m_pFocus) { | 490 if (m_pFocus) { |
| 493 if (pWidgetMgr->GetWidget(m_pFocus, FWL_WGTRELATION_SystemForm) != | 491 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm) |
| 494 pForm) { | 492 pFocus = nullptr; |
| 495 pFocus = NULL; | |
| 496 } | |
| 497 } | 493 } |
| 498 FX_BOOL bFind = FALSE; | 494 FX_BOOL bFind = FALSE; |
| 499 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); | 495 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); |
| 500 if (!pNextTabStop) { | 496 if (!pNextTabStop) { |
| 501 bFind = FALSE; | 497 bFind = FALSE; |
| 502 pNextTabStop = pWidgetMgr->nextTab(pForm, NULL, bFind); | 498 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind); |
| 503 } | 499 } |
| 504 if (pNextTabStop == pFocus) { | 500 if (pNextTabStop == pFocus) { |
| 505 return TRUE; | 501 return TRUE; |
| 506 } | 502 } |
| 507 if (pNextTabStop) { | 503 if (pNextTabStop) { |
| 508 SetFocus(pNextTabStop); | 504 SetFocus(pNextTabStop); |
| 509 } | 505 } |
| 510 return TRUE; | 506 return TRUE; |
| 511 } | 507 } |
| 512 #endif | 508 #endif |
| 513 if (!m_pFocus) { | 509 if (!m_pFocus) { |
| 514 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && | 510 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && |
| 515 pMsg->m_dwKeyCode == FWL_VKEY_Return) { | 511 pMsg->m_dwKeyCode == FWL_VKEY_Return) { |
| 516 CFWL_WidgetMgr* pWidgetMgr = | 512 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 517 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
| 518 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); | 513 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); |
| 519 if (defButton) { | 514 if (defButton) { |
| 520 pMsg->m_pDstTarget = defButton; | 515 pMsg->m_pDstTarget = defButton; |
| 521 return TRUE; | 516 return TRUE; |
| 522 } | 517 } |
| 523 } | 518 } |
| 524 return FALSE; | 519 return FALSE; |
| 525 } | 520 } |
| 526 pMsg->m_pDstTarget = m_pFocus; | 521 pMsg->m_pDstTarget = m_pFocus; |
| 527 return TRUE; | 522 return TRUE; |
| 528 } | 523 } |
| 529 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, | 524 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, |
| 530 IFWL_Widget* pMessageForm) { | 525 IFWL_Widget* pMessageForm) { |
| 531 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || | 526 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || |
| 532 pMsg->m_dwCmd == FWL_MouseCommand::Hover || | 527 pMsg->m_dwCmd == FWL_MouseCommand::Hover || |
| 533 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { | 528 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { |
| 534 return pMsg->m_pDstTarget != NULL; | 529 return pMsg->m_pDstTarget != NULL; |
| 535 } | 530 } |
| 536 if (pMsg->m_pDstTarget != pMessageForm) { | 531 if (pMsg->m_pDstTarget != pMessageForm) { |
| 537 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 532 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); |
| 538 } | 533 } |
| 539 if (!DoMouseEx(pMsg, pMessageForm)) { | 534 if (!DoMouseEx(pMsg, pMessageForm)) { |
| 540 pMsg->m_pDstTarget = pMessageForm; | 535 pMsg->m_pDstTarget = pMessageForm; |
| 541 } | 536 } |
| 542 return TRUE; | 537 return TRUE; |
| 543 } | 538 } |
| 544 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, | 539 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, |
| 545 IFWL_Widget* pMessageForm) { | 540 IFWL_Widget* pMessageForm) { |
| 546 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 541 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 547 if (!pWidgetMgr) | 542 if (!pWidgetMgr) |
| 548 return FALSE; | 543 return FALSE; |
| 549 | 544 |
| 550 IFWL_Widget* pDst = | 545 IFWL_Widget* pDst = |
| 551 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 546 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); |
| 552 if (!pDst) | 547 if (!pDst) |
| 553 return FALSE; | 548 return FALSE; |
| 554 | 549 |
| 555 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); | 550 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); |
| 556 pMsg->m_pDstTarget = pDst; | 551 pMsg->m_pDstTarget = pDst; |
| 557 return TRUE; | 552 return TRUE; |
| 558 } | 553 } |
| 559 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { | 554 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { |
| 560 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 555 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 561 if (!pWidgetMgr) | 556 if (!pWidgetMgr) |
| 562 return FALSE; | 557 return FALSE; |
| 563 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, | 558 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, |
| 564 (FX_FLOAT)pMsg->m_iHeight); | 559 (FX_FLOAT)pMsg->m_iHeight); |
| 565 return TRUE; | 560 return TRUE; |
| 566 } | 561 } |
| 567 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, | 562 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, |
| 568 IFWL_Widget* pMessageForm) { | 563 IFWL_Widget* pMessageForm) { |
| 569 return pMsg->m_pDstTarget == pMessageForm; | 564 return pMsg->m_pDstTarget == pMessageForm; |
| 570 } | 565 } |
| 571 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, | 566 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, |
| 572 IFWL_Widget* pMessageForm) { | 567 IFWL_Widget* pMessageForm) { |
| 573 return pMsg->m_pDstTarget == pMessageForm; | 568 return pMsg->m_pDstTarget == pMessageForm; |
| 574 } | 569 } |
| 575 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, | 570 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, |
| 576 IFWL_Widget* pMessageForm) { | 571 IFWL_Widget* pMessageForm) { |
| 577 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 572 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 578 if (!pWidgetMgr) | 573 if (!pWidgetMgr) |
| 579 return FALSE; | 574 return FALSE; |
| 580 IFWL_Widget* pTarget = NULL; | 575 IFWL_Widget* pTarget = NULL; |
| 581 if (m_pGrab) | 576 if (m_pGrab) |
| 582 pTarget = m_pGrab; | 577 pTarget = m_pGrab; |
| 583 if (!pTarget) { | 578 if (!pTarget) { |
| 584 pTarget = | 579 pTarget = |
| 585 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 580 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); |
| 586 } | 581 } |
| 587 if (pTarget) { | 582 if (pTarget) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 return nullptr; | 643 return nullptr; |
| 649 IFWL_Widget* pMessageForm = nullptr; | 644 IFWL_Widget* pMessageForm = nullptr; |
| 650 if (iTrackLoop > 1) { | 645 if (iTrackLoop > 1) { |
| 651 CFWL_NoteLoop* pNootLoop = | 646 CFWL_NoteLoop* pNootLoop = |
| 652 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); | 647 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); |
| 653 pMessageForm = pNootLoop->GetForm()->GetInterface(); | 648 pMessageForm = pNootLoop->GetForm()->GetInterface(); |
| 654 } else if (m_forms.Find(pDstTarget->GetImpl()) < 0) { | 649 } else if (m_forms.Find(pDstTarget->GetImpl()) < 0) { |
| 655 pMessageForm = pDstTarget; | 650 pMessageForm = pDstTarget; |
| 656 } | 651 } |
| 657 if (!pMessageForm && pDstTarget) { | 652 if (!pMessageForm && pDstTarget) { |
| 658 CFWL_WidgetMgr* pWidgetMgr = | 653 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
| 659 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
| 660 if (!pWidgetMgr) | 654 if (!pWidgetMgr) |
| 661 return nullptr; | 655 return nullptr; |
| 662 pMessageForm = | 656 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); |
| 663 pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm); | |
| 664 } | 657 } |
| 665 return pMessageForm; | 658 return pMessageForm; |
| 666 } | 659 } |
| 667 | 660 |
| 668 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { | 661 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { |
| 669 auto it = m_eventTargets.begin(); | 662 auto it = m_eventTargets.begin(); |
| 670 while (it != m_eventTargets.end()) { | 663 while (it != m_eventTargets.end()) { |
| 671 auto old = it++; | 664 auto old = it++; |
| 672 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 665 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
| 673 delete old->second; | 666 delete old->second; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 888 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
| 896 m_pToolTipImp->Hide(); | 889 m_pToolTipImp->Hide(); |
| 897 pCurTarget = NULL; | 890 pCurTarget = NULL; |
| 898 return TRUE; | 891 return TRUE; |
| 899 } | 892 } |
| 900 return FALSE; | 893 return FALSE; |
| 901 } | 894 } |
| 902 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 895 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
| 903 return pCurTarget; | 896 return pCurTarget; |
| 904 } | 897 } |
| OLD | NEW |