| OLD | NEW |
| 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_widgetimp.h" | 15 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 16 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 16 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 17 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | |
| 18 #include "xfa/fwl/core/ifwl_app.h" | 17 #include "xfa/fwl/core/ifwl_app.h" |
| 19 #include "xfa/fwl/core/ifwl_tooltiptarget.h" | 18 #include "xfa/fwl/core/ifwl_tooltiptarget.h" |
| 20 | 19 |
| 21 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) | 20 CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) |
| 22 : m_pForm(pForm), m_bContinueModal(TRUE) {} | 21 : m_pForm(pForm), m_bContinueModal(TRUE) {} |
| 23 | 22 |
| 24 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { | 23 FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { |
| 25 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) | 24 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) |
| 26 if (count <= 0) { | 25 if (count <= 0) { |
| 27 #endif | 26 #endif |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 return FWL_ERR_Indefinite; | 38 return FWL_ERR_Indefinite; |
| 40 } | 39 } |
| 41 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { | 40 CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { |
| 42 return m_pForm; | 41 return m_pForm; |
| 43 } | 42 } |
| 44 FX_BOOL CFWL_NoteLoop::ContinueModal() { | 43 FX_BOOL CFWL_NoteLoop::ContinueModal() { |
| 45 return m_bContinueModal; | 44 return m_bContinueModal; |
| 46 } | 45 } |
| 47 FWL_ERR CFWL_NoteLoop::EndModalLoop() { | 46 FWL_ERR CFWL_NoteLoop::EndModalLoop() { |
| 48 m_bContinueModal = FALSE; | 47 m_bContinueModal = FALSE; |
| 49 #if (_FX_OS_ == _FX_MACOSX_) | |
| 50 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | |
| 51 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr(); | |
| 52 adapterWidgetMgr->EndLoop(); | |
| 53 #endif | |
| 54 return FWL_ERR_Succeeded; | 48 return FWL_ERR_Succeeded; |
| 55 } | 49 } |
| 56 | 50 |
| 57 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { | 51 FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { |
| 58 m_pForm = pForm; | 52 m_pForm = pForm; |
| 59 return FWL_ERR_Succeeded; | 53 return FWL_ERR_Succeeded; |
| 60 } | 54 } |
| 61 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { | 55 void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { |
| 62 CFWL_EvtMenuCommand ev; | 56 CFWL_EvtMenuCommand ev; |
| 63 ev.m_iCommand = dwCommand; | 57 ev.m_iCommand = dwCommand; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (pDelegate) { | 200 if (pDelegate) { |
| 207 pDelegate->OnProcessMessage(&ms); | 201 pDelegate->OnProcessMessage(&ms); |
| 208 } | 202 } |
| 209 } | 203 } |
| 210 return TRUE; | 204 return TRUE; |
| 211 } | 205 } |
| 212 FWL_ERR CFWL_NoteDriver::Run() { | 206 FWL_ERR CFWL_NoteDriver::Run() { |
| 213 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 207 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 214 if (!pWidgetMgr) | 208 if (!pWidgetMgr) |
| 215 return FWL_ERR_Indefinite; | 209 return FWL_ERR_Indefinite; |
| 216 #if (_FX_OS_ == _FX_MACOSX_) | 210 |
| 217 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr(); | 211 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
| 218 CFWL_NoteLoop* pTopLoop = GetTopLoop(); | 212 _FX_OS_ == _FX_WIN64_) |
| 219 if (pTopLoop) { | 213 CFWL_NoteLoop* pTopLoop = NULL; |
| 220 CFWL_WidgetImp* formImp = pTopLoop->GetForm(); | 214 for (;;) { |
| 221 if (formImp) { | 215 pTopLoop = GetTopLoop(); |
| 222 IFWL_Widget* pForm = formImp->GetInterface(); | 216 if (!pTopLoop || !pTopLoop->ContinueModal()) |
| 223 adapterWidgetMgr->RunLoop(pForm); | 217 break; |
| 224 } | 218 if (UnqueueMessage(pTopLoop)) |
| 219 continue; |
| 225 } | 220 } |
| 226 #elif(_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) | |
| 227 FX_BOOL bIdle = TRUE; | |
| 228 int32_t iIdleCount = 0; | |
| 229 CFWL_NoteLoop* pTopLoop = NULL; | |
| 230 for (;;) { | |
| 231 pTopLoop = GetTopLoop(); | |
| 232 if (!pTopLoop || !pTopLoop->ContinueModal()) { | |
| 233 break; | |
| 234 } | |
| 235 if (UnqueueMessage(pTopLoop)) { | |
| 236 continue; | |
| 237 } | |
| 238 while (bIdle && !(pWidgetMgr->CheckMessage_Native())) { | |
| 239 if (FWL_ERR_Indefinite == pTopLoop->Idle(iIdleCount++)) { | |
| 240 bIdle = FALSE; | |
| 241 } | |
| 242 } | |
| 243 do { | |
| 244 if (FWL_ERR_Indefinite == pWidgetMgr->DispatchMessage_Native()) { | |
| 245 break; | |
| 246 } | |
| 247 if (pWidgetMgr->IsIdleMessage_Native()) { | |
| 248 bIdle = TRUE; | |
| 249 iIdleCount = 0; | |
| 250 } | |
| 251 } while (pWidgetMgr->CheckMessage_Native()); | |
| 252 } | |
| 253 #elif(_FX_OS_ == _FX_LINUX_DESKTOP_) | |
| 254 CFWL_NoteLoop* pTopLoop = NULL; | |
| 255 for (;;) { | |
| 256 pTopLoop = GetTopLoop(); | |
| 257 if (!pTopLoop || !pTopLoop->ContinueModal()) { | |
| 258 break; | |
| 259 } | |
| 260 if (UnqueueMessage(pTopLoop)) { | |
| 261 continue; | |
| 262 } | |
| 263 if (pWidgetMgr->CheckMessage_Native()) { | |
| 264 pWidgetMgr->DispatchMessage_Native(); | |
| 265 } | |
| 266 } | |
| 267 #endif | 221 #endif |
| 222 |
| 268 return FWL_ERR_Succeeded; | 223 return FWL_ERR_Succeeded; |
| 269 } | 224 } |
| 225 |
| 270 IFWL_Widget* CFWL_NoteDriver::GetFocus() { | 226 IFWL_Widget* CFWL_NoteDriver::GetFocus() { |
| 271 return m_pFocus; | 227 return m_pFocus; |
| 272 } | 228 } |
| 273 IFWL_Widget* CFWL_NoteDriver::GetHover() { | 229 IFWL_Widget* CFWL_NoteDriver::GetHover() { |
| 274 return m_pHover; | 230 return m_pHover; |
| 275 } | 231 } |
| 276 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { | 232 void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { |
| 277 m_pHover = pHover; | 233 m_pHover = pHover; |
| 278 } | 234 } |
| 279 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { | 235 void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { | 904 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { |
| 949 m_pToolTipImp->Hide(); | 905 m_pToolTipImp->Hide(); |
| 950 pCurTarget = NULL; | 906 pCurTarget = NULL; |
| 951 return TRUE; | 907 return TRUE; |
| 952 } | 908 } |
| 953 return FALSE; | 909 return FALSE; |
| 954 } | 910 } |
| 955 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { | 911 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { |
| 956 return pCurTarget; | 912 return pCurTarget; |
| 957 } | 913 } |
| OLD | NEW |