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

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

Issue 1921853006: More FWL interface cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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_targetimp.h"
16 #include "xfa/fwl/core/fwl_threadimp.h"
17 #include "xfa/fwl/core/fwl_widgetimp.h" 15 #include "xfa/fwl/core/fwl_widgetimp.h"
18 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 16 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
19 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" 17 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
20 #include "xfa/fwl/core/ifwl_app.h" 18 #include "xfa/fwl/core/ifwl_app.h"
21 #include "xfa/fwl/core/ifwl_tooltiptarget.h" 19 #include "xfa/fwl/core/ifwl_tooltiptarget.h"
22 20
23 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) 21 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm)
24 : m_pForm(pForm), m_bContinueModal(TRUE) {} 22 : m_pForm(pForm), m_bContinueModal(TRUE) {}
25 23
26 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { 24 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) {
27 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 25 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
28 if (count <= 0) { 26 if (count <= 0) {
29 #endif 27 #endif
30 CFWL_EvtIdle ev; 28 CFWL_EvtIdle ev;
31 IFWL_App* pApp = FWL_GetApp(); 29 IFWL_App* pApp = FWL_GetApp();
32 if (!pApp) 30 if (!pApp)
33 return FWL_ERR_Indefinite; 31 return FWL_ERR_Indefinite;
34 IFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); 32 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
35 if (!pDriver) 33 if (!pDriver)
36 return FWL_ERR_Indefinite; 34 return FWL_ERR_Indefinite;
37 pDriver->SendEvent(&ev); 35 pDriver->SendEvent(&ev);
38 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) 36 #if (_FX_OS_ == _FX_WIN32_DESKTOP_)
39 } 37 }
40 #endif 38 #endif
41 return FWL_ERR_Indefinite; 39 return FWL_ERR_Indefinite;
42 } 40 }
43 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { 41 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() {
44 return m_pForm; 42 return m_pForm;
(...skipping 11 matching lines...) Expand all
56 return FWL_ERR_Succeeded; 54 return FWL_ERR_Succeeded;
57 } 55 }
58 56
59 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { 57 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) {
60 m_pForm = pForm; 58 m_pForm = pForm;
61 return FWL_ERR_Succeeded; 59 return FWL_ERR_Succeeded;
62 } 60 }
63 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { 61 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
64 CFWL_EvtMenuCommand ev; 62 CFWL_EvtMenuCommand ev;
65 ev.m_iCommand = dwCommand; 63 ev.m_iCommand = dwCommand;
66 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); 64 IFWL_App* pThread = m_pForm->GetOwnerThread();
67 if (!pThread) 65 if (!pThread)
68 return; 66 return;
69 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); 67 CFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
70 if (!pDriver) 68 if (!pDriver)
71 return; 69 return;
72 pDriver->SendEvent(&ev); 70 pDriver->SendEvent(&ev);
73 } 71 }
74 CFWL_NoteDriver::CFWL_NoteDriver() 72 CFWL_NoteDriver::CFWL_NoteDriver()
75 : m_sendEventCalled(0), 73 : m_sendEventCalled(0),
76 m_pHover(nullptr), 74 m_pHover(nullptr),
77 m_pFocus(nullptr), 75 m_pFocus(nullptr),
78 m_pGrab(nullptr) { 76 m_pGrab(nullptr) {
79 m_pNoteLoop = new CFWL_NoteLoop; 77 m_pNoteLoop = new CFWL_NoteLoop;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 144 }
147 CFWL_EventTarget* value = NULL; 145 CFWL_EventTarget* value = NULL;
148 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { 146 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) {
149 value->FlagInvalid(); 147 value->FlagInvalid();
150 } 148 }
151 return FWL_ERR_Succeeded; 149 return FWL_ERR_Succeeded;
152 } 150 }
153 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { 151 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
154 ClearInvalidEventTargets(bRemoveAll); 152 ClearInvalidEventTargets(bRemoveAll);
155 } 153 }
156 IFWL_Thread* CFWL_NoteDriver::GetOwnerThread() const { 154 IFWL_App* CFWL_NoteDriver::GetOwnerThread() const {
157 return FWL_GetApp(); 155 return FWL_GetApp();
158 } 156 }
159 FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) { 157 FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
160 m_noteLoopQueue.Add(pNoteLoop); 158 m_noteLoopQueue.Add(pNoteLoop);
161 return FWL_ERR_Succeeded; 159 return FWL_ERR_Succeeded;
162 } 160 }
163 IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { 161 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
164 int32_t pos = m_noteLoopQueue.GetSize(); 162 int32_t pos = m_noteLoopQueue.GetSize();
165 if (pos <= 0) 163 if (pos <= 0)
166 return NULL; 164 return nullptr;
167 IFWL_NoteLoop* p = 165
168 static_cast<IFWL_NoteLoop*>(m_noteLoopQueue.GetAt(pos - 1)); 166 CFWL_NoteLoop* p =
167 static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(pos - 1));
169 m_noteLoopQueue.RemoveAt(pos - 1); 168 m_noteLoopQueue.RemoveAt(pos - 1);
170 return p; 169 return p;
171 } 170 }
172 FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { 171 FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
173 if (m_pFocus == pFocus) { 172 if (m_pFocus == pFocus) {
174 return TRUE; 173 return TRUE;
175 } 174 }
176 IFWL_Widget* pPrev = m_pFocus; 175 IFWL_Widget* pPrev = m_pFocus;
177 m_pFocus = pFocus; 176 m_pFocus = pFocus;
178 if (pPrev) { 177 if (pPrev) {
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { 966 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) {
968 m_pToolTipImp->Hide(); 967 m_pToolTipImp->Hide();
969 pCurTarget = NULL; 968 pCurTarget = NULL;
970 return TRUE; 969 return TRUE;
971 } 970 }
972 return FALSE; 971 return FALSE;
973 } 972 }
974 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { 973 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
975 return pCurTarget; 974 return pCurTarget;
976 } 975 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698