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

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

Issue 2436103002: Remove FWL globals. (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.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 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { 403 if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) {
407 return TRUE; 404 return TRUE;
408 } 405 }
409 #endif 406 #endif
410 return pDst != pMessageForm && 407 return pDst != pMessageForm &&
411 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && 408 !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) &&
412 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); 409 !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"));
413 } 410 }
414 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, 411 FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
415 IFWL_Widget* pMessageForm) { 412 IFWL_Widget* pMessageForm) {
416 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 413 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
417 if (pWidgetMgr->IsFormDisabled()) { 414 if (pWidgetMgr->IsFormDisabled()) {
418 m_pFocus = pMsg->m_pDstTarget; 415 m_pFocus = pMsg->m_pDstTarget;
419 return TRUE; 416 return TRUE;
420 } 417 }
421 IFWL_Widget* pWidget = pMsg->m_pDstTarget; 418 IFWL_Widget* pWidget = pMsg->m_pDstTarget;
422 if (pWidget) { 419 if (pWidget) {
423 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 420 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
424 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 421 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
425 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { 422 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
426 pMsg->m_pDstTarget = pSubFocus; 423 pMsg->m_pDstTarget = pSubFocus;
427 if (m_pFocus != pMsg->m_pDstTarget) { 424 if (m_pFocus != pMsg->m_pDstTarget) {
428 m_pFocus = pMsg->m_pDstTarget; 425 m_pFocus = pMsg->m_pDstTarget;
429 return TRUE; 426 return TRUE;
430 } 427 }
431 } 428 }
432 } 429 }
433 return FALSE; 430 return FALSE;
434 } 431 }
435 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, 432 FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
436 IFWL_Widget* pMessageForm) { 433 IFWL_Widget* pMessageForm) {
437 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 434 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
438 if (pWidgetMgr->IsFormDisabled()) { 435 if (pWidgetMgr->IsFormDisabled()) {
439 if (m_pFocus == pMsg->m_pDstTarget) { 436 if (m_pFocus == pMsg->m_pDstTarget) {
440 m_pFocus = nullptr; 437 m_pFocus = nullptr;
441 } 438 }
442 return TRUE; 439 return TRUE;
443 } 440 }
444 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget); 441 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget);
445 if (pForm) { 442 if (pForm) {
446 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 443 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
447 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { 444 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
448 pMsg->m_pDstTarget = pSubFocus; 445 pMsg->m_pDstTarget = pSubFocus;
449 if (m_pFocus == pMsg->m_pDstTarget) { 446 if (m_pFocus == pMsg->m_pDstTarget) {
450 m_pFocus = nullptr; 447 m_pFocus = nullptr;
451 return TRUE; 448 return TRUE;
452 } 449 }
453 } 450 }
454 } 451 }
455 return FALSE; 452 return FALSE;
456 } 453 }
457 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { 454 FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
458 #if (_FX_OS_ != _FX_MACOSX_) 455 #if (_FX_OS_ != _FX_MACOSX_)
459 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 456 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
460 pMsg->m_dwKeyCode == FWL_VKEY_Tab) { 457 pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
461 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 458 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
462 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget); 459 IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
463 IFWL_Widget* pFocus = m_pFocus; 460 IFWL_Widget* pFocus = m_pFocus;
464 if (m_pFocus) { 461 if (m_pFocus) {
465 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm) 462 if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm)
466 pFocus = nullptr; 463 pFocus = nullptr;
467 } 464 }
468 FX_BOOL bFind = FALSE; 465 FX_BOOL bFind = FALSE;
469 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); 466 IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind);
470 if (!pNextTabStop) { 467 if (!pNextTabStop) {
471 bFind = FALSE; 468 bFind = FALSE;
472 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind); 469 pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind);
473 } 470 }
474 if (pNextTabStop == pFocus) { 471 if (pNextTabStop == pFocus) {
475 return TRUE; 472 return TRUE;
476 } 473 }
477 if (pNextTabStop) { 474 if (pNextTabStop) {
478 SetFocus(pNextTabStop); 475 SetFocus(pNextTabStop);
479 } 476 }
480 return TRUE; 477 return TRUE;
481 } 478 }
482 #endif 479 #endif
483 if (!m_pFocus) { 480 if (!m_pFocus) {
484 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && 481 if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
485 pMsg->m_dwKeyCode == FWL_VKEY_Return) { 482 pMsg->m_dwKeyCode == FWL_VKEY_Return) {
486 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 483 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
487 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); 484 IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
488 if (defButton) { 485 if (defButton) {
489 pMsg->m_pDstTarget = defButton; 486 pMsg->m_pDstTarget = defButton;
490 return TRUE; 487 return TRUE;
491 } 488 }
492 } 489 }
493 return FALSE; 490 return FALSE;
494 } 491 }
495 pMsg->m_pDstTarget = m_pFocus; 492 pMsg->m_pDstTarget = m_pFocus;
496 return TRUE; 493 return TRUE;
497 } 494 }
498 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, 495 FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg,
499 IFWL_Widget* pMessageForm) { 496 IFWL_Widget* pMessageForm) {
500 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || 497 if (pMsg->m_dwCmd == FWL_MouseCommand::Leave ||
501 pMsg->m_dwCmd == FWL_MouseCommand::Hover || 498 pMsg->m_dwCmd == FWL_MouseCommand::Hover ||
502 pMsg->m_dwCmd == FWL_MouseCommand::Enter) { 499 pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
503 return !!pMsg->m_pDstTarget; 500 return !!pMsg->m_pDstTarget;
504 } 501 }
505 if (pMsg->m_pDstTarget != pMessageForm) { 502 if (pMsg->m_pDstTarget != pMessageForm) {
506 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); 503 pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy);
507 } 504 }
508 if (!DoMouseEx(pMsg, pMessageForm)) { 505 if (!DoMouseEx(pMsg, pMessageForm)) {
509 pMsg->m_pDstTarget = pMessageForm; 506 pMsg->m_pDstTarget = pMessageForm;
510 } 507 }
511 return TRUE; 508 return TRUE;
512 } 509 }
513 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, 510 FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
514 IFWL_Widget* pMessageForm) { 511 IFWL_Widget* pMessageForm) {
515 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 512 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
516 if (!pWidgetMgr) 513 if (!pWidgetMgr)
517 return FALSE; 514 return FALSE;
518 515
519 IFWL_Widget* pDst = 516 IFWL_Widget* pDst =
520 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 517 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
521 if (!pDst) 518 if (!pDst)
522 return FALSE; 519 return FALSE;
523 520
524 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); 521 pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy);
525 pMsg->m_pDstTarget = pDst; 522 pMsg->m_pDstTarget = pDst;
526 return TRUE; 523 return TRUE;
527 } 524 }
528 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { 525 FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
529 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 526 CFWL_WidgetMgr* pWidgetMgr =
527 pMsg->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
530 if (!pWidgetMgr) 528 if (!pWidgetMgr)
531 return FALSE; 529 return FALSE;
532 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, 530 pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
533 (FX_FLOAT)pMsg->m_iHeight); 531 (FX_FLOAT)pMsg->m_iHeight);
534 return TRUE; 532 return TRUE;
535 } 533 }
536 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, 534 FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg,
537 IFWL_Widget* pMessageForm) { 535 IFWL_Widget* pMessageForm) {
538 return pMsg->m_pDstTarget == pMessageForm; 536 return pMsg->m_pDstTarget == pMessageForm;
539 } 537 }
540 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, 538 FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg,
541 IFWL_Widget* pMessageForm) { 539 IFWL_Widget* pMessageForm) {
542 return pMsg->m_pDstTarget == pMessageForm; 540 return pMsg->m_pDstTarget == pMessageForm;
543 } 541 }
544 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, 542 FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
545 IFWL_Widget* pMessageForm) { 543 IFWL_Widget* pMessageForm) {
546 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 544 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
547 if (!pWidgetMgr) 545 if (!pWidgetMgr)
548 return FALSE; 546 return FALSE;
549 IFWL_Widget* pTarget = nullptr; 547 IFWL_Widget* pTarget = nullptr;
550 if (m_pGrab) 548 if (m_pGrab)
551 pTarget = m_pGrab; 549 pTarget = m_pGrab;
552 if (!pTarget) { 550 if (!pTarget) {
553 pTarget = 551 pTarget =
554 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); 552 pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
555 } 553 }
556 if (pTarget) { 554 if (pTarget) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return nullptr; 615 return nullptr;
618 IFWL_Widget* pMessageForm = nullptr; 616 IFWL_Widget* pMessageForm = nullptr;
619 if (iTrackLoop > 1) { 617 if (iTrackLoop > 1) {
620 CFWL_NoteLoop* pNootLoop = 618 CFWL_NoteLoop* pNootLoop =
621 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]); 619 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
622 pMessageForm = pNootLoop->GetForm(); 620 pMessageForm = pNootLoop->GetForm();
623 } else if (m_forms.Find(pDstTarget) < 0) { 621 } else if (m_forms.Find(pDstTarget) < 0) {
624 pMessageForm = pDstTarget; 622 pMessageForm = pDstTarget;
625 } 623 }
626 if (!pMessageForm && pDstTarget) { 624 if (!pMessageForm && pDstTarget) {
627 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); 625 CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr();
628 if (!pWidgetMgr) 626 if (!pWidgetMgr)
629 return nullptr; 627 return nullptr;
630 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); 628 pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget);
631 } 629 }
632 return pMessageForm; 630 return pMessageForm;
633 } 631 }
634 632
635 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { 633 void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) {
636 auto it = m_eventTargets.begin(); 634 auto it = m_eventTargets.begin();
637 while (it != m_eventTargets.end()) { 635 while (it != m_eventTargets.end()) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 if (!s_pInstance) 778 if (!s_pInstance)
781 s_pInstance = new CFWL_ToolTipContainer; 779 s_pInstance = new CFWL_ToolTipContainer;
782 return s_pInstance; 780 return s_pInstance;
783 } 781 }
784 782
785 // static 783 // static
786 void CFWL_ToolTipContainer::DeleteInstance() { 784 void CFWL_ToolTipContainer::DeleteInstance() {
787 delete s_pInstance; 785 delete s_pInstance;
788 s_pInstance = nullptr; 786 s_pInstance = nullptr;
789 } 787 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/ifwl_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698