| 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" |
| 11 #include "xfa/fwl/basewidget/ifwl_tooltip.h" | 11 #include "xfa/fwl/basewidget/ifwl_tooltip.h" |
| 12 #include "xfa/fwl/core/cfwl_message.h" | 12 #include "xfa/fwl/core/cfwl_message.h" |
| 13 #include "xfa/fwl/core/fwl_appimp.h" | 13 #include "xfa/fwl/core/fwl_appimp.h" |
| 14 #include "xfa/fwl/core/fwl_formimp.h" | 14 #include "xfa/fwl/core/fwl_formimp.h" |
| 15 #include "xfa/fwl/core/fwl_widgetimp.h" | 15 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 16 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 16 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 17 #include "xfa/fwl/core/ifwl_app.h" | 17 #include "xfa/fwl/core/ifwl_app.h" |
| 18 #include "xfa/fwl/core/ifwl_tooltiptarget.h" | 18 #include "xfa/fwl/core/ifwl_tooltiptarget.h" |
| 19 | 19 |
| 20 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) | 20 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) |
| 21 : m_pForm(pForm), m_bContinueModal(TRUE) {} | 21 : m_pForm(pForm), m_bContinueModal(TRUE) {} |
| 22 | 22 |
| 23 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { | 23 FWL_Error CFWL_NoteLoop::Idle(int32_t count) { |
| 24 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | 24 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) |
| 25 if (count <= 0) { | 25 if (count <= 0) { |
| 26 #endif | 26 #endif |
| 27 CFWL_EvtIdle ev; | 27 CFWL_EvtIdle ev; |
| 28 IFWL_App* pApp = FWL_GetApp(); | 28 IFWL_App* pApp = FWL_GetApp(); |
| 29 if (!pApp) | 29 if (!pApp) |
| 30 return FWL_ERR_Indefinite; | 30 return FWL_Error::Indefinite; |
| 31 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 31 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 32 if (!pDriver) | 32 if (!pDriver) |
| 33 return FWL_ERR_Indefinite; | 33 return FWL_Error::Indefinite; |
| 34 pDriver->SendEvent(&ev); | 34 pDriver->SendEvent(&ev); |
| 35 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | 35 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) |
| 36 } | 36 } |
| 37 #endif | 37 #endif |
| 38 return FWL_ERR_Indefinite; | 38 return FWL_Error::Indefinite; |
| 39 } | 39 } |
| 40 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { | 40 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { |
| 41 return m_pForm; | 41 return m_pForm; |
| 42 } | 42 } |
| 43 FX_BOOL CFWL_NoteLoop::ContinueModal() { | 43 FX_BOOL CFWL_NoteLoop::ContinueModal() { |
| 44 return m_bContinueModal; | 44 return m_bContinueModal; |
| 45 } | 45 } |
| 46 FWL_ERR CFWL_NoteLoop::EndModalLoop() { | 46 FWL_Error CFWL_NoteLoop::EndModalLoop() { |
| 47 m_bContinueModal = FALSE; | 47 m_bContinueModal = FALSE; |
| 48 return FWL_ERR_Succeeded; | 48 return FWL_Error::Succeeded; |
| 49 } | 49 } |
| 50 | 50 |
| 51 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { | 51 FWL_Error CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { |
| 52 m_pForm = pForm; | 52 m_pForm = pForm; |
| 53 return FWL_ERR_Succeeded; | 53 return FWL_Error::Succeeded; |
| 54 } | 54 } |
| 55 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { | 55 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { |
| 56 CFWL_EvtMenuCommand ev; | 56 CFWL_EvtMenuCommand ev; |
| 57 ev.m_iCommand = dwCommand; | 57 ev.m_iCommand = dwCommand; |
| 58 IFWL_App* pApp = m_pForm->GetOwnerApp(); | 58 IFWL_App* pApp = m_pForm->GetOwnerApp(); |
| 59 if (!pApp) | 59 if (!pApp) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 62 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 63 if (!pDriver) | 63 if (!pDriver) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 CFWL_EventTarget* pEventTarget = static_cast<CFWL_EventTarget*>(value); | 106 CFWL_EventTarget* pEventTarget = static_cast<CFWL_EventTarget*>(value); |
| 107 if (pEventTarget && !pEventTarget->IsInvalid()) | 107 if (pEventTarget && !pEventTarget->IsInvalid()) |
| 108 pEventTarget->ProcessEvent(pNote); | 108 pEventTarget->ProcessEvent(pNote); |
| 109 } | 109 } |
| 110 m_sendEventCalled--; | 110 m_sendEventCalled--; |
| 111 return TRUE; | 111 return TRUE; |
| 112 } | 112 } |
| 113 | 113 |
| 114 #define FWL_NoteDriver_EventKey 1100 | 114 #define FWL_NoteDriver_EventKey 1100 |
| 115 FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, | 115 FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, |
| 116 IFWL_Widget* pEventSource, | 116 IFWL_Widget* pEventSource, |
| 117 uint32_t dwFilter) { | 117 uint32_t dwFilter) { |
| 118 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( | 118 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( |
| 119 (void*)(uintptr_t)FWL_NoteDriver_EventKey); | 119 (void*)(uintptr_t)FWL_NoteDriver_EventKey); |
| 120 if (dwkey == 0) { | 120 if (dwkey == 0) { |
| 121 void* random = FX_Random_MT_Start(0); | 121 void* random = FX_Random_MT_Start(0); |
| 122 dwkey = rand(); | 122 dwkey = rand(); |
| 123 FX_Random_MT_Close(random); | 123 FX_Random_MT_Close(random); |
| 124 pListener->SetPrivateData((void*)(uintptr_t)FWL_NoteDriver_EventKey, | 124 pListener->SetPrivateData((void*)(uintptr_t)FWL_NoteDriver_EventKey, |
| 125 (void*)(uintptr_t)dwkey, NULL); | 125 (void*)(uintptr_t)dwkey, NULL); |
| 126 } | 126 } |
| 127 CFWL_EventTarget* value = NULL; | 127 CFWL_EventTarget* value = NULL; |
| 128 if (!m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { | 128 if (!m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { |
| 129 value = new CFWL_EventTarget(this, pListener); | 129 value = new CFWL_EventTarget(this, pListener); |
| 130 m_eventTargets.SetAt((void*)(uintptr_t)dwkey, value); | 130 m_eventTargets.SetAt((void*)(uintptr_t)dwkey, value); |
| 131 } | 131 } |
| 132 value->SetEventSource(pEventSource, dwFilter); | 132 value->SetEventSource(pEventSource, dwFilter); |
| 133 return FWL_ERR_Succeeded; | 133 return FWL_Error::Succeeded; |
| 134 } | 134 } |
| 135 FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { | 135 FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { |
| 136 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( | 136 uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( |
| 137 (void*)(uintptr_t)FWL_NoteDriver_EventKey); | 137 (void*)(uintptr_t)FWL_NoteDriver_EventKey); |
| 138 if (dwkey == 0) { | 138 if (dwkey == 0) { |
| 139 return FWL_ERR_Indefinite; | 139 return FWL_Error::Indefinite; |
| 140 } | 140 } |
| 141 CFWL_EventTarget* value = NULL; | 141 CFWL_EventTarget* value = NULL; |
| 142 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { | 142 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { |
| 143 value->FlagInvalid(); | 143 value->FlagInvalid(); |
| 144 } | 144 } |
| 145 return FWL_ERR_Succeeded; | 145 return FWL_Error::Succeeded; |
| 146 } | 146 } |
| 147 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { | 147 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { |
| 148 ClearInvalidEventTargets(bRemoveAll); | 148 ClearInvalidEventTargets(bRemoveAll); |
| 149 } | 149 } |
| 150 IFWL_App* CFWL_NoteDriver::GetOwnerApp() const { | 150 IFWL_App* CFWL_NoteDriver::GetOwnerApp() const { |
| 151 return FWL_GetApp(); | 151 return FWL_GetApp(); |
| 152 } | 152 } |
| 153 FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { | 153 FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { |
| 154 m_noteLoopQueue.Add(pNoteLoop); | 154 m_noteLoopQueue.Add(pNoteLoop); |
| 155 return FWL_ERR_Succeeded; | 155 return FWL_Error::Succeeded; |
| 156 } | 156 } |
| 157 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { | 157 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { |
| 158 int32_t pos = m_noteLoopQueue.GetSize(); | 158 int32_t pos = m_noteLoopQueue.GetSize(); |
| 159 if (pos <= 0) | 159 if (pos <= 0) |
| 160 return nullptr; | 160 return nullptr; |
| 161 | 161 |
| 162 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); | 162 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); |
| 163 m_noteLoopQueue.RemoveAt(pos - 1); | 163 m_noteLoopQueue.RemoveAt(pos - 1); |
| 164 return p; | 164 return p; |
| 165 } | 165 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 196 if (bNotify) { | 196 if (bNotify) { |
| 197 ms.m_dwExtend = 1; | 197 ms.m_dwExtend = 1; |
| 198 } | 198 } |
| 199 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); | 199 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); |
| 200 if (pDelegate) { | 200 if (pDelegate) { |
| 201 pDelegate->OnProcessMessage(&ms); | 201 pDelegate->OnProcessMessage(&ms); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 return TRUE; | 204 return TRUE; |
| 205 } | 205 } |
| 206 FWL_ERR CFWL_NoteDriver::Run() { | 206 FWL_Error CFWL_NoteDriver::Run() { |
| 207 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 207 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 208 if (!pWidgetMgr) | 208 if (!pWidgetMgr) |
| 209 return FWL_ERR_Indefinite; | 209 return FWL_Error::Indefinite; |
| 210 | 210 |
| 211 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 211 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
| 212 _FX_OS_ == _FX_WIN64_) | 212 _FX_OS_ == _FX_WIN64_) |
| 213 CFWL_NoteLoop* pTopLoop = NULL; | 213 CFWL_NoteLoop* pTopLoop = NULL; |
| 214 for (;;) { | 214 for (;;) { |
| 215 pTopLoop = GetTopLoop(); | 215 pTopLoop = GetTopLoop(); |
| 216 if (!pTopLoop || !pTopLoop->ContinueModal()) | 216 if (!pTopLoop || !pTopLoop->ContinueModal()) |
| 217 break; | 217 break; |
| 218 if (UnqueueMessage(pTopLoop)) | 218 if (UnqueueMessage(pTopLoop)) |
| 219 continue; | 219 continue; |
| 220 } | 220 } |
| 221 #endif | 221 #endif |
| 222 | 222 |
| 223 return FWL_ERR_Succeeded; | 223 return FWL_Error::Succeeded; |
| 224 } | 224 } |
| 225 | 225 |
| 226 IFWL_Widget* CFWL_NoteDriver::GetFocus() { | 226 IFWL_Widget* CFWL_NoteDriver::GetFocus() { |
| 227 return m_pFocus; | 227 return m_pFocus; |
| 228 } | 228 } |
| 229 IFWL_Widget* CFWL_NoteDriver::GetHover() { | 229 IFWL_Widget* CFWL_NoteDriver::GetHover() { |
| 230 return m_pHover; | 230 return m_pHover; |
| 231 } | 231 } |
| 232 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { | 232 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { |
| 233 m_pHover = pHover; | 233 m_pHover = pHover; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); | 266 CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus(); |
| 267 if (!pSubFocus) | 267 if (!pSubFocus) |
| 268 return; | 268 return; |
| 269 if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) { | 269 if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) { |
| 270 pForm->SetSubFocus(NULL); | 270 pForm->SetSubFocus(NULL); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { | 275 FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { |
| 276 if (!pForm) | 276 if (!pForm) |
| 277 return FWL_ERR_Indefinite; | 277 return FWL_Error::Indefinite; |
| 278 if (m_forms.Find(pForm) >= 0) { | 278 if (m_forms.Find(pForm) >= 0) { |
| 279 return FWL_ERR_Indefinite; | 279 return FWL_Error::Indefinite; |
| 280 } | 280 } |
| 281 m_forms.Add(pForm); | 281 m_forms.Add(pForm); |
| 282 if (m_forms.GetSize() == 1) { | 282 if (m_forms.GetSize() == 1) { |
| 283 CFWL_NoteLoop* pLoop = | 283 CFWL_NoteLoop* pLoop = |
| 284 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); | 284 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); |
| 285 if (!pLoop) | 285 if (!pLoop) |
| 286 return FWL_ERR_Indefinite; | 286 return FWL_Error::Indefinite; |
| 287 pLoop->SetMainForm(pForm); | 287 pLoop->SetMainForm(pForm); |
| 288 } | 288 } |
| 289 return FWL_ERR_Succeeded; | 289 return FWL_Error::Succeeded; |
| 290 } | 290 } |
| 291 FWL_ERR CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { | 291 FWL_Error CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { |
| 292 if (!pForm) | 292 if (!pForm) |
| 293 return FWL_ERR_Indefinite; | 293 return FWL_Error::Indefinite; |
| 294 int32_t nIndex = m_forms.Find(pForm); | 294 int32_t nIndex = m_forms.Find(pForm); |
| 295 if (nIndex < 0) { | 295 if (nIndex < 0) { |
| 296 return FWL_ERR_Indefinite; | 296 return FWL_Error::Indefinite; |
| 297 } | 297 } |
| 298 m_forms.RemoveAt(nIndex); | 298 m_forms.RemoveAt(nIndex); |
| 299 return FWL_ERR_Succeeded; | 299 return FWL_Error::Succeeded; |
| 300 } | 300 } |
| 301 FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { | 301 FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { |
| 302 pMessage->Retain(); | 302 pMessage->Retain(); |
| 303 m_noteQueue.Add(pMessage); | 303 m_noteQueue.Add(pMessage); |
| 304 return TRUE; | 304 return TRUE; |
| 305 } | 305 } |
| 306 FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { | 306 FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { |
| 307 if (m_noteQueue.GetSize() < 1) { | 307 if (m_noteQueue.GetSize() < 1) { |
| 308 return FALSE; | 308 return FALSE; |
| 309 } | 309 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 CFWL_EventTarget* pEventTarget = NULL; | 681 CFWL_EventTarget* pEventTarget = NULL; |
| 682 m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); | 682 m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); |
| 683 if (pEventTarget && (bRemoveAll || pEventTarget->IsInvalid())) { | 683 if (pEventTarget && (bRemoveAll || pEventTarget->IsInvalid())) { |
| 684 m_eventTargets.RemoveKey(key); | 684 m_eventTargets.RemoveKey(key); |
| 685 delete pEventTarget; | 685 delete pEventTarget; |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { | 689 class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { |
| 690 public: | 690 public: |
| 691 FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); | 691 FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); |
| 692 int32_t GetInitialDelay(IFWL_Widget* pWidget); | 692 int32_t GetInitialDelay(IFWL_Widget* pWidget); |
| 693 int32_t GetAutoPopDelay(IFWL_Widget* pWidget); | 693 int32_t GetAutoPopDelay(IFWL_Widget* pWidget); |
| 694 CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); | 694 CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); |
| 695 CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget); | 695 CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget); |
| 696 CFX_RectF GetAnchor(); | 696 CFX_RectF GetAnchor(); |
| 697 CFWL_CoreToolTipDP(); | 697 CFWL_CoreToolTipDP(); |
| 698 | 698 |
| 699 CFX_WideString m_wsCaption; | 699 CFX_WideString m_wsCaption; |
| 700 int32_t m_nInitDelayTime; | 700 int32_t m_nInitDelayTime; |
| 701 int32_t m_nAutoPopDelayTime; | 701 int32_t m_nAutoPopDelayTime; |
| 702 CFX_RectF m_fAnchor; | 702 CFX_RectF m_fAnchor; |
| 703 }; | 703 }; |
| 704 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { | 704 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { |
| 705 m_nInitDelayTime = 500; | 705 m_nInitDelayTime = 500; |
| 706 m_nAutoPopDelayTime = 50000; | 706 m_nAutoPopDelayTime = 50000; |
| 707 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | 707 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); |
| 708 } | 708 } |
| 709 FWL_ERR CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, | 709 FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, |
| 710 CFX_WideString& wsCaption) { | 710 CFX_WideString& wsCaption) { |
| 711 wsCaption = m_wsCaption; | 711 wsCaption = m_wsCaption; |
| 712 return FWL_ERR_Succeeded; | 712 return FWL_Error::Succeeded; |
| 713 } | 713 } |
| 714 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 714 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { |
| 715 return m_nInitDelayTime; | 715 return m_nInitDelayTime; |
| 716 } | 716 } |
| 717 int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | 717 int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { |
| 718 return m_nAutoPopDelayTime; | 718 return m_nAutoPopDelayTime; |
| 719 } | 719 } |
| 720 CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { | 720 CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { |
| 721 return NULL; | 721 return NULL; |
| 722 } | 722 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 s_pInstance = new CFWL_ToolTipContainer; | 813 s_pInstance = new CFWL_ToolTipContainer; |
| 814 return s_pInstance; | 814 return s_pInstance; |
| 815 } | 815 } |
| 816 | 816 |
| 817 // static | 817 // static |
| 818 void CFWL_ToolTipContainer::DeleteInstance() { | 818 void CFWL_ToolTipContainer::DeleteInstance() { |
| 819 delete s_pInstance; | 819 delete s_pInstance; |
| 820 s_pInstance = NULL; | 820 s_pInstance = NULL; |
| 821 } | 821 } |
| 822 | 822 |
| 823 FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { | 823 FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { |
| 824 if (m_arrWidget.Find(pTarget) < 0) { | 824 if (m_arrWidget.Find(pTarget) < 0) { |
| 825 m_arrWidget.Add(pTarget); | 825 m_arrWidget.Add(pTarget); |
| 826 return FWL_ERR_Succeeded; | 826 return FWL_Error::Succeeded; |
| 827 } | 827 } |
| 828 return FWL_ERR_Indefinite; | 828 return FWL_Error::Indefinite; |
| 829 } | 829 } |
| 830 FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) { | 830 FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget( |
| 831 IFWL_ToolTipTarget* pTarget) { |
| 831 int index = m_arrWidget.Find(pTarget); | 832 int index = m_arrWidget.Find(pTarget); |
| 832 if (index >= 0) { | 833 if (index >= 0) { |
| 833 m_arrWidget.RemoveAt(index); | 834 m_arrWidget.RemoveAt(index); |
| 834 return FWL_ERR_Succeeded; | 835 return FWL_Error::Succeeded; |
| 835 } | 836 } |
| 836 return FWL_ERR_Indefinite; | 837 return FWL_Error::Indefinite; |
| 837 } | 838 } |
| 838 FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) { | 839 FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) { |
| 839 int32_t iCount = m_arrWidget.GetSize(); | 840 int32_t iCount = m_arrWidget.GetSize(); |
| 840 for (int32_t i = 0; i < iCount; i++) { | 841 for (int32_t i = 0; i < iCount; i++) { |
| 841 IFWL_ToolTipTarget* p = m_arrWidget[i]; | 842 IFWL_ToolTipTarget* p = m_arrWidget[i]; |
| 842 if (p->GetWidget() == pWedget) { | 843 if (p->GetWidget() == pWedget) { |
| 843 pCurTarget = p; | 844 pCurTarget = p; |
| 844 return TRUE; | 845 return TRUE; |
| 845 } | 846 } |
| 846 } | 847 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 874 if (sz.x > 0 && sz.y > 0) { | 875 if (sz.x > 0 && sz.y > 0) { |
| 875 rt.width = sz.x; | 876 rt.width = sz.x; |
| 876 rt.height = sz.y; | 877 rt.height = sz.y; |
| 877 } else { | 878 } else { |
| 878 CFX_RectF r; | 879 CFX_RectF r; |
| 879 m_pToolTipImp->GetWidgetRect(r, TRUE); | 880 m_pToolTipImp->GetWidgetRect(r, TRUE); |
| 880 rt.width = r.width; | 881 rt.width = r.width; |
| 881 rt.height = r.height; | 882 rt.height = r.height; |
| 882 } | 883 } |
| 883 CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); | 884 CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); |
| 884 if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) { | 885 if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) { |
| 885 rt.left = pt.x; | 886 rt.left = pt.x; |
| 886 rt.top = pt.y; | 887 rt.top = pt.y; |
| 887 m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); | 888 m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); |
| 888 } else { | 889 } else { |
| 889 CFX_RectF rtAnchor; | 890 CFX_RectF rtAnchor; |
| 890 pCurTarget->GetWidget()->GetClientRect(rtAnchor); | 891 pCurTarget->GetWidget()->GetClientRect(rtAnchor); |
| 891 pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top); | 892 pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top); |
| 892 m_pToolTipImp->SetAnchor(rtAnchor); | 893 m_pToolTipImp->SetAnchor(rtAnchor); |
| 893 m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); | 894 m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); |
| 894 } | 895 } |
| 895 m_pToolTipImp->SetWidgetRect(rt); | 896 m_pToolTipImp->SetWidgetRect(rt); |
| 896 m_pToolTipImp->Update(); | 897 m_pToolTipImp->Update(); |
| 897 m_pToolTipImp->Show(); | 898 m_pToolTipImp->Show(); |
| 898 } | 899 } |
| 899 return TRUE; | 900 return TRUE; |
| 900 } | 901 } |
| 901 return FALSE; | 902 return FALSE; |
| 902 } | 903 } |
| 903 FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { | 904 FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) { |
| 904 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 905 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
| 905 m_pToolTipImp->Hide(); | 906 m_pToolTipImp->Hide(); |
| 906 pCurTarget = NULL; | 907 pCurTarget = NULL; |
| 907 return TRUE; | 908 return TRUE; |
| 908 } | 909 } |
| 909 return FALSE; | 910 return FALSE; |
| 910 } | 911 } |
| 911 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 912 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
| 912 return pCurTarget; | 913 return pCurTarget; |
| 913 } | 914 } |
| OLD | NEW |