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

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

Issue 2525083002: Rename IFWL classes which do not have CFWL equivalents (Closed)
Patch Set: Created 4 years 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/cfwl_monthcalendar.cpp ('k') | xfa/fwl/core/cfwl_scrollbar.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/cfwl_notedriver.h" 7 #include "xfa/fwl/core/cfwl_notedriver.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "core/fxcrt/fx_ext.h" 11 #include "core/fxcrt/fx_ext.h"
12 #include "third_party/base/ptr_util.h" 12 #include "third_party/base/ptr_util.h"
13 #include "third_party/base/stl_util.h" 13 #include "third_party/base/stl_util.h"
14 #include "xfa/fwl/core/cfwl_app.h" 14 #include "xfa/fwl/core/cfwl_app.h"
15 #include "xfa/fwl/core/cfwl_eventtarget.h" 15 #include "xfa/fwl/core/cfwl_eventtarget.h"
16 #include "xfa/fwl/core/cfwl_form.h"
16 #include "xfa/fwl/core/cfwl_msgkey.h" 17 #include "xfa/fwl/core/cfwl_msgkey.h"
17 #include "xfa/fwl/core/cfwl_msgkillfocus.h" 18 #include "xfa/fwl/core/cfwl_msgkillfocus.h"
18 #include "xfa/fwl/core/cfwl_msgmouse.h" 19 #include "xfa/fwl/core/cfwl_msgmouse.h"
19 #include "xfa/fwl/core/cfwl_msgmousewheel.h" 20 #include "xfa/fwl/core/cfwl_msgmousewheel.h"
20 #include "xfa/fwl/core/cfwl_msgsetfocus.h" 21 #include "xfa/fwl/core/cfwl_msgsetfocus.h"
21 #include "xfa/fwl/core/cfwl_noteloop.h" 22 #include "xfa/fwl/core/cfwl_noteloop.h"
22 #include "xfa/fwl/core/cfwl_widgetmgr.h" 23 #include "xfa/fwl/core/cfwl_widgetmgr.h"
23 #include "xfa/fwl/core/ifwl_form.h"
24 24
25 CFWL_NoteDriver::CFWL_NoteDriver() 25 CFWL_NoteDriver::CFWL_NoteDriver()
26 : m_pHover(nullptr), 26 : m_pHover(nullptr),
27 m_pFocus(nullptr), 27 m_pFocus(nullptr),
28 m_pGrab(nullptr), 28 m_pGrab(nullptr),
29 m_pNoteLoop(pdfium::MakeUnique<CFWL_NoteLoop>()) { 29 m_pNoteLoop(pdfium::MakeUnique<CFWL_NoteLoop>()) {
30 PushNoteLoop(m_pNoteLoop.get()); 30 PushNoteLoop(m_pNoteLoop.get());
31 } 31 }
32 32
33 CFWL_NoteDriver::~CFWL_NoteDriver() { 33 CFWL_NoteDriver::~CFWL_NoteDriver() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ms.m_pSrcTarget = pPrev; 96 ms.m_pSrcTarget = pPrev;
97 if (bNotify) 97 if (bNotify)
98 ms.m_dwExtend = 1; 98 ms.m_dwExtend = 1;
99 99
100 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate()) 100 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate())
101 pDelegate->OnProcessMessage(&ms); 101 pDelegate->OnProcessMessage(&ms);
102 } 102 }
103 if (pFocus) { 103 if (pFocus) {
104 IFWL_Widget* pWidget = 104 IFWL_Widget* pWidget =
105 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); 105 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus);
106 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 106 CFWL_Form* pForm = static_cast<CFWL_Form*>(pWidget);
107 if (pForm) 107 if (pForm)
108 pForm->SetSubFocus(pFocus); 108 pForm->SetSubFocus(pFocus);
109 109
110 CFWL_MsgSetFocus ms; 110 CFWL_MsgSetFocus ms;
111 ms.m_pDstTarget = pFocus; 111 ms.m_pDstTarget = pFocus;
112 if (bNotify) 112 if (bNotify)
113 ms.m_dwExtend = 1; 113 ms.m_dwExtend = 1;
114 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) 114 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate())
115 pDelegate->OnProcessMessage(&ms); 115 pDelegate->OnProcessMessage(&ms);
116 } 116 }
(...skipping 25 matching lines...) Expand all
142 if (m_pFocus == pNoteTarget) 142 if (m_pFocus == pNoteTarget)
143 m_pFocus = nullptr; 143 m_pFocus = nullptr;
144 if (m_pHover == pNoteTarget) 144 if (m_pHover == pNoteTarget)
145 m_pHover = nullptr; 145 m_pHover = nullptr;
146 if (m_pGrab == pNoteTarget) 146 if (m_pGrab == pNoteTarget)
147 m_pGrab = nullptr; 147 m_pGrab = nullptr;
148 148
149 UnregisterEventTarget(pNoteTarget); 149 UnregisterEventTarget(pNoteTarget);
150 150
151 for (int32_t nIndex = 0; nIndex < m_forms.GetSize(); nIndex++) { 151 for (int32_t nIndex = 0; nIndex < m_forms.GetSize(); nIndex++) {
152 IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[nIndex]); 152 CFWL_Form* pForm = static_cast<CFWL_Form*>(m_forms[nIndex]);
153 if (!pForm) 153 if (!pForm)
154 continue; 154 continue;
155 155
156 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 156 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
157 if (!pSubFocus) 157 if (!pSubFocus)
158 return; 158 return;
159 if (pSubFocus == pNoteTarget) 159 if (pSubFocus == pNoteTarget)
160 pForm->SetSubFocus(nullptr); 160 pForm->SetSubFocus(nullptr);
161 } 161 }
162 } 162 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 268 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
269 if (pWidgetMgr->IsFormDisabled()) { 269 if (pWidgetMgr->IsFormDisabled()) {
270 m_pFocus = pMessage->m_pDstTarget; 270 m_pFocus = pMessage->m_pDstTarget;
271 return true; 271 return true;
272 } 272 }
273 273
274 IFWL_Widget* pWidget = pMessage->m_pDstTarget; 274 IFWL_Widget* pWidget = pMessage->m_pDstTarget;
275 if (!pWidget) 275 if (!pWidget)
276 return false; 276 return false;
277 277
278 IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget); 278 CFWL_Form* pForm = static_cast<CFWL_Form*>(pWidget);
279 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 279 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
280 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) { 280 if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
281 pMessage->m_pDstTarget = pSubFocus; 281 pMessage->m_pDstTarget = pSubFocus;
282 if (m_pFocus != pMessage->m_pDstTarget) { 282 if (m_pFocus != pMessage->m_pDstTarget) {
283 m_pFocus = pMessage->m_pDstTarget; 283 m_pFocus = pMessage->m_pDstTarget;
284 return true; 284 return true;
285 } 285 }
286 } 286 }
287 return false; 287 return false;
288 } 288 }
289 289
290 bool CFWL_NoteDriver::DoKillFocus(CFWL_Message* pMessage, 290 bool CFWL_NoteDriver::DoKillFocus(CFWL_Message* pMessage,
291 IFWL_Widget* pMessageForm) { 291 IFWL_Widget* pMessageForm) {
292 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); 292 CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
293 if (pWidgetMgr->IsFormDisabled()) { 293 if (pWidgetMgr->IsFormDisabled()) {
294 if (m_pFocus == pMessage->m_pDstTarget) 294 if (m_pFocus == pMessage->m_pDstTarget)
295 m_pFocus = nullptr; 295 m_pFocus = nullptr;
296 return true; 296 return true;
297 } 297 }
298 298
299 IFWL_Form* pForm = static_cast<IFWL_Form*>(pMessage->m_pDstTarget); 299 CFWL_Form* pForm = static_cast<CFWL_Form*>(pMessage->m_pDstTarget);
300 if (!pForm) 300 if (!pForm)
301 return false; 301 return false;
302 302
303 IFWL_Widget* pSubFocus = pForm->GetSubFocus(); 303 IFWL_Widget* pSubFocus = pForm->GetSubFocus();
304 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) { 304 if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
305 pMessage->m_pDstTarget = pSubFocus; 305 pMessage->m_pDstTarget = pSubFocus;
306 if (m_pFocus == pMessage->m_pDstTarget) { 306 if (m_pFocus == pMessage->m_pDstTarget) {
307 m_pFocus = nullptr; 307 m_pFocus = nullptr;
308 return true; 308 return true;
309 } 309 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 bool CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { 444 bool CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
445 for (int32_t i = 0; i < m_noteLoopQueue.GetSize(); i++) { 445 for (int32_t i = 0; i < m_noteLoopQueue.GetSize(); i++) {
446 CFWL_NoteLoop* pNoteLoop = m_noteLoopQueue[i]; 446 CFWL_NoteLoop* pNoteLoop = m_noteLoopQueue[i];
447 IFWL_Widget* pForm = pNoteLoop->GetForm(); 447 IFWL_Widget* pForm = pNoteLoop->GetForm();
448 if (pForm && (pForm == pMessage->m_pDstTarget)) 448 if (pForm && (pForm == pMessage->m_pDstTarget))
449 return true; 449 return true;
450 } 450 }
451 451
452 for (int32_t j = 0; j < m_forms.GetSize(); j++) { 452 for (int32_t j = 0; j < m_forms.GetSize(); j++) {
453 IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[j]); 453 CFWL_Form* pForm = static_cast<CFWL_Form*>(m_forms[j]);
454 if (pForm == pMessage->m_pDstTarget) 454 if (pForm == pMessage->m_pDstTarget)
455 return true; 455 return true;
456 } 456 }
457 return false; 457 return false;
458 } 458 }
459 459
460 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { 460 IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
461 int32_t iTrackLoop = m_noteLoopQueue.GetSize(); 461 int32_t iTrackLoop = m_noteLoopQueue.GetSize();
462 if (iTrackLoop <= 0) 462 if (iTrackLoop <= 0)
463 return nullptr; 463 return nullptr;
(...skipping 15 matching lines...) Expand all
479 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { 479 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) {
480 auto it = m_eventTargets.begin(); 480 auto it = m_eventTargets.begin();
481 while (it != m_eventTargets.end()) { 481 while (it != m_eventTargets.end()) {
482 auto old = it++; 482 auto old = it++;
483 if (old->second && (bRemoveAll || old->second->IsInvalid())) { 483 if (old->second && (bRemoveAll || old->second->IsInvalid())) {
484 delete old->second; 484 delete old->second;
485 m_eventTargets.erase(old); 485 m_eventTargets.erase(old);
486 } 486 }
487 } 487 }
488 } 488 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_monthcalendar.cpp ('k') | xfa/fwl/core/cfwl_scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698