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

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

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: fix mac Created 4 years, 2 months 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
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 IFWL_App* pApp = FWL_GetApp(); 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 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 28 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
28 if (!pDriver) 29 if (!pDriver)
29 return FWL_Error::Indefinite; 30 return FWL_Error::Indefinite;
31
30 pDriver->SendEvent(&ev); 32 pDriver->SendEvent(&ev);
31 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 33 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
32 } 34 }
33 #endif 35 #endif
34 return FWL_Error::Indefinite; 36 return FWL_Error::Indefinite;
35 } 37 }
36 IFWL_Widget* CFWL_NoteLoop::GetForm() { 38 IFWL_Widget* CFWL_NoteLoop::GetForm() {
37 return m_pForm; 39 return m_pForm;
38 } 40 }
39 FX_BOOL CFWL_NoteLoop::ContinueModal() { 41 FX_BOOL CFWL_NoteLoop::ContinueModal() {
40 return m_bContinueModal; 42 return m_bContinueModal;
41 } 43 }
42 FWL_Error CFWL_NoteLoop::EndModalLoop() { 44 FWL_Error CFWL_NoteLoop::EndModalLoop() {
43 m_bContinueModal = FALSE; 45 m_bContinueModal = FALSE;
44 return FWL_Error::Succeeded; 46 return FWL_Error::Succeeded;
45 } 47 }
46 48
47 FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) { 49 FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) {
48 m_pForm = pForm; 50 m_pForm = pForm;
49 return FWL_Error::Succeeded; 51 return FWL_Error::Succeeded;
50 } 52 }
51 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { 53 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
52 CFWL_EvtMenuCommand ev; 54 CFWL_EvtMenuCommand ev;
53 ev.m_iCommand = dwCommand; 55 ev.m_iCommand = dwCommand;
54 IFWL_App* pApp = m_pForm->GetOwnerApp(); 56 const IFWL_App* pApp = m_pForm->GetOwnerApp();
55 if (!pApp) 57 if (!pApp)
56 return; 58 return;
57 59
58 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 60 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
59 if (!pDriver) 61 if (!pDriver)
60 return; 62 return;
61 63
62 pDriver->SendEvent(&ev); 64 pDriver->SendEvent(&ev);
63 } 65 }
64 CFWL_NoteDriver::CFWL_NoteDriver() 66 CFWL_NoteDriver::CFWL_NoteDriver()
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 auto it = m_eventTargets.find(key); 110 auto it = m_eventTargets.find(key);
109 if (it != m_eventTargets.end()) 111 if (it != m_eventTargets.end())
110 it->second->FlagInvalid(); 112 it->second->FlagInvalid();
111 113
112 return FWL_Error::Succeeded; 114 return FWL_Error::Succeeded;
113 } 115 }
114 116
115 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { 117 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
116 ClearInvalidEventTargets(bRemoveAll); 118 ClearInvalidEventTargets(bRemoveAll);
117 } 119 }
118 IFWL_App* CFWL_NoteDriver::GetOwnerApp() const { 120
119 return FWL_GetApp();
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);
(...skipping 13 matching lines...) Expand all
144 if (bNotify) { 144 if (bNotify) {
145 ms.m_dwExtend = 1; 145 ms.m_dwExtend = 1;
146 } 146 }
147 IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr); 147 IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(nullptr);
148 if (pDelegate) { 148 if (pDelegate) {
149 pDelegate->OnProcessMessage(&ms); 149 pDelegate->OnProcessMessage(&ms);
150 } 150 }
151 } 151 }
152 if (pFocus) { 152 if (pFocus) {
153 IFWL_Widget* pWidget = 153 IFWL_Widget* pWidget =
154 CFWL_WidgetMgr::GetInstance()->GetSystemFormWidget(pFocus); 154 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus);
155 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 155 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
156 if (pForm) 156 if (pForm)
157 pForm->SetSubFocus(pFocus); 157 pForm->SetSubFocus(pFocus);
158 158
159 CFWL_MsgSetFocus ms; 159 CFWL_MsgSetFocus ms;
160 ms.m_pDstTarget = pFocus; 160 ms.m_pDstTarget = pFocus;
161 if (bNotify) { 161 if (bNotify) {
162 ms.m_dwExtend = 1; 162 ms.m_dwExtend = 1;
163 } 163 }
164 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr); 164 IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(nullptr);
165 if (pDelegate) { 165 if (pDelegate) {
166 pDelegate->OnProcessMessage(&ms); 166 pDelegate->OnProcessMessage(&ms);
167 } 167 }
168 } 168 }
169 return TRUE; 169 return TRUE;
170 } 170 }
171 FWL_Error CFWL_NoteDriver::Run() { 171 FWL_Error CFWL_NoteDriver::Run() {
172 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
173 if (!pWidgetMgr)
174 return FWL_Error::Indefinite;
175
176 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ 172 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
177 _FX_OS_ == _FX_WIN64_) 173 _FX_OS_ == _FX_WIN64_)
178 CFWL_NoteLoop* pTopLoop = nullptr; 174 CFWL_NoteLoop* pTopLoop = nullptr;
179 for (;;) { 175 for (;;) {
180 pTopLoop = GetTopLoop(); 176 pTopLoop = GetTopLoop();
181 if (!pTopLoop || !pTopLoop->ContinueModal()) 177 if (!pTopLoop || !pTopLoop->ContinueModal())
182 break; 178 break;
183 if (UnqueueMessage(pTopLoop)) 179 if (UnqueueMessage(pTopLoop))
184 continue; 180 continue;
185 } 181 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 int32_t size = m_noteLoopQueue.GetSize(); 283 int32_t size = m_noteLoopQueue.GetSize();
288 if (size <= 0) 284 if (size <= 0)
289 return nullptr; 285 return nullptr;
290 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); 286 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
291 } 287 }
292 int32_t CFWL_NoteDriver::CountLoop() { 288 int32_t CFWL_NoteDriver::CountLoop() {
293 return m_noteLoopQueue.GetSize(); 289 return m_noteLoopQueue.GetSize();
294 } 290 }
295 291
296 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { 292 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
297 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 293 CFWL_WidgetMgr* pWidgetMgr =
294 pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
298 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() 295 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
299 ? pMessage->m_pDstTarget 296 ? pMessage->m_pDstTarget
300 : GetMessageForm(pMessage->m_pDstTarget); 297 : GetMessageForm(pMessage->m_pDstTarget);
301 if (!pMessageForm) 298 if (!pMessageForm)
302 return FALSE; 299 return FALSE;
303 if (DispatchMessage(pMessage, pMessageForm)) { 300 if (DispatchMessage(pMessage, pMessageForm)) {
304 if (pMessage->GetClassID() == CFWL_MessageType::Mouse) 301 if (pMessage->GetClassID() == CFWL_MessageType::Mouse)
305 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); 302 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
306 return TRUE; 303 return TRUE;
307 } 304 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { 402 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) {
406 return TRUE; 403 return TRUE;
407 } 404 }
408 #endif 405 #endif
409 return pDst != pMessageForm && 406 return pDst != pMessageForm &&
410 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && 407 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) &&
411 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); 408 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"));
412 } 409 }
413 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, 410 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
414 IFWL_Widget* pMessageForm) { 411 IFWL_Widget* pMessageForm) {
415 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 412 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
416 if (pWidgetMgr->IsFormDisabled()) { 413 if (pWidgetMgr->IsFormDisabled()) {
417 m_pFocus = pMsg->m_pDstTarget; 414 m_pFocus = pMsg->m_pDstTarget;
418 return TRUE; 415 return TRUE;
419 } 416 }
420 IFWL_Widget* pWidget = pMsg->m_pDstTarget; 417 IFWL_Widget* pWidget = pMsg->m_pDstTarget;
421 if (pWidget) { 418 if (pWidget) {
422 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 419 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
423 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 420 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
424 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { 421 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
425 pMsg->m_pDstTarget = pSubFocus; 422 pMsg->m_pDstTarget = pSubFocus;
426 if (m_pFocus != pMsg->m_pDstTarget) { 423 if (m_pFocus != pMsg->m_pDstTarget) {
427 m_pFocus = pMsg->m_pDstTarget; 424 m_pFocus = pMsg->m_pDstTarget;
428 return TRUE; 425 return TRUE;
429 } 426 }
430 } 427 }
431 } 428 }
432 return FALSE; 429 return FALSE;
433 } 430 }
434 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, 431 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
435 IFWL_Widget* pMessageForm) { 432 IFWL_Widget* pMessageForm) {
436 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 433 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
437 if (pWidgetMgr->IsFormDisabled()) { 434 if (pWidgetMgr->IsFormDisabled()) {
438 if (m_pFocus == pMsg->m_pDstTarget) { 435 if (m_pFocus == pMsg->m_pDstTarget) {
439 m_pFocus = nullptr; 436 m_pFocus = nullptr;
440 } 437 }
441 return TRUE; 438 return TRUE;
442 } 439 }
443 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget); 440 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget);
444 if (pForm) { 441 if (pForm) {
445 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 442 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
446 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { 443 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
447 pMsg->m_pDstTarget = pSubFocus; 444 pMsg->m_pDstTarget = pSubFocus;
448 if (m_pFocus == pMsg->m_pDstTarget) { 445 if (m_pFocus == pMsg->m_pDstTarget) {
449 m_pFocus = nullptr; 446 m_pFocus = nullptr;
450 return TRUE; 447 return TRUE;
451 } 448 }
452 } 449 }
453 } 450 }
454 return FALSE; 451 return FALSE;
455 } 452 }
456 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { 453 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
457 #if (_FX_OS_ != _FX_MACOSX_) 454 #if (_FX_OS_ != _FX_MACOSX_)
458 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 455 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
459 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { 456 pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
460 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 457 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
461 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); 458 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
462 IFWL_Widget* pFocus = m_pFocus; 459 IFWL_Widget* pFocus = m_pFocus;
463 if (m_pFocus) { 460 if (m_pFocus) {
464 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm) 461 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm)
465 pFocus = nullptr; 462 pFocus = nullptr;
466 } 463 }
467 FX_BOOL bFind = FALSE; 464 FX_BOOL bFind = FALSE;
468 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); 465 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind);
469 if (!pNextTabStop) { 466 if (!pNextTabStop) {
470 bFind = FALSE; 467 bFind = FALSE;
471 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind); 468 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind);
472 } 469 }
473 if (pNextTabStop == pFocus) { 470 if (pNextTabStop == pFocus) {
474 return TRUE; 471 return TRUE;
475 } 472 }
476 if (pNextTabStop) { 473 if (pNextTabStop) {
477 SetFocus(pNextTabStop); 474 SetFocus(pNextTabStop);
478 } 475 }
479 return TRUE; 476 return TRUE;
480 } 477 }
481 #endif 478 #endif
482 if (!m_pFocus) { 479 if (!m_pFocus) {
483 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 480 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
484 pMsg->m_dwKeyCode == FWL_VKEY_Return) { 481 pMsg->m_dwKeyCode == FWL_VKEY_Return) {
485 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 482 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
486 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); 483 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
487 if (defButton) { 484 if (defButton) {
488 pMsg->m_pDstTarget = defButton; 485 pMsg->m_pDstTarget = defButton;
489 return TRUE; 486 return TRUE;
490 } 487 }
491 } 488 }
492 return FALSE; 489 return FALSE;
493 } 490 }
494 pMsg->m_pDstTarget = m_pFocus; 491 pMsg->m_pDstTarget = m_pFocus;
495 return TRUE; 492 return TRUE;
496 } 493 }
497 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, 494 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg,
498 IFWL_Widget* pMessageForm) { 495 IFWL_Widget* pMessageForm) {
499 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || 496 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave ||
500 pMsg->m_dwCmd == FWL_MouseCommand::Hover || 497 pMsg->m_dwCmd == FWL_MouseCommand::Hover ||
501 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { 498 pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
502 return !!pMsg->m_pDstTarget; 499 return !!pMsg->m_pDstTarget;
503 } 500 }
504 if (pMsg->m_pDstTarget != pMessageForm) { 501 if (pMsg->m_pDstTarget != pMessageForm) {
505 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); 502 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy);
506 } 503 }
507 if (!DoMouseEx(pMsg, pMessageForm)) { 504 if (!DoMouseEx(pMsg, pMessageForm)) {
508 pMsg->m_pDstTarget = pMessageForm; 505 pMsg->m_pDstTarget = pMessageForm;
509 } 506 }
510 return TRUE; 507 return TRUE;
511 } 508 }
512 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, 509 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
513 IFWL_Widget* pMessageForm) { 510 IFWL_Widget* pMessageForm) {
514 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 511 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
515 if (!pWidgetMgr) 512 if (!pWidgetMgr)
516 return FALSE; 513 return FALSE;
517 514
518 IFWL_Widget* pDst = 515 IFWL_Widget* pDst =
519 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 516 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
520 if (!pDst) 517 if (!pDst)
521 return FALSE; 518 return FALSE;
522 519
523 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); 520 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy);
524 pMsg->m_pDstTarget = pDst; 521 pMsg->m_pDstTarget = pDst;
525 return TRUE; 522 return TRUE;
526 } 523 }
527 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { 524 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
528 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 525 CFWL_WidgetMgr* pWidgetMgr =
526 pMsg->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
529 if (!pWidgetMgr) 527 if (!pWidgetMgr)
530 return FALSE; 528 return FALSE;
531 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, 529 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
532 (FX_FLOAT)pMsg->m_iHeight); 530 (FX_FLOAT)pMsg->m_iHeight);
533 return TRUE; 531 return TRUE;
534 } 532 }
535 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, 533 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg,
536 IFWL_Widget* pMessageForm) { 534 IFWL_Widget* pMessageForm) {
537 return pMsg->m_pDstTarget == pMessageForm; 535 return pMsg->m_pDstTarget == pMessageForm;
538 } 536 }
539 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, 537 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg,
540 IFWL_Widget* pMessageForm) { 538 IFWL_Widget* pMessageForm) {
541 return pMsg->m_pDstTarget == pMessageForm; 539 return pMsg->m_pDstTarget == pMessageForm;
542 } 540 }
543 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, 541 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
544 IFWL_Widget* pMessageForm) { 542 IFWL_Widget* pMessageForm) {
545 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 543 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
546 if (!pWidgetMgr) 544 if (!pWidgetMgr)
547 return FALSE; 545 return FALSE;
548 IFWL_Widget* pTarget = nullptr; 546 IFWL_Widget* pTarget = nullptr;
549 if (m_pGrab) 547 if (m_pGrab)
550 pTarget = m_pGrab; 548 pTarget = m_pGrab;
551 if (!pTarget) { 549 if (!pTarget) {
552 pTarget = 550 pTarget =
553 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 551 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
554 } 552 }
555 if (pTarget) { 553 if (pTarget) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 return nullptr; 614 return nullptr;
617 IFWL_Widget* pMessageForm = nullptr; 615 IFWL_Widget* pMessageForm = nullptr;
618 if (iTrackLoop > 1) { 616 if (iTrackLoop > 1) {
619 CFWL_NoteLoop* pNootLoop = 617 CFWL_NoteLoop* pNootLoop =
620 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); 618 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
621 pMessageForm = pNootLoop->GetForm(); 619 pMessageForm = pNootLoop->GetForm();
622 } else if (m_forms.Find(pDstTarget) < 0) { 620 } else if (m_forms.Find(pDstTarget) < 0) {
623 pMessageForm = pDstTarget; 621 pMessageForm = pDstTarget;
624 } 622 }
625 if (!pMessageForm && pDstTarget) { 623 if (!pMessageForm && pDstTarget) {
626 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 624 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr();
627 if (!pWidgetMgr) 625 if (!pWidgetMgr)
628 return nullptr; 626 return nullptr;
629 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); 627 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget);
630 } 628 }
631 return pMessageForm; 629 return pMessageForm;
632 } 630 }
633 631
634 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { 632 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) {
635 auto it = m_eventTargets.begin(); 633 auto it = m_eventTargets.begin();
636 while (it != m_eventTargets.end()) { 634 while (it != m_eventTargets.end()) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 if (!s_pInstance) 777 if (!s_pInstance)
780 s_pInstance = new CFWL_ToolTipContainer; 778 s_pInstance = new CFWL_ToolTipContainer;
781 return s_pInstance; 779 return s_pInstance;
782 } 780 }
783 781
784 // static 782 // static
785 void CFWL_ToolTipContainer::DeleteInstance() { 783 void CFWL_ToolTipContainer::DeleteInstance() {
786 delete s_pInstance; 784 delete s_pInstance;
787 s_pInstance = nullptr; 785 s_pInstance = nullptr;
788 } 786 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/ifwl_app.h » ('j') | xfa/fwl/core/ifwl_app.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698