Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: xfa/fwl/core/fwl_noteimp.cpp

Issue 2503513002: Cleanup fwl_* classes and cfx_* classes in fwl. (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/ifwl_app.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ptr_util.h"
10 #include "third_party/base/stl_util.h" 11 #include "third_party/base/stl_util.h"
11 #include "xfa/fwl/core/cfwl_message.h" 12 #include "xfa/fwl/core/cfwl_message.h"
12 #include "xfa/fwl/core/cfwl_widgetmgr.h" 13 #include "xfa/fwl/core/cfwl_widgetmgr.h"
13 #include "xfa/fwl/core/ifwl_app.h" 14 #include "xfa/fwl/core/ifwl_app.h"
14 #include "xfa/fwl/core/ifwl_tooltip.h" 15 #include "xfa/fwl/core/ifwl_tooltip.h"
15 16
16 CFWL_NoteLoop::CFWL_NoteLoop(IFWL_Widget* pForm) 17 CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {}
17 : m_pForm(pForm), m_bContinueModal(true) {}
18 18
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() 19 CFWL_NoteDriver::CFWL_NoteDriver()
67 : m_pHover(nullptr), 20 : m_pHover(nullptr),
68 m_pFocus(nullptr), 21 m_pFocus(nullptr),
69 m_pGrab(nullptr), 22 m_pGrab(nullptr),
70 m_pNoteLoop(new CFWL_NoteLoop) { 23 m_pNoteLoop(pdfium::MakeUnique<CFWL_NoteLoop>()) {
71 PushNoteLoop(m_pNoteLoop.get()); 24 PushNoteLoop(m_pNoteLoop.get());
72 } 25 }
73 CFWL_NoteDriver::~CFWL_NoteDriver() { 26 CFWL_NoteDriver::~CFWL_NoteDriver() {
74 ClearInvalidEventTargets(true); 27 ClearEventTargets(true);
75 } 28 }
76 29
77 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { 30 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
78 if (m_eventTargets.empty()) 31 if (m_eventTargets.empty())
79 return; 32 return;
80 33
81 for (const auto& pair : m_eventTargets) { 34 for (const auto& pair : m_eventTargets) {
82 CFWL_EventTarget* pEventTarget = pair.second; 35 CFWL_EventTarget* pEventTarget = pair.second;
83 if (pEventTarget && !pEventTarget->IsInvalid()) 36 if (pEventTarget && !pEventTarget->IsInvalid())
84 pEventTarget->ProcessEvent(pNote); 37 pEventTarget->ProcessEvent(pNote);
85 } 38 }
86 } 39 }
87 40
88 FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, 41 void CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener,
89 IFWL_Widget* pEventSource, 42 IFWL_Widget* pEventSource,
90 uint32_t dwFilter) { 43 uint32_t dwFilter) {
91 uint32_t key = pListener->GetEventKey(); 44 uint32_t key = pListener->GetEventKey();
92 if (key == 0) { 45 if (key == 0) {
93 do { 46 do {
94 key = rand(); 47 key = rand();
95 } while (key == 0 || pdfium::ContainsKey(m_eventTargets, key)); 48 } while (key == 0 || pdfium::ContainsKey(m_eventTargets, key));
96 pListener->SetEventKey(key); 49 pListener->SetEventKey(key);
97 } 50 }
98 if (!m_eventTargets[key]) 51 if (!m_eventTargets[key])
99 m_eventTargets[key] = new CFWL_EventTarget(this, pListener); 52 m_eventTargets[key] = new CFWL_EventTarget(pListener);
100 53
101 m_eventTargets[key]->SetEventSource(pEventSource, dwFilter); 54 m_eventTargets[key]->SetEventSource(pEventSource, dwFilter);
102 return FWL_Error::Succeeded;
103 } 55 }
104 56
105 FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { 57 void CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) {
106 uint32_t key = pListener->GetEventKey(); 58 uint32_t key = pListener->GetEventKey();
107 if (key == 0) 59 if (key == 0)
108 return FWL_Error::Indefinite; 60 return;
109 61
110 auto it = m_eventTargets.find(key); 62 auto it = m_eventTargets.find(key);
111 if (it != m_eventTargets.end()) 63 if (it != m_eventTargets.end())
112 it->second->FlagInvalid(); 64 it->second->FlagInvalid();
113
114 return FWL_Error::Succeeded;
115 } 65 }
116 66
117 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { 67 void CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
118 ClearInvalidEventTargets(bRemoveAll); 68 m_noteLoopQueue.Add(pNoteLoop);
119 } 69 }
120 70
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() { 71 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
126 int32_t pos = m_noteLoopQueue.GetSize(); 72 int32_t pos = m_noteLoopQueue.GetSize();
127 if (pos <= 0) 73 if (pos <= 0)
128 return nullptr; 74 return nullptr;
129 75
130 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); 76 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
131 m_noteLoopQueue.RemoveAt(pos - 1); 77 m_noteLoopQueue.RemoveAt(pos - 1);
132 return p; 78 return p;
133 } 79 }
134 bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) { 80 bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) {
(...skipping 23 matching lines...) Expand all
158 ms.m_pDstTarget = pFocus; 104 ms.m_pDstTarget = pFocus;
159 if (bNotify) { 105 if (bNotify) {
160 ms.m_dwExtend = 1; 106 ms.m_dwExtend = 1;
161 } 107 }
162 108
163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) 109 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate())
164 pDelegate->OnProcessMessage(&ms); 110 pDelegate->OnProcessMessage(&ms);
165 } 111 }
166 return true; 112 return true;
167 } 113 }
168 FWL_Error CFWL_NoteDriver::Run() { 114
115 void CFWL_NoteDriver::Run() {
169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ 116 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
170 _FX_OS_ == _FX_WIN64_) 117 _FX_OS_ == _FX_WIN64_)
171 CFWL_NoteLoop* pTopLoop = nullptr; 118 CFWL_NoteLoop* pTopLoop = nullptr;
172 for (;;) { 119 for (;;) {
173 pTopLoop = GetTopLoop(); 120 pTopLoop = GetTopLoop();
174 if (!pTopLoop || !pTopLoop->ContinueModal()) 121 if (!pTopLoop || !pTopLoop->ContinueModal())
175 break; 122 break;
176 if (UnqueueMessage(pTopLoop)) 123 if (UnqueueMessage(pTopLoop))
177 continue; 124 continue;
178 } 125 }
179 #endif 126 #endif
180
181 return FWL_Error::Succeeded;
182 } 127 }
183 128
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) { 129 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) {
197 if (m_pFocus == pNoteTarget) { 130 if (m_pFocus == pNoteTarget) {
198 m_pFocus = nullptr; 131 m_pFocus = nullptr;
199 } 132 }
200 if (m_pHover == pNoteTarget) { 133 if (m_pHover == pNoteTarget) {
201 m_pHover = nullptr; 134 m_pHover = nullptr;
202 } 135 }
203 if (m_pGrab == pNoteTarget) { 136 if (m_pGrab == pNoteTarget) {
204 m_pGrab = nullptr; 137 m_pGrab = nullptr;
205 } 138 }
(...skipping 17 matching lines...) Expand all
223 } 156 }
224 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 157 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
225 if (!pSubFocus) 158 if (!pSubFocus)
226 return; 159 return;
227 if (pSubFocus == pNoteTarget) { 160 if (pSubFocus == pNoteTarget) {
228 pForm->SetSubFocus(nullptr); 161 pForm->SetSubFocus(nullptr);
229 } 162 }
230 } 163 }
231 } 164 }
232 165
233 FWL_Error CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) { 166 void CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) {
234 if (!pForm) 167 if (!pForm || m_forms.Find(pForm) >= 0)
235 return FWL_Error::Indefinite; 168 return;
236 if (m_forms.Find(pForm) >= 0) { 169
237 return FWL_Error::Indefinite;
238 }
239 m_forms.Add(pForm); 170 m_forms.Add(pForm);
240 if (m_forms.GetSize() == 1) { 171 if (m_forms.GetSize() == 1) {
241 CFWL_NoteLoop* pLoop = 172 CFWL_NoteLoop* pLoop =
242 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); 173 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0));
243 if (!pLoop) 174 if (!pLoop)
244 return FWL_Error::Indefinite; 175 return;
245 pLoop->SetMainForm(pForm); 176 pLoop->SetMainForm(pForm);
246 } 177 }
247 return FWL_Error::Succeeded;
248 } 178 }
249 FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { 179
180 void CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) {
250 if (!pForm) 181 if (!pForm)
251 return FWL_Error::Indefinite; 182 return;
252 int32_t nIndex = m_forms.Find(pForm); 183 int32_t nIndex = m_forms.Find(pForm);
253 if (nIndex < 0) { 184 if (nIndex < 0)
254 return FWL_Error::Indefinite; 185 return;
255 }
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() const {
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
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 17 matching lines...) Expand all
670 pEvent->GetClassID() == CFWL_EventType::Idle) { 595 pEvent->GetClassID() == CFWL_EventType::Idle) {
671 if (IsFilterEvent(pEvent, dwFilter)) { 596 if (IsFilterEvent(pEvent, dwFilter)) {
672 pDelegate->OnProcessEvent(pEvent); 597 pDelegate->OnProcessEvent(pEvent);
673 return true; 598 return true;
674 } 599 }
675 } 600 }
676 } 601 }
677 return false; 602 return false;
678 } 603 }
679 604
680 bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { 605 bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent,
606 uint32_t dwFilter) const {
681 if (dwFilter == FWL_EVENT_ALL_MASK) 607 if (dwFilter == FWL_EVENT_ALL_MASK)
682 return true; 608 return true;
683 609
684 switch (pEvent->GetClassID()) { 610 switch (pEvent->GetClassID()) {
685 case CFWL_EventType::Mouse: 611 case CFWL_EventType::Mouse:
686 return !!(dwFilter & FWL_EVENT_MOUSE_MASK); 612 return !!(dwFilter & FWL_EVENT_MOUSE_MASK);
687 case CFWL_EventType::MouseWheel: 613 case CFWL_EventType::MouseWheel:
688 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); 614 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK);
689 case CFWL_EventType::Key: 615 case CFWL_EventType::Key:
690 return !!(dwFilter & FWL_EVENT_KEY_MASK); 616 return !!(dwFilter & FWL_EVENT_KEY_MASK);
691 case CFWL_EventType::SetFocus: 617 case CFWL_EventType::SetFocus:
692 case CFWL_EventType::KillFocus: 618 case CFWL_EventType::KillFocus:
693 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); 619 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK);
694 case CFWL_EventType::Draw: 620 case CFWL_EventType::Draw:
695 return !!(dwFilter & FWL_EVENT_DRAW_MASK); 621 return !!(dwFilter & FWL_EVENT_DRAW_MASK);
696 case CFWL_EventType::Close: 622 case CFWL_EventType::Close:
697 return !!(dwFilter & FWL_EVENT_CLOSE_MASK); 623 return !!(dwFilter & FWL_EVENT_CLOSE_MASK);
698 case CFWL_EventType::SizeChanged: 624 case CFWL_EventType::SizeChanged:
699 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); 625 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK);
700 case CFWL_EventType::Idle: 626 case CFWL_EventType::Idle:
701 return !!(dwFilter & FWL_EVENT_IDLE_MASK); 627 return !!(dwFilter & FWL_EVENT_IDLE_MASK);
702 default: 628 default:
703 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); 629 return !!(dwFilter & FWL_EVENT_CONTROL_MASK);
704 } 630 }
705 } 631 }
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 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/ifwl_app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698