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

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
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/fwl_sdadapterimp.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/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* pApp = m_pForm->GetOwnerApp();
67 if (!pThread) 65 if (!pApp)
68 return; 66 return;
69 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); 67
68 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
70 if (!pDriver) 69 if (!pDriver)
71 return; 70 return;
71
72 pDriver->SendEvent(&ev); 72 pDriver->SendEvent(&ev);
73 } 73 }
74 CFWL_NoteDriver::CFWL_NoteDriver() 74 CFWL_NoteDriver::CFWL_NoteDriver()
75 : m_sendEventCalled(0), 75 : m_sendEventCalled(0),
76 m_pHover(nullptr), 76 m_pHover(nullptr),
77 m_pFocus(nullptr), 77 m_pFocus(nullptr),
78 m_pGrab(nullptr) { 78 m_pGrab(nullptr) {
79 m_pNoteLoop = new CFWL_NoteLoop; 79 m_pNoteLoop = new CFWL_NoteLoop;
80 PushNoteLoop(m_pNoteLoop); 80 PushNoteLoop(m_pNoteLoop);
81 } 81 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 CFWL_EventTarget* value = NULL; 147 CFWL_EventTarget* value = NULL;
148 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { 148 if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) {
149 value->FlagInvalid(); 149 value->FlagInvalid();
150 } 150 }
151 return FWL_ERR_Succeeded; 151 return FWL_ERR_Succeeded;
152 } 152 }
153 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { 153 void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
154 ClearInvalidEventTargets(bRemoveAll); 154 ClearInvalidEventTargets(bRemoveAll);
155 } 155 }
156 IFWL_Thread* CFWL_NoteDriver::GetOwnerThread() const { 156 IFWL_App* CFWL_NoteDriver::GetOwnerApp() const {
157 return FWL_GetApp(); 157 return FWL_GetApp();
158 } 158 }
159 FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) { 159 FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
160 m_noteLoopQueue.Add(pNoteLoop); 160 m_noteLoopQueue.Add(pNoteLoop);
161 return FWL_ERR_Succeeded; 161 return FWL_ERR_Succeeded;
162 } 162 }
163 IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { 163 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
164 int32_t pos = m_noteLoopQueue.GetSize(); 164 int32_t pos = m_noteLoopQueue.GetSize();
165 if (pos <= 0) 165 if (pos <= 0)
166 return NULL; 166 return nullptr;
167 IFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); 167
168 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1);
168 m_noteLoopQueue.RemoveAt(pos - 1); 169 m_noteLoopQueue.RemoveAt(pos - 1);
169 return p; 170 return p;
170 } 171 }
171 FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { 172 FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
172 if (m_pFocus == pFocus) { 173 if (m_pFocus == pFocus) {
173 return TRUE; 174 return TRUE;
174 } 175 }
175 IFWL_Widget* pPrev = m_pFocus; 176 IFWL_Widget* pPrev = m_pFocus;
176 m_pFocus = pFocus; 177 m_pFocus = pFocus;
177 if (pPrev) { 178 if (pPrev) {
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { 968 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) {
968 m_pToolTipImp->Hide(); 969 m_pToolTipImp->Hide();
969 pCurTarget = NULL; 970 pCurTarget = NULL;
970 return TRUE; 971 return TRUE;
971 } 972 }
972 return FALSE; 973 return FALSE;
973 } 974 }
974 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { 975 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
975 return pCurTarget; 976 return pCurTarget;
976 } 977 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_noteimp.h ('k') | xfa/fwl/core/fwl_sdadapterimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698