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

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

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: 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_barcode.h » ('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/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(IFWL_Widget* pForm)
17 : m_pForm(pForm), m_bContinueModal(TRUE) {} 17 : m_pForm(pForm), m_bContinueModal(true) {}
18 18
19 FWL_Error CFWL_NoteLoop::Idle(int32_t count) { 19 FWL_Error CFWL_NoteLoop::Idle(int32_t count) {
20 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 20 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
21 if (count <= 0) { 21 if (count <= 0) {
22 #endif 22 #endif
23 CFWL_EvtIdle ev; 23 CFWL_EvtIdle ev;
24 const IFWL_App* pApp = m_pForm->GetOwnerApp(); 24 const IFWL_App* pApp = m_pForm->GetOwnerApp();
25 if (!pApp) 25 if (!pApp)
26 return FWL_Error::Indefinite; 26 return FWL_Error::Indefinite;
27 27
28 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 28 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
29 if (!pDriver) 29 if (!pDriver)
30 return FWL_Error::Indefinite; 30 return FWL_Error::Indefinite;
31 31
32 pDriver->SendEvent(&ev); 32 pDriver->SendEvent(&ev);
33 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 33 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
34 } 34 }
35 #endif 35 #endif
36 return FWL_Error::Indefinite; 36 return FWL_Error::Indefinite;
37 } 37 }
38 IFWL_Widget* CFWL_NoteLoop::GetForm() { 38 IFWL_Widget* CFWL_NoteLoop::GetForm() {
39 return m_pForm; 39 return m_pForm;
40 } 40 }
41 FX_BOOL CFWL_NoteLoop::ContinueModal() { 41 bool CFWL_NoteLoop::ContinueModal() {
42 return m_bContinueModal; 42 return m_bContinueModal;
43 } 43 }
44 FWL_Error CFWL_NoteLoop::EndModalLoop() { 44 FWL_Error CFWL_NoteLoop::EndModalLoop() {
45 m_bContinueModal = FALSE; 45 m_bContinueModal = false;
46 return FWL_Error::Succeeded; 46 return FWL_Error::Succeeded;
47 } 47 }
48 48
49 FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) { 49 FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) {
50 m_pForm = pForm; 50 m_pForm = pForm;
51 return FWL_Error::Succeeded; 51 return FWL_Error::Succeeded;
52 } 52 }
53 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { 53 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
54 CFWL_EvtMenuCommand ev; 54 CFWL_EvtMenuCommand ev;
55 ev.m_iCommand = dwCommand; 55 ev.m_iCommand = dwCommand;
56 const IFWL_App* pApp = m_pForm->GetOwnerApp(); 56 const IFWL_App* pApp = m_pForm->GetOwnerApp();
57 if (!pApp) 57 if (!pApp)
58 return; 58 return;
59 59
60 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 60 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
61 if (!pDriver) 61 if (!pDriver)
62 return; 62 return;
63 63
64 pDriver->SendEvent(&ev); 64 pDriver->SendEvent(&ev);
65 } 65 }
66 CFWL_NoteDriver::CFWL_NoteDriver() 66 CFWL_NoteDriver::CFWL_NoteDriver()
67 : m_pHover(nullptr), 67 : m_pHover(nullptr),
68 m_pFocus(nullptr), 68 m_pFocus(nullptr),
69 m_pGrab(nullptr), 69 m_pGrab(nullptr),
70 m_pNoteLoop(new CFWL_NoteLoop) { 70 m_pNoteLoop(new CFWL_NoteLoop) {
71 PushNoteLoop(m_pNoteLoop.get()); 71 PushNoteLoop(m_pNoteLoop.get());
72 } 72 }
73 CFWL_NoteDriver::~CFWL_NoteDriver() { 73 CFWL_NoteDriver::~CFWL_NoteDriver() {
74 ClearInvalidEventTargets(TRUE); 74 ClearInvalidEventTargets(true);
75 } 75 }
76 76
77 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { 77 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
78 if (m_eventTargets.empty()) 78 if (m_eventTargets.empty())
79 return; 79 return;
80 80
81 for (const auto& pair : m_eventTargets) { 81 for (const auto& pair : m_eventTargets) {
82 CFWL_EventTarget* pEventTarget = pair.second; 82 CFWL_EventTarget* pEventTarget = pair.second;
83 if (pEventTarget && !pEventTarget->IsInvalid()) 83 if (pEventTarget && !pEventTarget->IsInvalid())
84 pEventTarget->ProcessEvent(pNote); 84 pEventTarget->ProcessEvent(pNote);
(...skipping 22 matching lines...) Expand all
107 if (key == 0) 107 if (key == 0)
108 return FWL_Error::Indefinite; 108 return FWL_Error::Indefinite;
109 109
110 auto it = m_eventTargets.find(key); 110 auto it = m_eventTargets.find(key);
111 if (it != m_eventTargets.end()) 111 if (it != m_eventTargets.end())
112 it->second->FlagInvalid(); 112 it->second->FlagInvalid();
113 113
114 return FWL_Error::Succeeded; 114 return FWL_Error::Succeeded;
115 } 115 }
116 116
117 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { 117 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) {
118 ClearInvalidEventTargets(bRemoveAll); 118 ClearInvalidEventTargets(bRemoveAll);
119 } 119 }
120 120
121 FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { 121 FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
122 m_noteLoopQueue.Add(pNoteLoop); 122 m_noteLoopQueue.Add(pNoteLoop);
123 return FWL_Error::Succeeded; 123 return FWL_Error::Succeeded;
124 } 124 }
125 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { 125 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
126 int32_t pos = m_noteLoopQueue.GetSize(); 126 int32_t pos = m_noteLoopQueue.GetSize();
127 if (pos <= 0) 127 if (pos <= 0)
128 return nullptr; 128 return nullptr;
129 129
130 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); 130 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
131 m_noteLoopQueue.RemoveAt(pos - 1); 131 m_noteLoopQueue.RemoveAt(pos - 1);
132 return p; 132 return p;
133 } 133 }
134 FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { 134 bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) {
135 if (m_pFocus == pFocus) { 135 if (m_pFocus == pFocus) {
136 return TRUE; 136 return true;
137 } 137 }
138 IFWL_Widget* pPrev = m_pFocus; 138 IFWL_Widget* pPrev = m_pFocus;
139 m_pFocus = pFocus; 139 m_pFocus = pFocus;
140 if (pPrev) { 140 if (pPrev) {
141 CFWL_MsgKillFocus ms; 141 CFWL_MsgKillFocus ms;
142 ms.m_pDstTarget = pPrev; 142 ms.m_pDstTarget = pPrev;
143 ms.m_pSrcTarget = pPrev; 143 ms.m_pSrcTarget = pPrev;
144 if (bNotify) { 144 if (bNotify) {
145 ms.m_dwExtend = 1; 145 ms.m_dwExtend = 1;
146 } 146 }
147 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate()) 147 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate())
148 pDelegate->OnProcessMessage(&ms); 148 pDelegate->OnProcessMessage(&ms);
149 } 149 }
150 if (pFocus) { 150 if (pFocus) {
151 IFWL_Widget* pWidget = 151 IFWL_Widget* pWidget =
152 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); 152 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus);
153 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 153 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
154 if (pForm) 154 if (pForm)
155 pForm->SetSubFocus(pFocus); 155 pForm->SetSubFocus(pFocus);
156 156
157 CFWL_MsgSetFocus ms; 157 CFWL_MsgSetFocus ms;
158 ms.m_pDstTarget = pFocus; 158 ms.m_pDstTarget = pFocus;
159 if (bNotify) { 159 if (bNotify) {
160 ms.m_dwExtend = 1; 160 ms.m_dwExtend = 1;
161 } 161 }
162 162
163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) 163 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate())
164 pDelegate->OnProcessMessage(&ms); 164 pDelegate->OnProcessMessage(&ms);
165 } 165 }
166 return TRUE; 166 return true;
167 } 167 }
168 FWL_Error CFWL_NoteDriver::Run() { 168 FWL_Error CFWL_NoteDriver::Run() {
169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ 169 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
170 _FX_OS_ == _FX_WIN64_) 170 _FX_OS_ == _FX_WIN64_)
171 CFWL_NoteLoop* pTopLoop = nullptr; 171 CFWL_NoteLoop* pTopLoop = nullptr;
172 for (;;) { 172 for (;;) {
173 pTopLoop = GetTopLoop(); 173 pTopLoop = GetTopLoop();
174 if (!pTopLoop || !pTopLoop->ContinueModal()) 174 if (!pTopLoop || !pTopLoop->ContinueModal())
175 break; 175 break;
176 if (UnqueueMessage(pTopLoop)) 176 if (UnqueueMessage(pTopLoop))
177 continue; 177 continue;
178 } 178 }
179 #endif 179 #endif
180 180
181 return FWL_Error::Succeeded; 181 return FWL_Error::Succeeded;
182 } 182 }
183 183
184 IFWL_Widget* CFWL_NoteDriver::GetFocus() { 184 IFWL_Widget* CFWL_NoteDriver::GetFocus() {
185 return m_pFocus; 185 return m_pFocus;
186 } 186 }
187 IFWL_Widget* CFWL_NoteDriver::GetHover() { 187 IFWL_Widget* CFWL_NoteDriver::GetHover() {
188 return m_pHover; 188 return m_pHover;
189 } 189 }
190 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { 190 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) {
191 m_pHover = pHover; 191 m_pHover = pHover;
192 } 192 }
193 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { 193 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, bool bSet) {
194 m_pGrab = bSet ? pGrab : nullptr; 194 m_pGrab = bSet ? pGrab : nullptr;
195 } 195 }
196 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { 196 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) {
197 if (m_pFocus == pNoteTarget) { 197 if (m_pFocus == pNoteTarget) {
198 m_pFocus = nullptr; 198 m_pFocus = nullptr;
199 } 199 }
200 if (m_pHover == pNoteTarget) { 200 if (m_pHover == pNoteTarget) {
201 m_pHover = nullptr; 201 m_pHover = nullptr;
202 } 202 }
203 if (m_pGrab == pNoteTarget) { 203 if (m_pGrab == pNoteTarget) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { 249 FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) {
250 if (!pForm) 250 if (!pForm)
251 return FWL_Error::Indefinite; 251 return FWL_Error::Indefinite;
252 int32_t nIndex = m_forms.Find(pForm); 252 int32_t nIndex = m_forms.Find(pForm);
253 if (nIndex < 0) { 253 if (nIndex < 0) {
254 return FWL_Error::Indefinite; 254 return FWL_Error::Indefinite;
255 } 255 }
256 m_forms.RemoveAt(nIndex); 256 m_forms.RemoveAt(nIndex);
257 return FWL_Error::Succeeded; 257 return FWL_Error::Succeeded;
258 } 258 }
259 FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { 259 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) {
260 pMessage->Retain(); 260 pMessage->Retain();
261 m_noteQueue.Add(pMessage); 261 m_noteQueue.Add(pMessage);
262 return TRUE; 262 return true;
263 } 263 }
264 FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { 264 bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
265 if (m_noteQueue.GetSize() < 1) { 265 if (m_noteQueue.GetSize() < 1) {
266 return FALSE; 266 return false;
267 } 267 }
268 CFWL_Message* pMessage = m_noteQueue[0]; 268 CFWL_Message* pMessage = m_noteQueue[0];
269 m_noteQueue.RemoveAt(0); 269 m_noteQueue.RemoveAt(0);
270 if (!IsValidMessage(pMessage)) { 270 if (!IsValidMessage(pMessage)) {
271 pMessage->Release(); 271 pMessage->Release();
272 return TRUE; 272 return true;
273 } 273 }
274 ProcessMessage(pMessage); 274 ProcessMessage(pMessage);
275 275
276 pMessage->Release(); 276 pMessage->Release();
277 return TRUE; 277 return true;
278 } 278 }
279 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { 279 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
280 int32_t size = m_noteLoopQueue.GetSize(); 280 int32_t size = m_noteLoopQueue.GetSize();
281 if (size <= 0) 281 if (size <= 0)
282 return nullptr; 282 return nullptr;
283 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); 283 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
284 } 284 }
285 int32_t CFWL_NoteDriver::CountLoop() { 285 int32_t CFWL_NoteDriver::CountLoop() {
286 return m_noteLoopQueue.GetSize(); 286 return m_noteLoopQueue.GetSize();
287 } 287 }
288 288
289 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { 289 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
290 CFWL_WidgetMgr* pWidgetMgr = 290 CFWL_WidgetMgr* pWidgetMgr =
291 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); 291 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
292 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() 292 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
293 ? pMessage->m_pDstTarget 293 ? pMessage->m_pDstTarget
294 : GetMessageForm(pMessage->m_pDstTarget); 294 : GetMessageForm(pMessage->m_pDstTarget);
295 if (!pMessageForm) 295 if (!pMessageForm)
296 return FALSE; 296 return false;
297 if (DispatchMessage(pMessage, pMessageForm)) { 297 if (DispatchMessage(pMessage, pMessageForm)) {
298 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) 298 if (pMessage->GetClassID() == CFWL_MessageType::Mouse)
299 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); 299 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
300 return TRUE; 300 return true;
301 } 301 }
302 return FALSE; 302 return false;
303 } 303 }
304 304
305 FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, 305 bool CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
306 IFWL_Widget* pMessageForm) { 306 IFWL_Widget* pMessageForm) {
307 FX_BOOL bRet = FALSE; 307 bool bRet = false;
308 switch (pMessage->GetClassID()) { 308 switch (pMessage->GetClassID()) {
309 case CFWL_MessageType::Activate: { 309 case CFWL_MessageType::Activate: {
310 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); 310 bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm);
311 break; 311 break;
312 } 312 }
313 case CFWL_MessageType::Deactivate: { 313 case CFWL_MessageType::Deactivate: {
314 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), 314 bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage),
315 pMessageForm); 315 pMessageForm);
316 break; 316 break;
317 } 317 }
(...skipping 16 matching lines...) Expand all
334 } 334 }
335 case CFWL_MessageType::MouseWheel: { 335 case CFWL_MessageType::MouseWheel: {
336 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); 336 bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm);
337 break; 337 break;
338 } 338 }
339 case CFWL_MessageType::Size: { 339 case CFWL_MessageType::Size: {
340 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); 340 bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage));
341 break; 341 break;
342 } 342 }
343 case CFWL_MessageType::Cursor: { 343 case CFWL_MessageType::Cursor: {
344 bRet = TRUE; 344 bRet = true;
345 break; 345 break;
346 } 346 }
347 case CFWL_MessageType::WindowMove: { 347 case CFWL_MessageType::WindowMove: {
348 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), 348 bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage),
349 pMessageForm); 349 pMessageForm);
350 break; 350 break;
351 } 351 }
352 case CFWL_MessageType::DropFiles: { 352 case CFWL_MessageType::DropFiles: {
353 bRet = 353 bRet =
354 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); 354 DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm);
355 break; 355 break;
356 } 356 }
357 default: { 357 default: {
358 bRet = TRUE; 358 bRet = true;
359 break; 359 break;
360 } 360 }
361 } 361 }
362 if (bRet) { 362 if (bRet) {
363 if (IFWL_WidgetDelegate* pDelegate = 363 if (IFWL_WidgetDelegate* pDelegate =
364 pMessage->m_pDstTarget->GetDelegate()) { 364 pMessage->m_pDstTarget->GetDelegate()) {
365 pDelegate->OnProcessMessage(pMessage); 365 pDelegate->OnProcessMessage(pMessage);
366 } 366 }
367 } 367 }
368 return bRet; 368 return bRet;
369 } 369 }
370 370
371 FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, 371 bool CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg,
372 IFWL_Widget* pMessageForm) { 372 IFWL_Widget* pMessageForm) {
373 pMsg->m_pDstTarget = pMessageForm; 373 pMsg->m_pDstTarget = pMessageForm;
374 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); 374 return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated);
375 } 375 }
376 376
377 FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, 377 bool CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg,
378 IFWL_Widget* pMessageForm) { 378 IFWL_Widget* pMessageForm) {
379 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); 379 int32_t iTrackLoop = m_noteLoopQueue.GetSize();
380 if (iTrackLoop <= 0) 380 if (iTrackLoop <= 0)
381 return FALSE; 381 return false;
382 if (iTrackLoop == 1) { 382 if (iTrackLoop == 1) {
383 if (pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) { 383 if (pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) {
384 return FALSE; 384 return false;
385 } 385 }
386 if (pMsg->m_pSrcTarget && 386 if (pMsg->m_pSrcTarget &&
387 pMsg->m_pSrcTarget->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) { 387 pMsg->m_pSrcTarget->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) {
388 return FALSE; 388 return false;
389 } 389 }
390 if (pMsg->m_pSrcTarget && 390 if (pMsg->m_pSrcTarget &&
391 pMsg->m_pSrcTarget->GetClassID() == FWL_Type::ToolTip) { 391 pMsg->m_pSrcTarget->GetClassID() == FWL_Type::ToolTip) {
392 return FALSE; 392 return false;
393 } 393 }
394 return TRUE; 394 return true;
395 } 395 }
396 IFWL_Widget* pDst = pMsg->m_pDstTarget; 396 IFWL_Widget* pDst = pMsg->m_pDstTarget;
397 if (!pDst) 397 if (!pDst)
398 return FALSE; 398 return false;
399 #if (_FX_OS_ == _FX_MACOSX_) 399 #if (_FX_OS_ == _FX_MACOSX_)
400 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { 400 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) {
401 return TRUE; 401 return true;
402 } 402 }
403 #endif 403 #endif
404 return pDst != pMessageForm && 404 return pDst != pMessageForm &&
405 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && 405 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) &&
406 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); 406 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"));
407 } 407 }
408 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, 408 bool CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
409 IFWL_Widget* pMessageForm) { 409 IFWL_Widget* pMessageForm) {
410 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 410 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
411 if (pWidgetMgr->IsFormDisabled()) { 411 if (pWidgetMgr->IsFormDisabled()) {
412 m_pFocus = pMsg->m_pDstTarget; 412 m_pFocus = pMsg->m_pDstTarget;
413 return TRUE; 413 return true;
414 } 414 }
415 IFWL_Widget* pWidget = pMsg->m_pDstTarget; 415 IFWL_Widget* pWidget = pMsg->m_pDstTarget;
416 if (pWidget) { 416 if (pWidget) {
417 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 417 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
418 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 418 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
419 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { 419 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
420 pMsg->m_pDstTarget = pSubFocus; 420 pMsg->m_pDstTarget = pSubFocus;
421 if (m_pFocus != pMsg->m_pDstTarget) { 421 if (m_pFocus != pMsg->m_pDstTarget) {
422 m_pFocus = pMsg->m_pDstTarget; 422 m_pFocus = pMsg->m_pDstTarget;
423 return TRUE; 423 return true;
424 } 424 }
425 } 425 }
426 } 426 }
427 return FALSE; 427 return false;
428 } 428 }
429 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, 429 bool CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
430 IFWL_Widget* pMessageForm) { 430 IFWL_Widget* pMessageForm) {
431 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 431 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
432 if (pWidgetMgr->IsFormDisabled()) { 432 if (pWidgetMgr->IsFormDisabled()) {
433 if (m_pFocus == pMsg->m_pDstTarget) { 433 if (m_pFocus == pMsg->m_pDstTarget) {
434 m_pFocus = nullptr; 434 m_pFocus = nullptr;
435 } 435 }
436 return TRUE; 436 return true;
437 } 437 }
438 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget); 438 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget);
439 if (pForm) { 439 if (pForm) {
440 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 440 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
441 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { 441 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
442 pMsg->m_pDstTarget = pSubFocus; 442 pMsg->m_pDstTarget = pSubFocus;
443 if (m_pFocus == pMsg->m_pDstTarget) { 443 if (m_pFocus == pMsg->m_pDstTarget) {
444 m_pFocus = nullptr; 444 m_pFocus = nullptr;
445 return TRUE; 445 return true;
446 } 446 }
447 } 447 }
448 } 448 }
449 return FALSE; 449 return false;
450 } 450 }
451 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { 451 bool CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
452 #if (_FX_OS_ != _FX_MACOSX_) 452 #if (_FX_OS_ != _FX_MACOSX_)
453 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 453 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
454 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { 454 pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
455 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 455 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
456 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); 456 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
457 IFWL_Widget* pFocus = m_pFocus; 457 IFWL_Widget* pFocus = m_pFocus;
458 if (m_pFocus) { 458 if (m_pFocus) {
459 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm) 459 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm)
460 pFocus = nullptr; 460 pFocus = nullptr;
461 } 461 }
462 FX_BOOL bFind = FALSE; 462 bool bFind = false;
463 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); 463 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind);
464 if (!pNextTabStop) { 464 if (!pNextTabStop) {
465 bFind = FALSE; 465 bFind = false;
466 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind); 466 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind);
467 } 467 }
468 if (pNextTabStop == pFocus) { 468 if (pNextTabStop == pFocus) {
469 return TRUE; 469 return true;
470 } 470 }
471 if (pNextTabStop) { 471 if (pNextTabStop) {
472 SetFocus(pNextTabStop); 472 SetFocus(pNextTabStop);
473 } 473 }
474 return TRUE; 474 return true;
475 } 475 }
476 #endif 476 #endif
477 if (!m_pFocus) { 477 if (!m_pFocus) {
478 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 478 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
479 pMsg->m_dwKeyCode == FWL_VKEY_Return) { 479 pMsg->m_dwKeyCode == FWL_VKEY_Return) {
480 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 480 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
481 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); 481 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
482 if (defButton) { 482 if (defButton) {
483 pMsg->m_pDstTarget = defButton; 483 pMsg->m_pDstTarget = defButton;
484 return TRUE; 484 return true;
485 } 485 }
486 } 486 }
487 return FALSE; 487 return false;
488 } 488 }
489 pMsg->m_pDstTarget = m_pFocus; 489 pMsg->m_pDstTarget = m_pFocus;
490 return TRUE; 490 return true;
491 } 491 }
492 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, 492 bool CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm) {
493 IFWL_Widget* pMessageForm) {
494 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || 493 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave ||
495 pMsg->m_dwCmd == FWL_MouseCommand::Hover || 494 pMsg->m_dwCmd == FWL_MouseCommand::Hover ||
496 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { 495 pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
497 return !!pMsg->m_pDstTarget; 496 return !!pMsg->m_pDstTarget;
498 } 497 }
499 if (pMsg->m_pDstTarget != pMessageForm) { 498 if (pMsg->m_pDstTarget != pMessageForm) {
500 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); 499 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy);
501 } 500 }
502 if (!DoMouseEx(pMsg, pMessageForm)) { 501 if (!DoMouseEx(pMsg, pMessageForm)) {
503 pMsg->m_pDstTarget = pMessageForm; 502 pMsg->m_pDstTarget = pMessageForm;
504 } 503 }
505 return TRUE; 504 return true;
506 } 505 }
507 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, 506 bool CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
508 IFWL_Widget* pMessageForm) { 507 IFWL_Widget* pMessageForm) {
509 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 508 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
510 if (!pWidgetMgr) 509 if (!pWidgetMgr)
511 return FALSE; 510 return false;
512 511
513 IFWL_Widget* pDst = 512 IFWL_Widget* pDst =
514 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 513 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
515 if (!pDst) 514 if (!pDst)
516 return FALSE; 515 return false;
517 516
518 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); 517 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy);
519 pMsg->m_pDstTarget = pDst; 518 pMsg->m_pDstTarget = pDst;
520 return TRUE; 519 return true;
521 } 520 }
522 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { 521 bool CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
523 CFWL_WidgetMgr* pWidgetMgr = 522 CFWL_WidgetMgr* pWidgetMgr =
524 pMsg->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); 523 pMsg->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
525 if (!pWidgetMgr) 524 if (!pWidgetMgr)
526 return FALSE; 525 return false;
527 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, 526 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
528 (FX_FLOAT)pMsg->m_iHeight); 527 (FX_FLOAT)pMsg->m_iHeight);
529 return TRUE; 528 return true;
530 } 529 }
531 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, 530 bool CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg,
532 IFWL_Widget* pMessageForm) { 531 IFWL_Widget* pMessageForm) {
533 return pMsg->m_pDstTarget == pMessageForm; 532 return pMsg->m_pDstTarget == pMessageForm;
534 } 533 }
535 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, 534 bool CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg,
536 IFWL_Widget* pMessageForm) { 535 IFWL_Widget* pMessageForm) {
537 return pMsg->m_pDstTarget == pMessageForm; 536 return pMsg->m_pDstTarget == pMessageForm;
538 } 537 }
539 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, 538 bool CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
540 IFWL_Widget* pMessageForm) { 539 IFWL_Widget* pMessageForm) {
541 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 540 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
542 if (!pWidgetMgr) 541 if (!pWidgetMgr)
543 return FALSE; 542 return false;
544 IFWL_Widget* pTarget = nullptr; 543 IFWL_Widget* pTarget = nullptr;
545 if (m_pGrab) 544 if (m_pGrab)
546 pTarget = m_pGrab; 545 pTarget = m_pGrab;
547 if (!pTarget) { 546 if (!pTarget) {
548 pTarget = 547 pTarget =
549 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 548 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
550 } 549 }
551 if (pTarget) { 550 if (pTarget) {
552 if (pMessageForm != pTarget) { 551 if (pMessageForm != pTarget) {
553 pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy); 552 pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy);
554 } 553 }
555 } 554 }
556 if (!pTarget) 555 if (!pTarget)
557 return FALSE; 556 return false;
558 pMsg->m_pDstTarget = pTarget; 557 pMsg->m_pDstTarget = pTarget;
559 return TRUE; 558 return true;
560 } 559 }
561 void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { 560 void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) {
562 IFWL_Widget* pTarget = pMsg->m_pDstTarget; 561 IFWL_Widget* pTarget = pMsg->m_pDstTarget;
563 if (pTarget == m_pHover) { 562 if (pTarget == m_pHover) {
564 return; 563 return;
565 } 564 }
566 if (m_pHover) { 565 if (m_pHover) {
567 CFWL_MsgMouse msLeave; 566 CFWL_MsgMouse msLeave;
568 msLeave.m_pDstTarget = m_pHover; 567 msLeave.m_pDstTarget = m_pHover;
569 msLeave.m_fx = pMsg->m_fx; 568 msLeave.m_fx = pMsg->m_fx;
570 msLeave.m_fy = pMsg->m_fy; 569 msLeave.m_fy = pMsg->m_fy;
571 pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); 570 pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy);
572 msLeave.m_dwFlags = 0; 571 msLeave.m_dwFlags = 0;
573 msLeave.m_dwCmd = FWL_MouseCommand::Leave; 572 msLeave.m_dwCmd = FWL_MouseCommand::Leave;
574 DispatchMessage(&msLeave, nullptr); 573 DispatchMessage(&msLeave, nullptr);
575 } 574 }
576 if (pTarget->GetClassID() == FWL_Type::Form) { 575 if (pTarget->GetClassID() == FWL_Type::Form) {
577 m_pHover = nullptr; 576 m_pHover = nullptr;
578 return; 577 return;
579 } 578 }
580 m_pHover = pTarget; 579 m_pHover = pTarget;
581 CFWL_MsgMouse msHover; 580 CFWL_MsgMouse msHover;
582 msHover.m_pDstTarget = pTarget; 581 msHover.m_pDstTarget = pTarget;
583 msHover.m_fx = pMsg->m_fx; 582 msHover.m_fx = pMsg->m_fx;
584 msHover.m_fy = pMsg->m_fy; 583 msHover.m_fy = pMsg->m_fy;
585 msHover.m_dwFlags = 0; 584 msHover.m_dwFlags = 0;
586 msHover.m_dwCmd = FWL_MouseCommand::Hover; 585 msHover.m_dwCmd = FWL_MouseCommand::Hover;
587 DispatchMessage(&msHover, nullptr); 586 DispatchMessage(&msHover, nullptr);
588 } 587 }
589 FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { 588 bool CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
590 if (pMessage->GetClassID() == CFWL_MessageType::Post) 589 if (pMessage->GetClassID() == CFWL_MessageType::Post)
591 return TRUE; 590 return true;
592 591
593 int32_t iCount = m_noteLoopQueue.GetSize(); 592 int32_t iCount = m_noteLoopQueue.GetSize();
594 for (int32_t i = 0; i < iCount; i++) { 593 for (int32_t i = 0; i < iCount; i++) {
595 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); 594 CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]);
596 IFWL_Widget* pForm = pNoteLoop->GetForm(); 595 IFWL_Widget* pForm = pNoteLoop->GetForm();
597 if (pForm && (pForm == pMessage->m_pDstTarget)) 596 if (pForm && (pForm == pMessage->m_pDstTarget))
598 return TRUE; 597 return true;
599 } 598 }
600 iCount = m_forms.GetSize(); 599 iCount = m_forms.GetSize();
601 for (int32_t j = 0; j < iCount; j++) { 600 for (int32_t j = 0; j < iCount; j++) {
602 IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[j]); 601 IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[j]);
603 if (pForm == pMessage->m_pDstTarget) 602 if (pForm == pMessage->m_pDstTarget)
604 return TRUE; 603 return true;
605 } 604 }
606 return FALSE; 605 return false;
607 } 606 }
608 607
609 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { 608 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
610 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); 609 int32_t iTrackLoop = m_noteLoopQueue.GetSize();
611 if (iTrackLoop <= 0) 610 if (iTrackLoop <= 0)
612 return nullptr; 611 return nullptr;
613 IFWL_Widget* pMessageForm = nullptr; 612 IFWL_Widget* pMessageForm = nullptr;
614 if (iTrackLoop > 1) { 613 if (iTrackLoop > 1) {
615 CFWL_NoteLoop* pNootLoop = 614 CFWL_NoteLoop* pNootLoop =
616 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); 615 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
617 pMessageForm = pNootLoop->GetForm(); 616 pMessageForm = pNootLoop->GetForm();
618 } else if (m_forms.Find(pDstTarget) < 0) { 617 } else if (m_forms.Find(pDstTarget) < 0) {
619 pMessageForm = pDstTarget; 618 pMessageForm = pDstTarget;
620 } 619 }
621 if (!pMessageForm && pDstTarget) { 620 if (!pMessageForm && pDstTarget) {
622 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); 621 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr();
623 if (!pWidgetMgr) 622 if (!pWidgetMgr)
624 return nullptr; 623 return nullptr;
625 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); 624 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget);
626 } 625 }
627 return pMessageForm; 626 return pMessageForm;
628 } 627 }
629 628
630 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { 629 void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) {
631 auto it = m_eventTargets.begin(); 630 auto it = m_eventTargets.begin();
632 while (it != m_eventTargets.end()) { 631 while (it != m_eventTargets.end()) {
633 auto old = it++; 632 auto old = it++;
634 if (old->second && (bRemoveAll || old->second->IsInvalid())) { 633 if (old->second && (bRemoveAll || old->second->IsInvalid())) {
635 delete old->second; 634 delete old->second;
636 m_eventTargets.erase(old); 635 m_eventTargets.erase(old);
637 } 636 }
638 } 637 }
639 } 638 }
640 639
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { 684 CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) {
686 return CFX_SizeF(); 685 return CFX_SizeF();
687 } 686 }
688 687
689 CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { 688 CFX_RectF CFWL_CoreToolTipDP::GetAnchor() {
690 return m_fAnchor; 689 return m_fAnchor;
691 } 690 }
692 691
693 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, 692 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver,
694 IFWL_Widget* pListener) 693 IFWL_Widget* pListener)
695 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} 694 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {}
696 CFWL_EventTarget::~CFWL_EventTarget() { 695 CFWL_EventTarget::~CFWL_EventTarget() {
697 m_eventSources.RemoveAll(); 696 m_eventSources.RemoveAll();
698 } 697 }
699 698
700 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, 699 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource,
701 uint32_t dwFilter) { 700 uint32_t dwFilter) {
702 if (pSource) { 701 if (pSource) {
703 m_eventSources.SetAt(pSource, dwFilter); 702 m_eventSources.SetAt(pSource, dwFilter);
704 return m_eventSources.GetCount(); 703 return m_eventSources.GetCount();
705 } 704 }
706 return 1; 705 return 1;
707 } 706 }
708 707
709 FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { 708 bool CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
710 IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate(); 709 IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate();
711 if (!pDelegate) 710 if (!pDelegate)
712 return FALSE; 711 return false;
713 if (m_eventSources.GetCount() == 0) { 712 if (m_eventSources.GetCount() == 0) {
714 pDelegate->OnProcessEvent(pEvent); 713 pDelegate->OnProcessEvent(pEvent);
715 return TRUE; 714 return true;
716 } 715 }
717 FX_POSITION pos = m_eventSources.GetStartPosition(); 716 FX_POSITION pos = m_eventSources.GetStartPosition();
718 while (pos) { 717 while (pos) {
719 IFWL_Widget* pSource = nullptr; 718 IFWL_Widget* pSource = nullptr;
720 uint32_t dwFilter = 0; 719 uint32_t dwFilter = 0;
721 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); 720 m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter);
722 if (pSource == pEvent->m_pSrcTarget || 721 if (pSource == pEvent->m_pSrcTarget ||
723 pEvent->GetClassID() == CFWL_EventType::Idle) { 722 pEvent->GetClassID() == CFWL_EventType::Idle) {
724 if (IsFilterEvent(pEvent, dwFilter)) { 723 if (IsFilterEvent(pEvent, dwFilter)) {
725 pDelegate->OnProcessEvent(pEvent); 724 pDelegate->OnProcessEvent(pEvent);
726 return TRUE; 725 return true;
727 } 726 }
728 } 727 }
729 } 728 }
730 return FALSE; 729 return false;
731 } 730 }
732 731
733 FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { 732 bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) {
734 if (dwFilter == FWL_EVENT_ALL_MASK) 733 if (dwFilter == FWL_EVENT_ALL_MASK)
735 return TRUE; 734 return true;
736 735
737 switch (pEvent->GetClassID()) { 736 switch (pEvent->GetClassID()) {
738 case CFWL_EventType::Mouse: 737 case CFWL_EventType::Mouse:
739 return !!(dwFilter & FWL_EVENT_MOUSE_MASK); 738 return !!(dwFilter & FWL_EVENT_MOUSE_MASK);
740 case CFWL_EventType::MouseWheel: 739 case CFWL_EventType::MouseWheel:
741 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); 740 return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK);
742 case CFWL_EventType::Key: 741 case CFWL_EventType::Key:
743 return !!(dwFilter & FWL_EVENT_KEY_MASK); 742 return !!(dwFilter & FWL_EVENT_KEY_MASK);
744 case CFWL_EventType::SetFocus: 743 case CFWL_EventType::SetFocus:
745 case CFWL_EventType::KillFocus: 744 case CFWL_EventType::KillFocus:
(...skipping 23 matching lines...) Expand all
769 if (!s_pInstance) 768 if (!s_pInstance)
770 s_pInstance = new CFWL_ToolTipContainer; 769 s_pInstance = new CFWL_ToolTipContainer;
771 return s_pInstance; 770 return s_pInstance;
772 } 771 }
773 772
774 // static 773 // static
775 void CFWL_ToolTipContainer::DeleteInstance() { 774 void CFWL_ToolTipContainer::DeleteInstance() {
776 delete s_pInstance; 775 delete s_pInstance;
777 s_pInstance = nullptr; 776 s_pInstance = nullptr;
778 } 777 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/ifwl_barcode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698