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

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

Issue 1886703005: Remove unused FWL methods (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h" 10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h"
11 #include "xfa/fwl/basewidget/ifwl_tooltip.h" 11 #include "xfa/fwl/basewidget/ifwl_tooltip.h"
12 #include "xfa/fwl/core/cfwl_message.h" 12 #include "xfa/fwl/core/cfwl_message.h"
13 #include "xfa/fwl/core/fwl_appimp.h" 13 #include "xfa/fwl/core/fwl_appimp.h"
14 #include "xfa/fwl/core/fwl_formimp.h" 14 #include "xfa/fwl/core/fwl_formimp.h"
15 #include "xfa/fwl/core/fwl_panelimp.h" 15 #include "xfa/fwl/core/fwl_panelimp.h"
16 #include "xfa/fwl/core/fwl_targetimp.h" 16 #include "xfa/fwl/core/fwl_targetimp.h"
17 #include "xfa/fwl/core/fwl_threadimp.h" 17 #include "xfa/fwl/core/fwl_threadimp.h"
18 #include "xfa/fwl/core/fwl_widgetimp.h" 18 #include "xfa/fwl/core/fwl_widgetimp.h"
19 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 19 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
20 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" 20 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
21 #include "xfa/fwl/core/ifwl_app.h" 21 #include "xfa/fwl/core/ifwl_app.h"
22 #include "xfa/fwl/core/ifwl_tooltiptarget.h" 22 #include "xfa/fwl/core/ifwl_tooltiptarget.h"
23 23
24 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) 24 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm)
25 : m_pForm(pForm), m_bContinueModal(TRUE) {} 25 : m_pForm(pForm), m_bContinueModal(TRUE) {}
26 FX_BOOL CFWL_NoteLoop::PreProcessMessage(CFWL_Message* pMessage) { 26
27 if (!m_pForm) {
28 return FALSE;
29 }
30 return TranslateAccelerator(pMessage);
dsinclair 2016/04/13 20:07:47 TranslateAccelerator would always return FALSE sin
31 }
32 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { 27 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) {
33 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 28 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
34 if (count <= 0) { 29 if (count <= 0) {
35 #endif 30 #endif
36 CFWL_EvtIdle ev; 31 CFWL_EvtIdle ev;
37 IFWL_App* pApp = FWL_GetApp(); 32 IFWL_App* pApp = FWL_GetApp();
38 if (!pApp) 33 if (!pApp)
39 return FWL_ERR_Indefinite; 34 return FWL_ERR_Indefinite;
40 IFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 35 IFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
41 if (!pDriver) 36 if (!pDriver)
(...skipping 12 matching lines...) Expand all
54 } 49 }
55 FWL_ERR CFWL_NoteLoop::EndModalLoop() { 50 FWL_ERR CFWL_NoteLoop::EndModalLoop() {
56 m_bContinueModal = FALSE; 51 m_bContinueModal = FALSE;
57 #if (_FX_OS_ == _FX_MACOSX_) 52 #if (_FX_OS_ == _FX_MACOSX_)
58 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); 53 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
59 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr(); 54 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
60 adapterWidgetMgr->EndLoop(); 55 adapterWidgetMgr->EndLoop();
61 #endif 56 #endif
62 return FWL_ERR_Succeeded; 57 return FWL_ERR_Succeeded;
63 } 58 }
64 FX_BOOL CFWL_NoteLoop::TranslateAccelerator(CFWL_Message* pMessage) { 59
65 if (pMessage->GetClassID() != FWL_MSGHASH_Key) {
66 return FALSE;
67 }
68 CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
69 if (pMsgKey->m_dwCmd != FWL_MSGKEYCMD_KeyDown) {
70 return FALSE;
71 }
72 CFX_MapAccelerators& accel =
73 static_cast<CFWL_FormImp*>(m_pForm)->GetAccelerator();
74 FX_POSITION pos = accel.GetStartPosition();
75 if (!pos) {
76 return FALSE;
77 }
78 uint32_t vrKey, rValue;
79 while (pos) {
80 accel.GetNextAssoc(pos, vrKey, rValue);
81 uint32_t dwFlags = (vrKey & 0xFF00) >> 8;
82 uint32_t m_dwKeyCode = vrKey & 0x00FF;
83 if (pMsgKey->m_dwFlags == dwFlags && pMsgKey->m_dwKeyCode == m_dwKeyCode) {
84 GenerateCommondEvent(rValue);
85 return TRUE;
86 }
87 }
88 return FALSE;
89 }
90 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { 60 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) {
91 m_pForm = pForm; 61 m_pForm = pForm;
92 return FWL_ERR_Succeeded; 62 return FWL_ERR_Succeeded;
93 } 63 }
94 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { 64 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
95 CFWL_EvtMenuCommand ev; 65 CFWL_EvtMenuCommand ev;
96 ev.m_iCommand = dwCommand; 66 ev.m_iCommand = dwCommand;
97 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread(); 67 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
98 if (!pThread) 68 if (!pThread)
99 return; 69 return;
100 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); 70 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
101 if (!pDriver) 71 if (!pDriver)
102 return; 72 return;
103 pDriver->SendNote(&ev); 73 pDriver->SendNote(&ev);
104 } 74 }
105 CFWL_NoteDriver::CFWL_NoteDriver() 75 CFWL_NoteDriver::CFWL_NoteDriver()
106 : m_sendEventCalled(0), 76 : m_sendEventCalled(0),
107 m_maxSize(500),
108 m_bFullScreen(FALSE), 77 m_bFullScreen(FALSE),
109 m_pHover(nullptr), 78 m_pHover(nullptr),
110 m_pFocus(nullptr), 79 m_pFocus(nullptr),
111 m_pGrab(nullptr), 80 m_pGrab(nullptr) {
112 m_hook(nullptr) {
113 m_pNoteLoop = new CFWL_NoteLoop; 81 m_pNoteLoop = new CFWL_NoteLoop;
114 PushNoteLoop(m_pNoteLoop); 82 PushNoteLoop(m_pNoteLoop);
115 } 83 }
116 CFWL_NoteDriver::~CFWL_NoteDriver() { 84 CFWL_NoteDriver::~CFWL_NoteDriver() {
117 delete m_pNoteLoop; 85 delete m_pNoteLoop;
118 ClearInvalidEventTargets(TRUE); 86 ClearInvalidEventTargets(TRUE);
119 } 87 }
120 FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) { 88 FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
121 if (pNote->IsEvent()) { 89 if (pNote->IsEvent()) {
122 int32_t iCount = m_eventTargets.GetCount(); 90 int32_t iCount = m_eventTargets.GetCount();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 158 }
191 CFWL_EventTarget* value = NULL; 159 CFWL_EventTarget* value = NULL;
192 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { 160 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) {
193 value->FlagInvalid(); 161 value->FlagInvalid();
194 } 162 }
195 return FWL_ERR_Succeeded; 163 return FWL_ERR_Succeeded;
196 } 164 }
197 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { 165 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
198 ClearInvalidEventTargets(bRemoveAll); 166 ClearInvalidEventTargets(bRemoveAll);
199 } 167 }
200 int32_t CFWL_NoteDriver::GetQueueMaxSize() const {
201 return m_maxSize;
202 }
203 FWL_ERR CFWL_NoteDriver::SetQueueMaxSize(const int32_t size) {
204 m_maxSize = size;
205 return FWL_ERR_Succeeded;
206 }
207 IFWL_NoteThread* CFWL_NoteDriver::GetOwnerThread() const { 168 IFWL_NoteThread* CFWL_NoteDriver::GetOwnerThread() const {
208 return FWL_GetApp(); 169 return FWL_GetApp();
209 } 170 }
210 FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) { 171 FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) {
211 m_noteLoopQueue.Add(pNoteLoop); 172 m_noteLoopQueue.Add(pNoteLoop);
212 return FWL_ERR_Succeeded; 173 return FWL_ERR_Succeeded;
213 } 174 }
214 IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { 175 IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
215 int32_t pos = m_noteLoopQueue.GetSize(); 176 int32_t pos = m_noteLoopQueue.GetSize();
216 if (pos <= 0) 177 if (pos <= 0)
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { 365 FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
405 if (m_noteQueue.GetSize() < 1) { 366 if (m_noteQueue.GetSize() < 1) {
406 return FALSE; 367 return FALSE;
407 } 368 }
408 CFWL_Message* pMessage = static_cast<CFWL_Message*>(m_noteQueue[0]); 369 CFWL_Message* pMessage = static_cast<CFWL_Message*>(m_noteQueue[0]);
409 m_noteQueue.RemoveAt(0); 370 m_noteQueue.RemoveAt(0);
410 if (!IsValidMessage(pMessage)) { 371 if (!IsValidMessage(pMessage)) {
411 pMessage->Release(); 372 pMessage->Release();
412 return TRUE; 373 return TRUE;
413 } 374 }
414 FX_BOOL bHookMessage = FALSE; 375 ProcessMessage(pMessage);
415 if (m_hook) { 376
416 bHookMessage = (*m_hook)(pMessage, m_hookInfo);
417 }
418 if (!bHookMessage && !pNoteLoop->PreProcessMessage(pMessage)) {
419 ProcessMessage(pMessage);
420 }
421 pMessage->Release(); 377 pMessage->Release();
422 return TRUE; 378 return TRUE;
423 } 379 }
424 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { 380 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
425 int32_t size = m_noteLoopQueue.GetSize(); 381 int32_t size = m_noteLoopQueue.GetSize();
426 if (size <= 0) 382 if (size <= 0)
427 return NULL; 383 return NULL;
428 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]); 384 return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
429 } 385 }
430 int32_t CFWL_NoteDriver::CountLoop() { 386 int32_t CFWL_NoteDriver::CountLoop() {
431 return m_noteLoopQueue.GetSize(); 387 return m_noteLoopQueue.GetSize();
432 } 388 }
433 void CFWL_NoteDriver::SetHook(FWLMessageHookCallback callback, void* info) { 389
434 m_hook = callback;
435 m_hookInfo = info;
436 }
437 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { 390 FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
438 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); 391 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
439 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() 392 IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
440 ? pMessage->m_pDstTarget 393 ? pMessage->m_pDstTarget
441 : GetMessageForm(pMessage->m_pDstTarget); 394 : GetMessageForm(pMessage->m_pDstTarget);
442 if (!pMessageForm) 395 if (!pMessageForm)
443 return FALSE; 396 return FALSE;
444 if (DispatchMessage(pMessage, pMessageForm)) { 397 if (DispatchMessage(pMessage, pMessageForm)) {
445 if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) { 398 if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
446 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); 399 MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { 987 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) {
1035 m_pToolTipImp->Hide(); 988 m_pToolTipImp->Hide();
1036 pCurTarget = NULL; 989 pCurTarget = NULL;
1037 return TRUE; 990 return TRUE;
1038 } 991 }
1039 return FALSE; 992 return FALSE;
1040 } 993 }
1041 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { 994 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
1042 return pCurTarget; 995 return pCurTarget;
1043 } 996 }
1044 FX_ERR CFWL_ToolTipContainer::SetToolTipInitialDelay(int32_t nDelayTime) {
1045 m_ToolTipDp->m_nInitDelayTime = nDelayTime;
1046 return FWL_ERR_Succeeded;
1047 }
1048 FX_ERR CFWL_ToolTipContainer::SetToolTipAutoPopDelay(int32_t nDelayTime) {
1049 m_ToolTipDp->m_nAutoPopDelayTime = nDelayTime;
1050 return FWL_ERR_Succeeded;
1051 }
1052 FWL_ERR FWL_AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
1053 return CFWL_ToolTipContainer::getInstance()->AddToolTipTarget(pTarget);
1054 }
1055 FWL_ERR FWL_RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
1056 return CFWL_ToolTipContainer::getInstance()->RemoveToolTipTarget(pTarget);
1057 }
1058 FWL_ERR FWL_SetToolTipInitialDelay(int32_t nDelayTime) {
1059 return CFWL_ToolTipContainer::getInstance()->SetToolTipInitialDelay(
1060 nDelayTime);
1061 }
1062 FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t nDelayTime) {
1063 return CFWL_ToolTipContainer::getInstance()->SetToolTipAutoPopDelay(
1064 nDelayTime);
1065 }
1066 IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
1067 if (!pNoteThread)
1068 return NULL;
1069 CFWL_NoteDriver* noteDriver =
1070 static_cast<CFWL_NoteDriver*>(pNoteThread->GetNoteDriver());
1071 if (!noteDriver)
1072 return NULL;
1073 if (noteDriver->CountLoop() == 1) {
1074 return NULL;
1075 }
1076 CFWL_NoteLoop* topLoop = noteDriver->GetTopLoop();
1077 if (!topLoop)
1078 return NULL;
1079 CFWL_WidgetImp* widget = topLoop->GetForm();
1080 if (!widget)
1081 return NULL;
1082 return widget->GetInterface();
1083 }
1084 FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver,
1085 FWLMessageHookCallback callback,
1086 void* info) {
1087 CFWL_NoteDriver* noteDriver = static_cast<CFWL_NoteDriver*>(driver);
1088 noteDriver->SetHook(callback, info);
1089 return FWL_ERR_Succeeded;
1090 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698