| 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_formimp.h" | 7 #include "xfa/fwl/core/fwl_formimp.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 return FWL_ERR_Succeeded; | 377 return FWL_ERR_Succeeded; |
| 378 } | 378 } |
| 379 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 379 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
| 380 return m_eFormSize; | 380 return m_eFormSize; |
| 381 } | 381 } |
| 382 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 382 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 383 m_eFormSize = eFormSize; | 383 m_eFormSize = eFormSize; |
| 384 return FWL_ERR_Succeeded; | 384 return FWL_ERR_Succeeded; |
| 385 } | 385 } |
| 386 IFWL_Widget* CFWL_FormImp::DoModal() { | 386 IFWL_Widget* CFWL_FormImp::DoModal() { |
| 387 IFWL_NoteThread* pThread = GetOwnerThread(); | 387 IFWL_Thread* pThread = GetOwnerThread(); |
| 388 if (!pThread) | 388 if (!pThread) |
| 389 return NULL; | 389 return NULL; |
| 390 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); | 390 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); |
| 391 if (!pDriver) | 391 if (!pDriver) |
| 392 return NULL; | 392 return NULL; |
| 393 m_pNoteLoop = new CFWL_NoteLoop(this); | 393 m_pNoteLoop = new CFWL_NoteLoop(this); |
| 394 pDriver->PushNoteLoop(m_pNoteLoop); | 394 pDriver->PushNoteLoop(m_pNoteLoop); |
| 395 m_bDoModalFlag = TRUE; | 395 m_bDoModalFlag = TRUE; |
| 396 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 396 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
| 397 pDriver->Run(); | 397 pDriver->Run(); |
| 398 #if (_FX_OS_ == _FX_MACOSX_) | 398 #if (_FX_OS_ == _FX_MACOSX_) |
| 399 #else | 399 #else |
| 400 pDriver->PopNoteLoop(); | 400 pDriver->PopNoteLoop(); |
| 401 #endif | 401 #endif |
| 402 delete m_pNoteLoop; | 402 delete m_pNoteLoop; |
| 403 m_pNoteLoop = NULL; | 403 m_pNoteLoop = NULL; |
| 404 return NULL; | 404 return NULL; |
| 405 } | 405 } |
| 406 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 406 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
| 407 return DoModal(); | 407 return DoModal(); |
| 408 } | 408 } |
| 409 FWL_ERR CFWL_FormImp::EndDoModal() { | 409 FWL_ERR CFWL_FormImp::EndDoModal() { |
| 410 if (!m_pNoteLoop) | 410 if (!m_pNoteLoop) |
| 411 return FWL_ERR_Indefinite; | 411 return FWL_ERR_Indefinite; |
| 412 m_bDoModalFlag = FALSE; | 412 m_bDoModalFlag = FALSE; |
| 413 #if (_FX_OS_ == _FX_MACOSX_) | 413 #if (_FX_OS_ == _FX_MACOSX_) |
| 414 m_pNoteLoop->EndModalLoop(); | 414 m_pNoteLoop->EndModalLoop(); |
| 415 IFWL_NoteThread* pThread = GetOwnerThread(); | 415 IFWL_Thread* pThread = GetOwnerThread(); |
| 416 if (!pThread) | 416 if (!pThread) |
| 417 return FWL_ERR_Indefinite; | 417 return FWL_ERR_Indefinite; |
| 418 CFWL_NoteDriver* pDriver = | 418 CFWL_NoteDriver* pDriver = |
| 419 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 419 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 420 if (!pDriver) | 420 if (!pDriver) |
| 421 return FWL_ERR_Indefinite; | 421 return FWL_ERR_Indefinite; |
| 422 pDriver->PopNoteLoop(); | 422 pDriver->PopNoteLoop(); |
| 423 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 423 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 424 return FWL_ERR_Succeeded; | 424 return FWL_ERR_Succeeded; |
| 425 #else | 425 #else |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 } | 732 } |
| 733 if (m_bCustomizeLayout) { | 733 if (m_bCustomizeLayout) { |
| 734 CFWL_ThemeText parma; | 734 CFWL_ThemeText parma; |
| 735 parma.m_pWidget = m_pInterface; | 735 parma.m_pWidget = m_pInterface; |
| 736 parma.m_iPart = FWL_PART_FRM_HeadText; | 736 parma.m_iPart = FWL_PART_FRM_HeadText; |
| 737 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); | 737 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); |
| 738 pTheme->GetPartRect(&parma, m_rtCaptionText); | 738 pTheme->GetPartRect(&parma, m_rtCaptionText); |
| 739 } | 739 } |
| 740 } | 740 } |
| 741 void CFWL_FormImp::RegisterForm() { | 741 void CFWL_FormImp::RegisterForm() { |
| 742 IFWL_NoteThread* pThread = GetOwnerThread(); | 742 IFWL_Thread* pThread = GetOwnerThread(); |
| 743 if (!pThread) | 743 if (!pThread) |
| 744 return; | 744 return; |
| 745 CFWL_NoteDriver* pDriver = | 745 CFWL_NoteDriver* pDriver = |
| 746 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 746 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 747 if (!pDriver) | 747 if (!pDriver) |
| 748 return; | 748 return; |
| 749 pDriver->RegisterForm(this); | 749 pDriver->RegisterForm(this); |
| 750 } | 750 } |
| 751 void CFWL_FormImp::UnRegisterForm() { | 751 void CFWL_FormImp::UnRegisterForm() { |
| 752 IFWL_NoteThread* pThread = GetOwnerThread(); | 752 IFWL_Thread* pThread = GetOwnerThread(); |
| 753 if (!pThread) | 753 if (!pThread) |
| 754 return; | 754 return; |
| 755 CFWL_NoteDriver* pDriver = | 755 CFWL_NoteDriver* pDriver = |
| 756 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 756 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 757 if (!pDriver) | 757 if (!pDriver) |
| 758 return; | 758 return; |
| 759 pDriver->UnRegisterForm(this); | 759 pDriver->UnRegisterForm(this); |
| 760 } | 760 } |
| 761 FX_BOOL CFWL_FormImp::IsDoModal() { | 761 FX_BOOL CFWL_FormImp::IsDoModal() { |
| 762 return m_bDoModalFlag; | 762 return m_bDoModalFlag; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 } | 871 } |
| 872 return FWL_ERR_Succeeded; | 872 return FWL_ERR_Succeeded; |
| 873 #else | 873 #else |
| 874 if (!pMessage) | 874 if (!pMessage) |
| 875 return 0; | 875 return 0; |
| 876 uint32_t dwMsgCode = pMessage->GetClassID(); | 876 uint32_t dwMsgCode = pMessage->GetClassID(); |
| 877 int32_t iRet = 1; | 877 int32_t iRet = 1; |
| 878 switch (dwMsgCode) { | 878 switch (dwMsgCode) { |
| 879 case FWL_MSGHASH_Activate: { | 879 case FWL_MSGHASH_Activate: { |
| 880 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 880 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 881 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); | 881 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); |
| 882 CFWL_NoteDriver* pDriver = | 882 CFWL_NoteDriver* pDriver = |
| 883 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 883 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 884 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 884 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 885 IFWL_Widget* pSubFocus = | 885 IFWL_Widget* pSubFocus = |
| 886 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; | 886 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; |
| 887 if (pSubFocus && pSubFocus != pDriver->GetFocus()) { | 887 if (pSubFocus && pSubFocus != pDriver->GetFocus()) { |
| 888 pDriver->SetFocus(pSubFocus); | 888 pDriver->SetFocus(pSubFocus); |
| 889 } | 889 } |
| 890 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 890 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 891 break; | 891 break; |
| 892 } | 892 } |
| 893 case FWL_MSGHASH_Deactivate: { | 893 case FWL_MSGHASH_Deactivate: { |
| 894 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 894 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 895 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); | 895 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); |
| 896 CFWL_NoteDriver* pDriver = | 896 CFWL_NoteDriver* pDriver = |
| 897 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 897 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 898 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 898 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 899 IFWL_Widget* pSubFocus = | 899 IFWL_Widget* pSubFocus = |
| 900 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; | 900 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; |
| 901 if (pSubFocus) { | 901 if (pSubFocus) { |
| 902 if (pSubFocus == pDriver->GetFocus()) { | 902 if (pSubFocus == pDriver->GetFocus()) { |
| 903 pDriver->SetFocus(NULL); | 903 pDriver->SetFocus(NULL); |
| 904 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | 904 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { |
| 905 CFWL_MsgKillFocus ms; | 905 CFWL_MsgKillFocus ms; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 } | 1140 } |
| 1141 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1141 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
| 1142 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1142 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
| 1143 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1143 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
| 1144 } | 1144 } |
| 1145 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1145 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
| 1146 CFWL_EvtClose eClose; | 1146 CFWL_EvtClose eClose; |
| 1147 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1147 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1148 m_pOwner->DispatchEvent(&eClose); | 1148 m_pOwner->DispatchEvent(&eClose); |
| 1149 } | 1149 } |
| OLD | NEW |