Chromium Code Reviews| 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/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
| 10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
| 11 #include "xfa/fwl/core/cfwl_message.h" | 11 #include "xfa/fwl/core/cfwl_message.h" |
| 12 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 12 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 13 #include "xfa/fwl/core/ifwl_app.h" | 13 #include "xfa/fwl/core/ifwl_app.h" |
| 14 #include "xfa/fwl/core/ifwl_tooltip.h" | 14 #include "xfa/fwl/core/ifwl_tooltip.h" |
| 15 | 15 |
| 16 CFWL_NoteLoop::CFWL_NoteLoop(IFWL_Widget* pForm) | 16 CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {} |
| 17 : m_pForm(pForm), m_bContinueModal(true) {} | |
| 18 | 17 |
| 19 FWL_Error CFWL_NoteLoop::Idle(int32_t count) { | |
| 20 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | |
| 21 if (count <= 0) { | |
| 22 #endif | |
| 23 CFWL_EvtIdle ev; | |
| 24 const IFWL_App* pApp = m_pForm->GetOwnerApp(); | |
| 25 if (!pApp) | |
| 26 return FWL_Error::Indefinite; | |
| 27 | |
| 28 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | |
| 29 if (!pDriver) | |
| 30 return FWL_Error::Indefinite; | |
| 31 | |
| 32 pDriver->SendEvent(&ev); | |
| 33 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | |
| 34 } | |
| 35 #endif | |
| 36 return FWL_Error::Indefinite; | |
| 37 } | |
| 38 IFWL_Widget* CFWL_NoteLoop::GetForm() { | |
| 39 return m_pForm; | |
| 40 } | |
| 41 bool CFWL_NoteLoop::ContinueModal() { | |
| 42 return m_bContinueModal; | |
| 43 } | |
| 44 FWL_Error CFWL_NoteLoop::EndModalLoop() { | |
| 45 m_bContinueModal = false; | |
| 46 return FWL_Error::Succeeded; | |
| 47 } | |
| 48 | |
| 49 FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) { | |
| 50 m_pForm = pForm; | |
| 51 return FWL_Error::Succeeded; | |
| 52 } | |
| 53 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { | |
| 54 CFWL_EvtMenuCommand ev; | |
| 55 ev.m_iCommand = dwCommand; | |
| 56 const IFWL_App* pApp = m_pForm->GetOwnerApp(); | |
| 57 if (!pApp) | |
| 58 return; | |
| 59 | |
| 60 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | |
| 61 if (!pDriver) | |
| 62 return; | |
| 63 | |
| 64 pDriver->SendEvent(&ev); | |
| 65 } | |
| 66 CFWL_NoteDriver::CFWL_NoteDriver() | 18 CFWL_NoteDriver::CFWL_NoteDriver() |
| 67 : m_pHover(nullptr), | 19 : m_pHover(nullptr), |
| 68 m_pFocus(nullptr), | 20 m_pFocus(nullptr), |
| 69 m_pGrab(nullptr), | 21 m_pGrab(nullptr), |
| 70 m_pNoteLoop(new CFWL_NoteLoop) { | 22 m_pNoteLoop(new CFWL_NoteLoop) { |
| 71 PushNoteLoop(m_pNoteLoop.get()); | 23 PushNoteLoop(m_pNoteLoop.get()); |
| 72 } | 24 } |
| 73 CFWL_NoteDriver::~CFWL_NoteDriver() { | 25 CFWL_NoteDriver::~CFWL_NoteDriver() { |
| 74 ClearInvalidEventTargets(true); | 26 ClearEventTargets(true); |
| 75 } | 27 } |
| 76 | 28 |
| 77 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { | 29 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { |
| 78 if (m_eventTargets.empty()) | 30 if (m_eventTargets.empty()) |
| 79 return; | 31 return; |
| 80 | 32 |
| 81 for (const auto& pair : m_eventTargets) { | 33 for (const auto& pair : m_eventTargets) { |
| 82 CFWL_EventTarget* pEventTarget = pair.second; | 34 CFWL_EventTarget* pEventTarget = pair.second; |
| 83 if (pEventTarget && !pEventTarget->IsInvalid()) | 35 if (pEventTarget && !pEventTarget->IsInvalid()) |
| 84 pEventTarget->ProcessEvent(pNote); | 36 pEventTarget->ProcessEvent(pNote); |
| 85 } | 37 } |
| 86 } | 38 } |
| 87 | 39 |
| 88 FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, | 40 void CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, |
| 89 IFWL_Widget* pEventSource, | 41 IFWL_Widget* pEventSource, |
| 90 uint32_t dwFilter) { | 42 uint32_t dwFilter) { |
| 91 uint32_t key = pListener->GetEventKey(); | 43 uint32_t key = pListener->GetEventKey(); |
| 92 if (key == 0) { | 44 if (key == 0) { |
| 93 do { | 45 do { |
| 94 key = rand(); | 46 key = rand(); |
| 95 } while (key == 0 || pdfium::ContainsKey(m_eventTargets, key)); | 47 } while (key == 0 || pdfium::ContainsKey(m_eventTargets, key)); |
| 96 pListener->SetEventKey(key); | 48 pListener->SetEventKey(key); |
| 97 } | 49 } |
| 98 if (!m_eventTargets[key]) | 50 if (!m_eventTargets[key]) |
| 99 m_eventTargets[key] = new CFWL_EventTarget(this, pListener); | 51 m_eventTargets[key] = new CFWL_EventTarget(pListener); |
| 100 | 52 |
| 101 m_eventTargets[key]->SetEventSource(pEventSource, dwFilter); | 53 m_eventTargets[key]->SetEventSource(pEventSource, dwFilter); |
| 102 return FWL_Error::Succeeded; | |
| 103 } | 54 } |
| 104 | 55 |
| 105 FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { | 56 void CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { |
| 106 uint32_t key = pListener->GetEventKey(); | 57 uint32_t key = pListener->GetEventKey(); |
| 107 if (key == 0) | 58 if (key == 0) |
| 108 return FWL_Error::Indefinite; | 59 return; |
| 109 | 60 |
| 110 auto it = m_eventTargets.find(key); | 61 auto it = m_eventTargets.find(key); |
| 111 if (it != m_eventTargets.end()) | 62 if (it != m_eventTargets.end()) |
| 112 it->second->FlagInvalid(); | 63 it->second->FlagInvalid(); |
| 113 | |
| 114 return FWL_Error::Succeeded; | |
| 115 } | 64 } |
| 116 | 65 |
| 117 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { | 66 void CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { |
| 118 ClearInvalidEventTargets(bRemoveAll); | 67 m_noteLoopQueue.Add(pNoteLoop); |
| 119 } | 68 } |
| 120 | 69 |
| 121 FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { | |
| 122 m_noteLoopQueue.Add(pNoteLoop); | |
| 123 return FWL_Error::Succeeded; | |
| 124 } | |
| 125 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { | 70 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { |
| 126 int32_t pos = m_noteLoopQueue.GetSize(); | 71 int32_t pos = m_noteLoopQueue.GetSize(); |
| 127 if (pos <= 0) | 72 if (pos <= 0) |
| 128 return nullptr; | 73 return nullptr; |
| 129 | 74 |
| 130 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); | 75 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); |
| 131 m_noteLoopQueue.RemoveAt(pos - 1); | 76 m_noteLoopQueue.RemoveAt(pos - 1); |
| 132 return p; | 77 return p; |
| 133 } | 78 } |
| 134 bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) { | 79 bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 158 ms.m_pDstTarget = pFocus; | 103 ms.m_pDstTarget = pFocus; |
| 159 if (bNotify) { | 104 if (bNotify) { |
| 160 ms.m_dwExtend = 1; | 105 ms.m_dwExtend = 1; |
| 161 } | 106 } |
| 162 | 107 |
| 163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) | 108 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) |
| 164 pDelegate->OnProcessMessage(&ms); | 109 pDelegate->OnProcessMessage(&ms); |
| 165 } | 110 } |
| 166 return true; | 111 return true; |
| 167 } | 112 } |
| 168 FWL_Error CFWL_NoteDriver::Run() { | 113 |
| 114 void CFWL_NoteDriver::Run() { | |
| 169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 115 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
| 170 _FX_OS_ == _FX_WIN64_) | 116 _FX_OS_ == _FX_WIN64_) |
| 171 CFWL_NoteLoop* pTopLoop = nullptr; | 117 CFWL_NoteLoop* pTopLoop = nullptr; |
| 172 for (;;) { | 118 for (;;) { |
| 173 pTopLoop = GetTopLoop(); | 119 pTopLoop = GetTopLoop(); |
| 174 if (!pTopLoop || !pTopLoop->ContinueModal()) | 120 if (!pTopLoop || !pTopLoop->ContinueModal()) |
| 175 break; | 121 break; |
| 176 if (UnqueueMessage(pTopLoop)) | 122 if (UnqueueMessage(pTopLoop)) |
| 177 continue; | 123 continue; |
| 178 } | 124 } |
| 179 #endif | 125 #endif |
| 180 | |
| 181 return FWL_Error::Succeeded; | |
| 182 } | 126 } |
| 183 | 127 |
| 184 IFWL_Widget* CFWL_NoteDriver::GetFocus() { | |
| 185 return m_pFocus; | |
| 186 } | |
| 187 IFWL_Widget* CFWL_NoteDriver::GetHover() { | |
| 188 return m_pHover; | |
| 189 } | |
| 190 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { | |
| 191 m_pHover = pHover; | |
| 192 } | |
| 193 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, bool bSet) { | |
| 194 m_pGrab = bSet ? pGrab : nullptr; | |
| 195 } | |
| 196 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { | 128 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { |
| 197 if (m_pFocus == pNoteTarget) { | 129 if (m_pFocus == pNoteTarget) { |
| 198 m_pFocus = nullptr; | 130 m_pFocus = nullptr; |
| 199 } | 131 } |
| 200 if (m_pHover == pNoteTarget) { | 132 if (m_pHover == pNoteTarget) { |
| 201 m_pHover = nullptr; | 133 m_pHover = nullptr; |
| 202 } | 134 } |
| 203 if (m_pGrab == pNoteTarget) { | 135 if (m_pGrab == pNoteTarget) { |
| 204 m_pGrab = nullptr; | 136 m_pGrab = nullptr; |
| 205 } | 137 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 223 } | 155 } |
| 224 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); | 156 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); |
| 225 if (!pSubFocus) | 157 if (!pSubFocus) |
| 226 return; | 158 return; |
| 227 if (pSubFocus == pNoteTarget) { | 159 if (pSubFocus == pNoteTarget) { |
| 228 pForm->SetSubFocus(nullptr); | 160 pForm->SetSubFocus(nullptr); |
| 229 } | 161 } |
| 230 } | 162 } |
| 231 } | 163 } |
| 232 | 164 |
| 233 FWL_Error CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) { | 165 void CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) { |
| 234 if (!pForm) | 166 if (!pForm || m_forms.Find(pForm) >= 0) |
| 235 return FWL_Error::Indefinite; | 167 return; |
| 236 if (m_forms.Find(pForm) >= 0) { | 168 |
| 237 return FWL_Error::Indefinite; | |
| 238 } | |
| 239 m_forms.Add(pForm); | 169 m_forms.Add(pForm); |
| 240 if (m_forms.GetSize() == 1) { | 170 if (m_forms.GetSize() == 1) { |
| 241 CFWL_NoteLoop* pLoop = | 171 CFWL_NoteLoop* pLoop = |
| 242 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); | 172 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); |
| 243 if (!pLoop) | 173 if (!pLoop) |
| 244 return FWL_Error::Indefinite; | 174 return; |
| 245 pLoop->SetMainForm(pForm); | 175 pLoop->SetMainForm(pForm); |
| 246 } | 176 } |
| 247 return FWL_Error::Succeeded; | |
| 248 } | 177 } |
| 249 FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { | 178 |
| 179 void CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { | |
| 250 if (!pForm) | 180 if (!pForm) |
| 251 return FWL_Error::Indefinite; | 181 return; |
| 252 int32_t nIndex = m_forms.Find(pForm); | 182 int32_t nIndex = m_forms.Find(pForm); |
| 253 if (nIndex < 0) { | 183 if (nIndex < 0) { |
|
npm
2016/11/14 16:31:51
nit: no {}
dsinclair
2016/11/14 16:44:07
Done.
| |
| 254 return FWL_Error::Indefinite; | 184 return; |
| 255 } | 185 } |
| 256 m_forms.RemoveAt(nIndex); | 186 m_forms.RemoveAt(nIndex); |
| 257 return FWL_Error::Succeeded; | |
| 258 } | 187 } |
| 259 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { | 188 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { |
| 260 pMessage->Retain(); | 189 pMessage->Retain(); |
| 261 m_noteQueue.Add(pMessage); | 190 m_noteQueue.Add(pMessage); |
| 262 return true; | 191 return true; |
| 263 } | 192 } |
| 264 bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { | 193 bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { |
| 265 if (m_noteQueue.GetSize() < 1) { | 194 if (m_noteQueue.GetSize() < 1) { |
| 266 return false; | 195 return false; |
| 267 } | 196 } |
| 268 CFWL_Message* pMessage = m_noteQueue[0]; | 197 CFWL_Message* pMessage = m_noteQueue[0]; |
| 269 m_noteQueue.RemoveAt(0); | 198 m_noteQueue.RemoveAt(0); |
| 270 if (!IsValidMessage(pMessage)) { | 199 if (!IsValidMessage(pMessage)) { |
| 271 pMessage->Release(); | 200 pMessage->Release(); |
| 272 return true; | 201 return true; |
| 273 } | 202 } |
| 274 ProcessMessage(pMessage); | 203 ProcessMessage(pMessage); |
| 275 | 204 |
| 276 pMessage->Release(); | 205 pMessage->Release(); |
| 277 return true; | 206 return true; |
| 278 } | 207 } |
| 279 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { | 208 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { |
| 280 int32_t size = m_noteLoopQueue.GetSize(); | 209 int32_t size = m_noteLoopQueue.GetSize(); |
| 281 if (size <= 0) | 210 if (size <= 0) |
| 282 return nullptr; | 211 return nullptr; |
| 283 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); | 212 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); |
| 284 } | 213 } |
| 285 int32_t CFWL_NoteDriver::CountLoop() { | |
| 286 return m_noteLoopQueue.GetSize(); | |
| 287 } | |
| 288 | 214 |
| 289 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { | 215 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { |
| 290 CFWL_WidgetMgr* pWidgetMgr = | 216 CFWL_WidgetMgr* pWidgetMgr = |
| 291 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); | 217 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); |
| 292 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() | 218 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() |
| 293 ? pMessage->m_pDstTarget | 219 ? pMessage->m_pDstTarget |
| 294 : GetMessageForm(pMessage->m_pDstTarget); | 220 : GetMessageForm(pMessage->m_pDstTarget); |
| 295 if (!pMessageForm) | 221 if (!pMessageForm) |
| 296 return false; | 222 return false; |
| 297 if (DispatchMessage(pMessage, pMessageForm)) { | 223 if (DispatchMessage(pMessage, pMessageForm)) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 } | 545 } |
| 620 if (!pMessageForm && pDstTarget) { | 546 if (!pMessageForm && pDstTarget) { |
| 621 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); | 547 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); |
| 622 if (!pWidgetMgr) | 548 if (!pWidgetMgr) |
| 623 return nullptr; | 549 return nullptr; |
| 624 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); | 550 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); |
| 625 } | 551 } |
| 626 return pMessageForm; | 552 return pMessageForm; |
| 627 } | 553 } |
| 628 | 554 |
| 629 void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) { | 555 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { |
| 630 auto it = m_eventTargets.begin(); | 556 auto it = m_eventTargets.begin(); |
| 631 while (it != m_eventTargets.end()) { | 557 while (it != m_eventTargets.end()) { |
| 632 auto old = it++; | 558 auto old = it++; |
| 633 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 559 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
| 634 delete old->second; | 560 delete old->second; |
| 635 m_eventTargets.erase(old); | 561 m_eventTargets.erase(old); |
| 636 } | 562 } |
| 637 } | 563 } |
| 638 } | 564 } |
| 639 | 565 |
| 640 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, | 566 CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener) |
| 641 IFWL_Widget* pListener) | 567 : m_pListener(pListener), m_bInvalid(false) {} |
| 642 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {} | |
| 643 CFWL_EventTarget::~CFWL_EventTarget() { | 568 CFWL_EventTarget::~CFWL_EventTarget() { |
| 644 m_eventSources.RemoveAll(); | 569 m_eventSources.RemoveAll(); |
| 645 } | 570 } |
| 646 | 571 |
| 647 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 572 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
| 648 uint32_t dwFilter) { | 573 uint32_t dwFilter) { |
| 649 if (pSource) { | 574 if (pSource) { |
| 650 m_eventSources.SetAt(pSource, dwFilter); | 575 m_eventSources.SetAt(pSource, dwFilter); |
| 651 return m_eventSources.GetCount(); | 576 return m_eventSources.GetCount(); |
| 652 } | 577 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 case CFWL_EventType::Close: | 621 case CFWL_EventType::Close: |
| 697 return !!(dwFilter & FWL_EVENT_CLOSE_MASK); | 622 return !!(dwFilter & FWL_EVENT_CLOSE_MASK); |
| 698 case CFWL_EventType::SizeChanged: | 623 case CFWL_EventType::SizeChanged: |
| 699 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); | 624 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); |
| 700 case CFWL_EventType::Idle: | 625 case CFWL_EventType::Idle: |
| 701 return !!(dwFilter & FWL_EVENT_IDLE_MASK); | 626 return !!(dwFilter & FWL_EVENT_IDLE_MASK); |
| 702 default: | 627 default: |
| 703 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); | 628 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); |
| 704 } | 629 } |
| 705 } | 630 } |
| 706 | |
| 707 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; | |
| 708 | |
| 709 CFWL_ToolTipContainer::CFWL_ToolTipContainer() | |
| 710 : m_nInitDelayTime(0), m_nAutoPopDelayTime(2000) { | |
| 711 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | |
| 712 } | |
| 713 | |
| 714 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {} | |
| 715 | |
| 716 void CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget, | |
| 717 CFX_WideString& wsCaption) { | |
| 718 wsCaption = m_wsCaption; | |
| 719 } | |
| 720 | |
| 721 int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) { | |
| 722 return m_nInitDelayTime; | |
| 723 } | |
| 724 | |
| 725 int32_t CFWL_ToolTipContainer::GetAutoPopDelay(IFWL_Widget* pWidget) { | |
| 726 return m_nAutoPopDelayTime; | |
| 727 } | |
| 728 | |
| 729 CFX_DIBitmap* CFWL_ToolTipContainer::GetToolTipIcon(IFWL_Widget* pWidget) { | |
| 730 return nullptr; | |
| 731 } | |
| 732 | |
| 733 CFX_SizeF CFWL_ToolTipContainer::GetToolTipIconSize(IFWL_Widget* pWidget) { | |
| 734 return CFX_SizeF(); | |
| 735 } | |
| 736 | |
| 737 CFX_RectF CFWL_ToolTipContainer::GetAnchor() { | |
| 738 return m_fAnchor; | |
| 739 } | |
| 740 | |
| 741 // static | |
| 742 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { | |
| 743 if (!s_pInstance) | |
| 744 s_pInstance = new CFWL_ToolTipContainer; | |
| 745 return s_pInstance; | |
| 746 } | |
| 747 | |
| 748 // static | |
| 749 void CFWL_ToolTipContainer::DeleteInstance() { | |
| 750 delete s_pInstance; | |
| 751 s_pInstance = nullptr; | |
| 752 } | |
| OLD | NEW |