| 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 "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" | 
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 156   } | 156   } | 
| 157   IFWL_Widget* pPrev = m_pFocus; | 157   IFWL_Widget* pPrev = m_pFocus; | 
| 158   m_pFocus = pFocus; | 158   m_pFocus = pFocus; | 
| 159   if (pPrev) { | 159   if (pPrev) { | 
| 160     CFWL_MsgKillFocus ms; | 160     CFWL_MsgKillFocus ms; | 
| 161     ms.m_pDstTarget = pPrev; | 161     ms.m_pDstTarget = pPrev; | 
| 162     ms.m_pSrcTarget = pPrev; | 162     ms.m_pSrcTarget = pPrev; | 
| 163     if (bNotify) { | 163     if (bNotify) { | 
| 164       ms.m_dwExtend = 1; | 164       ms.m_dwExtend = 1; | 
| 165     } | 165     } | 
| 166     IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL); | 166     IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr); | 
| 167     if (pDelegate) { | 167     if (pDelegate) { | 
| 168       pDelegate->OnProcessMessage(&ms); | 168       pDelegate->OnProcessMessage(&ms); | 
| 169     } | 169     } | 
| 170   } | 170   } | 
| 171   if (pFocus) { | 171   if (pFocus) { | 
| 172     IFWL_Widget* pWidget = | 172     IFWL_Widget* pWidget = | 
| 173         CFWL_WidgetMgr::GetInstance()->GetSystemFormWidget(pFocus); | 173         CFWL_WidgetMgr::GetInstance()->GetSystemFormWidget(pFocus); | 
| 174     CFWL_FormImp* pForm = | 174     CFWL_FormImp* pForm = | 
| 175         pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 175         pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 
| 176     if (pForm) { | 176     if (pForm) { | 
| 177       CFWL_WidgetImp* pNewFocus = | 177       CFWL_WidgetImp* pNewFocus = | 
| 178           static_cast<CFWL_WidgetImp*>(pFocus->GetImpl()); | 178           static_cast<CFWL_WidgetImp*>(pFocus->GetImpl()); | 
| 179       pForm->SetSubFocus(pNewFocus); | 179       pForm->SetSubFocus(pNewFocus); | 
| 180     } | 180     } | 
| 181     CFWL_MsgSetFocus ms; | 181     CFWL_MsgSetFocus ms; | 
| 182     ms.m_pDstTarget = pFocus; | 182     ms.m_pDstTarget = pFocus; | 
| 183     if (bNotify) { | 183     if (bNotify) { | 
| 184       ms.m_dwExtend = 1; | 184       ms.m_dwExtend = 1; | 
| 185     } | 185     } | 
| 186     IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); | 186     IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr); | 
| 187     if (pDelegate) { | 187     if (pDelegate) { | 
| 188       pDelegate->OnProcessMessage(&ms); | 188       pDelegate->OnProcessMessage(&ms); | 
| 189     } | 189     } | 
| 190   } | 190   } | 
| 191   return TRUE; | 191   return TRUE; | 
| 192 } | 192 } | 
| 193 FWL_Error CFWL_NoteDriver::Run() { | 193 FWL_Error CFWL_NoteDriver::Run() { | 
| 194   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 194   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 
| 195   if (!pWidgetMgr) | 195   if (!pWidgetMgr) | 
| 196     return FWL_Error::Indefinite; | 196     return FWL_Error::Indefinite; | 
| 197 | 197 | 
| 198 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 198 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 
| 199      _FX_OS_ == _FX_WIN64_) | 199      _FX_OS_ == _FX_WIN64_) | 
| 200   CFWL_NoteLoop* pTopLoop = NULL; | 200   CFWL_NoteLoop* pTopLoop = nullptr; | 
| 201   for (;;) { | 201   for (;;) { | 
| 202     pTopLoop = GetTopLoop(); | 202     pTopLoop = GetTopLoop(); | 
| 203     if (!pTopLoop || !pTopLoop->ContinueModal()) | 203     if (!pTopLoop || !pTopLoop->ContinueModal()) | 
| 204       break; | 204       break; | 
| 205     if (UnqueueMessage(pTopLoop)) | 205     if (UnqueueMessage(pTopLoop)) | 
| 206       continue; | 206       continue; | 
| 207   } | 207   } | 
| 208 #endif | 208 #endif | 
| 209 | 209 | 
| 210   return FWL_Error::Succeeded; | 210   return FWL_Error::Succeeded; | 
| 211 } | 211 } | 
| 212 | 212 | 
| 213 IFWL_Widget* CFWL_NoteDriver::GetFocus() { | 213 IFWL_Widget* CFWL_NoteDriver::GetFocus() { | 
| 214   return m_pFocus; | 214   return m_pFocus; | 
| 215 } | 215 } | 
| 216 IFWL_Widget* CFWL_NoteDriver::GetHover() { | 216 IFWL_Widget* CFWL_NoteDriver::GetHover() { | 
| 217   return m_pHover; | 217   return m_pHover; | 
| 218 } | 218 } | 
| 219 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { | 219 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { | 
| 220   m_pHover = pHover; | 220   m_pHover = pHover; | 
| 221 } | 221 } | 
| 222 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { | 222 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { | 
| 223   m_pGrab = bSet ? pGrab : NULL; | 223   m_pGrab = bSet ? pGrab : nullptr; | 
| 224 } | 224 } | 
| 225 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { | 225 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { | 
| 226   if (m_pFocus == pNoteTarget) { | 226   if (m_pFocus == pNoteTarget) { | 
| 227     m_pFocus = NULL; | 227     m_pFocus = nullptr; | 
| 228   } | 228   } | 
| 229   if (m_pHover == pNoteTarget) { | 229   if (m_pHover == pNoteTarget) { | 
| 230     m_pHover = NULL; | 230     m_pHover = nullptr; | 
| 231   } | 231   } | 
| 232   if (m_pGrab == pNoteTarget) { | 232   if (m_pGrab == pNoteTarget) { | 
| 233     m_pGrab = NULL; | 233     m_pGrab = nullptr; | 
| 234   } | 234   } | 
| 235 } | 235 } | 
| 236 void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { | 236 void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { | 
| 237   if (m_pFocus == pNoteTarget) { | 237   if (m_pFocus == pNoteTarget) { | 
| 238     m_pFocus = NULL; | 238     m_pFocus = nullptr; | 
| 239   } | 239   } | 
| 240   if (m_pHover == pNoteTarget) { | 240   if (m_pHover == pNoteTarget) { | 
| 241     m_pHover = NULL; | 241     m_pHover = nullptr; | 
| 242   } | 242   } | 
| 243   if (m_pGrab == pNoteTarget) { | 243   if (m_pGrab == pNoteTarget) { | 
| 244     m_pGrab = NULL; | 244     m_pGrab = nullptr; | 
| 245   } | 245   } | 
| 246   UnregisterEventTarget(pNoteTarget); | 246   UnregisterEventTarget(pNoteTarget); | 
| 247   int32_t count = m_forms.GetSize(); | 247   int32_t count = m_forms.GetSize(); | 
| 248   for (int32_t nIndex = 0; nIndex < count; nIndex++) { | 248   for (int32_t nIndex = 0; nIndex < count; nIndex++) { | 
| 249     CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[nIndex]); | 249     CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[nIndex]); | 
| 250     if (!pForm) { | 250     if (!pForm) { | 
| 251       continue; | 251       continue; | 
| 252     } | 252     } | 
| 253     CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 253     CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 
| 254     if (!pSubFocus) | 254     if (!pSubFocus) | 
| 255       return; | 255       return; | 
| 256     if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) { | 256     if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) { | 
| 257       pForm->SetSubFocus(NULL); | 257       pForm->SetSubFocus(nullptr); | 
| 258     } | 258     } | 
| 259   } | 259   } | 
| 260 } | 260 } | 
| 261 | 261 | 
| 262 FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { | 262 FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { | 
| 263   if (!pForm) | 263   if (!pForm) | 
| 264     return FWL_Error::Indefinite; | 264     return FWL_Error::Indefinite; | 
| 265   if (m_forms.Find(pForm) >= 0) { | 265   if (m_forms.Find(pForm) >= 0) { | 
| 266     return FWL_Error::Indefinite; | 266     return FWL_Error::Indefinite; | 
| 267   } | 267   } | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 381       bRet = | 381       bRet = | 
| 382           DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); | 382           DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); | 
| 383       break; | 383       break; | 
| 384     } | 384     } | 
| 385     default: { | 385     default: { | 
| 386       bRet = TRUE; | 386       bRet = TRUE; | 
| 387       break; | 387       break; | 
| 388     } | 388     } | 
| 389   } | 389   } | 
| 390   if (bRet) { | 390   if (bRet) { | 
| 391     IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); | 391     IFWL_WidgetDelegate* pDelegate = | 
|  | 392         pMessage->m_pDstTarget->SetDelegate(nullptr); | 
| 392     if (pDelegate) | 393     if (pDelegate) | 
| 393       pDelegate->OnProcessMessage(pMessage); | 394       pDelegate->OnProcessMessage(pMessage); | 
| 394   } | 395   } | 
| 395   return bRet; | 396   return bRet; | 
| 396 } | 397 } | 
| 397 | 398 | 
| 398 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, | 399 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, | 
| 399                                     IFWL_Widget* pMessageForm) { | 400                                     IFWL_Widget* pMessageForm) { | 
| 400   pMsg->m_pDstTarget = pMessageForm; | 401   pMsg->m_pDstTarget = pMessageForm; | 
| 401   return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; | 402   return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated; | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 451       } | 452       } | 
| 452     } | 453     } | 
| 453   } | 454   } | 
| 454   return FALSE; | 455   return FALSE; | 
| 455 } | 456 } | 
| 456 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, | 457 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, | 
| 457                                      IFWL_Widget* pMessageForm) { | 458                                      IFWL_Widget* pMessageForm) { | 
| 458   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 459   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 
| 459   if (pWidgetMgr->IsFormDisabled()) { | 460   if (pWidgetMgr->IsFormDisabled()) { | 
| 460     if (m_pFocus == pMsg->m_pDstTarget) { | 461     if (m_pFocus == pMsg->m_pDstTarget) { | 
| 461       m_pFocus = NULL; | 462       m_pFocus = nullptr; | 
| 462     } | 463     } | 
| 463     return TRUE; | 464     return TRUE; | 
| 464   } | 465   } | 
| 465   IFWL_Widget* pWidget = pMsg->m_pDstTarget; | 466   IFWL_Widget* pWidget = pMsg->m_pDstTarget; | 
| 466   CFWL_FormImp* pForm = | 467   CFWL_FormImp* pForm = | 
| 467       pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 468       pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; | 
| 468   if (pForm) { | 469   if (pForm) { | 
| 469     CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 470     CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 
| 470     if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { | 471     if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { | 
| 471       pMsg->m_pDstTarget = pSubFocus->GetInterface(); | 472       pMsg->m_pDstTarget = pSubFocus->GetInterface(); | 
| 472       if (m_pFocus == pMsg->m_pDstTarget) { | 473       if (m_pFocus == pMsg->m_pDstTarget) { | 
| 473         m_pFocus = NULL; | 474         m_pFocus = nullptr; | 
| 474         return TRUE; | 475         return TRUE; | 
| 475       } | 476       } | 
| 476     } | 477     } | 
| 477   } | 478   } | 
| 478   return FALSE; | 479   return FALSE; | 
| 479 } | 480 } | 
| 480 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { | 481 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { | 
| 481 #if (_FX_OS_ != _FX_MACOSX_) | 482 #if (_FX_OS_ != _FX_MACOSX_) | 
| 482   if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && | 483   if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && | 
| 483       pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 484       pMsg->m_dwKeyCode == FWL_VKEY_Tab) { | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 516     return FALSE; | 517     return FALSE; | 
| 517   } | 518   } | 
| 518   pMsg->m_pDstTarget = m_pFocus; | 519   pMsg->m_pDstTarget = m_pFocus; | 
| 519   return TRUE; | 520   return TRUE; | 
| 520 } | 521 } | 
| 521 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, | 522 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, | 
| 522                                  IFWL_Widget* pMessageForm) { | 523                                  IFWL_Widget* pMessageForm) { | 
| 523   if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || | 524   if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || | 
| 524       pMsg->m_dwCmd == FWL_MouseCommand::Hover || | 525       pMsg->m_dwCmd == FWL_MouseCommand::Hover || | 
| 525       pMsg->m_dwCmd == FWL_MouseCommand::Enter) { | 526       pMsg->m_dwCmd == FWL_MouseCommand::Enter) { | 
| 526     return pMsg->m_pDstTarget != NULL; | 527     return !!pMsg->m_pDstTarget; | 
| 527   } | 528   } | 
| 528   if (pMsg->m_pDstTarget != pMessageForm) { | 529   if (pMsg->m_pDstTarget != pMessageForm) { | 
| 529     pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 530     pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 
| 530   } | 531   } | 
| 531   if (!DoMouseEx(pMsg, pMessageForm)) { | 532   if (!DoMouseEx(pMsg, pMessageForm)) { | 
| 532     pMsg->m_pDstTarget = pMessageForm; | 533     pMsg->m_pDstTarget = pMessageForm; | 
| 533   } | 534   } | 
| 534   return TRUE; | 535   return TRUE; | 
| 535 } | 536 } | 
| 536 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, | 537 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 562 } | 563 } | 
| 563 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, | 564 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, | 
| 564                                      IFWL_Widget* pMessageForm) { | 565                                      IFWL_Widget* pMessageForm) { | 
| 565   return pMsg->m_pDstTarget == pMessageForm; | 566   return pMsg->m_pDstTarget == pMessageForm; | 
| 566 } | 567 } | 
| 567 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, | 568 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, | 
| 568                                    IFWL_Widget* pMessageForm) { | 569                                    IFWL_Widget* pMessageForm) { | 
| 569   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 570   CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 
| 570   if (!pWidgetMgr) | 571   if (!pWidgetMgr) | 
| 571     return FALSE; | 572     return FALSE; | 
| 572   IFWL_Widget* pTarget = NULL; | 573   IFWL_Widget* pTarget = nullptr; | 
| 573   if (m_pGrab) | 574   if (m_pGrab) | 
| 574     pTarget = m_pGrab; | 575     pTarget = m_pGrab; | 
| 575   if (!pTarget) { | 576   if (!pTarget) { | 
| 576     pTarget = | 577     pTarget = | 
| 577         pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 578         pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); | 
| 578   } | 579   } | 
| 579   if (pTarget) { | 580   if (pTarget) { | 
| 580     if (pMessageForm != pTarget) { | 581     if (pMessageForm != pTarget) { | 
| 581       pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy); | 582       pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy); | 
| 582     } | 583     } | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 699 | 700 | 
| 700 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 701 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 
| 701   return m_nInitDelayTime; | 702   return m_nInitDelayTime; | 
| 702 } | 703 } | 
| 703 | 704 | 
| 704 int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | 705 int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | 
| 705   return m_nAutoPopDelayTime; | 706   return m_nAutoPopDelayTime; | 
| 706 } | 707 } | 
| 707 | 708 | 
| 708 CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { | 709 CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { | 
| 709   return NULL; | 710   return nullptr; | 
| 710 } | 711 } | 
| 711 | 712 | 
| 712 CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { | 713 CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { | 
| 713   return CFX_SizeF(); | 714   return CFX_SizeF(); | 
| 714 } | 715 } | 
| 715 | 716 | 
| 716 CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { | 717 CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { | 
| 717   return m_fAnchor; | 718   return m_fAnchor; | 
| 718 } | 719 } | 
| 719 | 720 | 
| 720 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, | 721 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, | 
| 721                                    IFWL_Widget* pListener) | 722                                    IFWL_Widget* pListener) | 
| 722     : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} | 723     : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} | 
| 723 CFWL_EventTarget::~CFWL_EventTarget() { | 724 CFWL_EventTarget::~CFWL_EventTarget() { | 
| 724   m_eventSources.RemoveAll(); | 725   m_eventSources.RemoveAll(); | 
| 725 } | 726 } | 
| 726 | 727 | 
| 727 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 728 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 
| 728                                          uint32_t dwFilter) { | 729                                          uint32_t dwFilter) { | 
| 729   if (pSource) { | 730   if (pSource) { | 
| 730     m_eventSources.SetAt(pSource, dwFilter); | 731     m_eventSources.SetAt(pSource, dwFilter); | 
| 731     return m_eventSources.GetCount(); | 732     return m_eventSources.GetCount(); | 
| 732   } | 733   } | 
| 733   return 1; | 734   return 1; | 
| 734 } | 735 } | 
| 735 | 736 | 
| 736 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { | 737 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { | 
| 737   IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL); | 738   IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(nullptr); | 
| 738   if (!pDelegate) | 739   if (!pDelegate) | 
| 739     return FALSE; | 740     return FALSE; | 
| 740   if (m_eventSources.GetCount() == 0) { | 741   if (m_eventSources.GetCount() == 0) { | 
| 741     pDelegate->OnProcessEvent(pEvent); | 742     pDelegate->OnProcessEvent(pEvent); | 
| 742     return TRUE; | 743     return TRUE; | 
| 743   } | 744   } | 
| 744   FX_POSITION pos = m_eventSources.GetStartPosition(); | 745   FX_POSITION pos = m_eventSources.GetStartPosition(); | 
| 745   while (pos) { | 746   while (pos) { | 
| 746     IFWL_Widget* pSource = NULL; | 747     IFWL_Widget* pSource = nullptr; | 
| 747     uint32_t dwFilter = 0; | 748     uint32_t dwFilter = 0; | 
| 748     m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); | 749     m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); | 
| 749     if (pSource == pEvent->m_pSrcTarget || | 750     if (pSource == pEvent->m_pSrcTarget || | 
| 750         pEvent->GetClassID() == CFWL_EventType::Idle) { | 751         pEvent->GetClassID() == CFWL_EventType::Idle) { | 
| 751       if (IsFilterEvent(pEvent, dwFilter)) { | 752       if (IsFilterEvent(pEvent, dwFilter)) { | 
| 752         pDelegate->OnProcessEvent(pEvent); | 753         pDelegate->OnProcessEvent(pEvent); | 
| 753         return TRUE; | 754         return TRUE; | 
| 754       } | 755       } | 
| 755     } | 756     } | 
| 756   } | 757   } | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 777       return !!(dwFilter & FWL_EVENT_CLOSE_MASK); | 778       return !!(dwFilter & FWL_EVENT_CLOSE_MASK); | 
| 778     case CFWL_EventType::SizeChanged: | 779     case CFWL_EventType::SizeChanged: | 
| 779       return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); | 780       return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); | 
| 780     case CFWL_EventType::Idle: | 781     case CFWL_EventType::Idle: | 
| 781       return !!(dwFilter & FWL_EVENT_IDLE_MASK); | 782       return !!(dwFilter & FWL_EVENT_IDLE_MASK); | 
| 782     default: | 783     default: | 
| 783       return !!(dwFilter & FWL_EVENT_CONTROL_MASK); | 784       return !!(dwFilter & FWL_EVENT_CONTROL_MASK); | 
| 784   } | 785   } | 
| 785 } | 786 } | 
| 786 | 787 | 
| 787 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = NULL; | 788 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; | 
| 788 | 789 | 
| 789 CFWL_ToolTipContainer::CFWL_ToolTipContainer() | 790 CFWL_ToolTipContainer::CFWL_ToolTipContainer() | 
| 790     : pCurTarget(NULL), m_pToolTipImp(NULL) { | 791     : pCurTarget(nullptr), m_pToolTipImp(nullptr) { | 
| 791   m_ToolTipDp = new CFWL_CoreToolTipDP; | 792   m_ToolTipDp = new CFWL_CoreToolTipDP; | 
| 792   m_ToolTipDp->m_nInitDelayTime = 0; | 793   m_ToolTipDp->m_nInitDelayTime = 0; | 
| 793   m_ToolTipDp->m_nAutoPopDelayTime = 2000; | 794   m_ToolTipDp->m_nAutoPopDelayTime = 2000; | 
| 794 } | 795 } | 
| 795 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { | 796 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { | 
| 796   if (m_pToolTipImp) { | 797   if (m_pToolTipImp) { | 
| 797     IFWL_ToolTip* pToolTip = | 798     IFWL_ToolTip* pToolTip = | 
| 798         static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); | 799         static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); | 
| 799     pToolTip->Finalize(); | 800     pToolTip->Finalize(); | 
| 800     delete pToolTip; | 801     delete pToolTip; | 
| 801   } | 802   } | 
| 802   delete m_ToolTipDp; | 803   delete m_ToolTipDp; | 
| 803 } | 804 } | 
| 804 | 805 | 
| 805 // static | 806 // static | 
| 806 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { | 807 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { | 
| 807   if (!s_pInstance) | 808   if (!s_pInstance) | 
| 808     s_pInstance = new CFWL_ToolTipContainer; | 809     s_pInstance = new CFWL_ToolTipContainer; | 
| 809   return s_pInstance; | 810   return s_pInstance; | 
| 810 } | 811 } | 
| 811 | 812 | 
| 812 // static | 813 // static | 
| 813 void CFWL_ToolTipContainer::DeleteInstance() { | 814 void CFWL_ToolTipContainer::DeleteInstance() { | 
| 814   delete s_pInstance; | 815   delete s_pInstance; | 
| 815   s_pInstance = NULL; | 816   s_pInstance = nullptr; | 
| 816 } | 817 } | 
| 817 | 818 | 
| 818 FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { | 819 FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { | 
| 819   if (m_arrWidget.Find(pTarget) < 0) { | 820   if (m_arrWidget.Find(pTarget) < 0) { | 
| 820     m_arrWidget.Add(pTarget); | 821     m_arrWidget.Add(pTarget); | 
| 821     return FWL_Error::Succeeded; | 822     return FWL_Error::Succeeded; | 
| 822   } | 823   } | 
| 823   return FWL_Error::Indefinite; | 824   return FWL_Error::Indefinite; | 
| 824 } | 825 } | 
| 825 FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget( | 826 FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget( | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 838     if (p->GetWidget() == pWedget) { | 839     if (p->GetWidget() == pWedget) { | 
| 839       pCurTarget = p; | 840       pCurTarget = p; | 
| 840       return TRUE; | 841       return TRUE; | 
| 841     } | 842     } | 
| 842   } | 843   } | 
| 843   return FALSE; | 844   return FALSE; | 
| 844 } | 845 } | 
| 845 FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, | 846 FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, | 
| 846                                             IFWL_Widget* pOwner) { | 847                                             IFWL_Widget* pOwner) { | 
| 847   if (HasToolTip(pEvt->m_pDstTarget)) { | 848   if (HasToolTip(pEvt->m_pDstTarget)) { | 
| 848     if (NULL == m_pToolTipImp) { | 849     if (!m_pToolTipImp) { | 
| 849       CFWL_WidgetImpProperties prop; | 850       CFWL_WidgetImpProperties prop; | 
| 850       prop.m_pDataProvider = m_ToolTipDp; | 851       prop.m_pDataProvider = m_ToolTipDp; | 
| 851       prop.m_pOwner = pOwner; | 852       prop.m_pOwner = pOwner; | 
| 852       CFX_RectF rtTooltip; | 853       CFX_RectF rtTooltip; | 
| 853       rtTooltip.Set(150, 150, 100, 50); | 854       rtTooltip.Set(150, 150, 100, 50); | 
| 854       prop.m_rtWidget = rtTooltip; | 855       prop.m_rtWidget = rtTooltip; | 
| 855       IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr); | 856       IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr); | 
| 856       pToolTip->Initialize(); | 857       pToolTip->Initialize(); | 
| 857       m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl()); | 858       m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl()); | 
| 858       m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0); | 859       m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 877         rt.height = r.height; | 878         rt.height = r.height; | 
| 878       } | 879       } | 
| 879       CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); | 880       CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); | 
| 880       if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) { | 881       if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) { | 
| 881         rt.left = pt.x; | 882         rt.left = pt.x; | 
| 882         rt.top = pt.y; | 883         rt.top = pt.y; | 
| 883         m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); | 884         m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); | 
| 884       } else { | 885       } else { | 
| 885         CFX_RectF rtAnchor; | 886         CFX_RectF rtAnchor; | 
| 886         pCurTarget->GetWidget()->GetClientRect(rtAnchor); | 887         pCurTarget->GetWidget()->GetClientRect(rtAnchor); | 
| 887         pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top); | 888         pCurTarget->GetWidget()->TransformTo(nullptr, rtAnchor.left, | 
|  | 889                                              rtAnchor.top); | 
| 888         m_pToolTipImp->SetAnchor(rtAnchor); | 890         m_pToolTipImp->SetAnchor(rtAnchor); | 
| 889         m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); | 891         m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); | 
| 890       } | 892       } | 
| 891       m_pToolTipImp->SetWidgetRect(rt); | 893       m_pToolTipImp->SetWidgetRect(rt); | 
| 892       m_pToolTipImp->Update(); | 894       m_pToolTipImp->Update(); | 
| 893       m_pToolTipImp->Show(); | 895       m_pToolTipImp->Show(); | 
| 894     } | 896     } | 
| 895     return TRUE; | 897     return TRUE; | 
| 896   } | 898   } | 
| 897   return FALSE; | 899   return FALSE; | 
| 898 } | 900 } | 
| 899 FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { | 901 FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { | 
| 900   if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 902   if (HasToolTip(pEvt->m_pDstTarget) && m_pToolTipImp) { | 
| 901     m_pToolTipImp->Hide(); | 903     m_pToolTipImp->Hide(); | 
| 902     pCurTarget = NULL; | 904     pCurTarget = nullptr; | 
| 903     return TRUE; | 905     return TRUE; | 
| 904   } | 906   } | 
| 905   return FALSE; | 907   return FALSE; | 
| 906 } | 908 } | 
| 907 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 909 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 
| 908   return pCurTarget; | 910   return pCurTarget; | 
| 909 } | 911 } | 
| OLD | NEW | 
|---|