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) |
254 return FWL_Error::Indefinite; | 184 return; |
255 } | |
256 m_forms.RemoveAt(nIndex); | 185 m_forms.RemoveAt(nIndex); |
257 return FWL_Error::Succeeded; | |
258 } | 186 } |
259 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { | 187 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { |
260 pMessage->Retain(); | 188 pMessage->Retain(); |
261 m_noteQueue.Add(pMessage); | 189 m_noteQueue.Add(pMessage); |
262 return true; | 190 return true; |
263 } | 191 } |
264 bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { | 192 bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { |
265 if (m_noteQueue.GetSize() < 1) { | 193 if (m_noteQueue.GetSize() < 1) { |
266 return false; | 194 return false; |
267 } | 195 } |
268 CFWL_Message* pMessage = m_noteQueue[0]; | 196 CFWL_Message* pMessage = m_noteQueue[0]; |
269 m_noteQueue.RemoveAt(0); | 197 m_noteQueue.RemoveAt(0); |
270 if (!IsValidMessage(pMessage)) { | 198 if (!IsValidMessage(pMessage)) { |
271 pMessage->Release(); | 199 pMessage->Release(); |
272 return true; | 200 return true; |
273 } | 201 } |
274 ProcessMessage(pMessage); | 202 ProcessMessage(pMessage); |
275 | 203 |
276 pMessage->Release(); | 204 pMessage->Release(); |
277 return true; | 205 return true; |
278 } | 206 } |
279 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { | 207 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const { |
280 int32_t size = m_noteLoopQueue.GetSize(); | 208 int32_t size = m_noteLoopQueue.GetSize(); |
281 if (size <= 0) | 209 if (size <= 0) |
282 return nullptr; | 210 return nullptr; |
283 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); | 211 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); |
284 } | 212 } |
285 int32_t CFWL_NoteDriver::CountLoop() { | |
286 return m_noteLoopQueue.GetSize(); | |
287 } | |
288 | 213 |
289 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { | 214 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { |
290 CFWL_WidgetMgr* pWidgetMgr = | 215 CFWL_WidgetMgr* pWidgetMgr = |
291 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); | 216 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); |
292 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() | 217 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() |
293 ? pMessage->m_pDstTarget | 218 ? pMessage->m_pDstTarget |
294 : GetMessageForm(pMessage->m_pDstTarget); | 219 : GetMessageForm(pMessage->m_pDstTarget); |
295 if (!pMessageForm) | 220 if (!pMessageForm) |
296 return false; | 221 return false; |
297 if (DispatchMessage(pMessage, pMessageForm)) { | 222 if (DispatchMessage(pMessage, pMessageForm)) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } | 544 } |
620 if (!pMessageForm && pDstTarget) { | 545 if (!pMessageForm && pDstTarget) { |
621 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); | 546 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); |
622 if (!pWidgetMgr) | 547 if (!pWidgetMgr) |
623 return nullptr; | 548 return nullptr; |
624 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); | 549 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); |
625 } | 550 } |
626 return pMessageForm; | 551 return pMessageForm; |
627 } | 552 } |
628 | 553 |
629 void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) { | 554 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { |
630 auto it = m_eventTargets.begin(); | 555 auto it = m_eventTargets.begin(); |
631 while (it != m_eventTargets.end()) { | 556 while (it != m_eventTargets.end()) { |
632 auto old = it++; | 557 auto old = it++; |
633 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 558 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
634 delete old->second; | 559 delete old->second; |
635 m_eventTargets.erase(old); | 560 m_eventTargets.erase(old); |
636 } | 561 } |
637 } | 562 } |
638 } | 563 } |
639 | 564 |
640 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, | 565 CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener) |
641 IFWL_Widget* pListener) | 566 : m_pListener(pListener), m_bInvalid(false) {} |
642 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {} | |
643 CFWL_EventTarget::~CFWL_EventTarget() { | 567 CFWL_EventTarget::~CFWL_EventTarget() { |
644 m_eventSources.RemoveAll(); | 568 m_eventSources.RemoveAll(); |
645 } | 569 } |
646 | 570 |
647 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 571 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
648 uint32_t dwFilter) { | 572 uint32_t dwFilter) { |
649 if (pSource) { | 573 if (pSource) { |
650 m_eventSources.SetAt(pSource, dwFilter); | 574 m_eventSources.SetAt(pSource, dwFilter); |
651 return m_eventSources.GetCount(); | 575 return m_eventSources.GetCount(); |
652 } | 576 } |
(...skipping 17 matching lines...) Expand all Loading... |
670 pEvent->GetClassID() == CFWL_EventType::Idle) { | 594 pEvent->GetClassID() == CFWL_EventType::Idle) { |
671 if (IsFilterEvent(pEvent, dwFilter)) { | 595 if (IsFilterEvent(pEvent, dwFilter)) { |
672 pDelegate->OnProcessEvent(pEvent); | 596 pDelegate->OnProcessEvent(pEvent); |
673 return true; | 597 return true; |
674 } | 598 } |
675 } | 599 } |
676 } | 600 } |
677 return false; | 601 return false; |
678 } | 602 } |
679 | 603 |
680 bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { | 604 bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, |
| 605 uint32_t dwFilter) const { |
681 if (dwFilter == FWL_EVENT_ALL_MASK) | 606 if (dwFilter == FWL_EVENT_ALL_MASK) |
682 return true; | 607 return true; |
683 | 608 |
684 switch (pEvent->GetClassID()) { | 609 switch (pEvent->GetClassID()) { |
685 case CFWL_EventType::Mouse: | 610 case CFWL_EventType::Mouse: |
686 return !!(dwFilter & FWL_EVENT_MOUSE_MASK); | 611 return !!(dwFilter & FWL_EVENT_MOUSE_MASK); |
687 case CFWL_EventType::MouseWheel: | 612 case CFWL_EventType::MouseWheel: |
688 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); | 613 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); |
689 case CFWL_EventType::Key: | 614 case CFWL_EventType::Key: |
690 return !!(dwFilter & FWL_EVENT_KEY_MASK); | 615 return !!(dwFilter & FWL_EVENT_KEY_MASK); |
691 case CFWL_EventType::SetFocus: | 616 case CFWL_EventType::SetFocus: |
692 case CFWL_EventType::KillFocus: | 617 case CFWL_EventType::KillFocus: |
693 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); | 618 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); |
694 case CFWL_EventType::Draw: | 619 case CFWL_EventType::Draw: |
695 return !!(dwFilter & FWL_EVENT_DRAW_MASK); | 620 return !!(dwFilter & FWL_EVENT_DRAW_MASK); |
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 |