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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 return FWL_ERR_Succeeded; | 381 return FWL_ERR_Succeeded; |
382 } | 382 } |
383 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 383 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
384 return m_eFormSize; | 384 return m_eFormSize; |
385 } | 385 } |
386 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 386 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
387 m_eFormSize = eFormSize; | 387 m_eFormSize = eFormSize; |
388 return FWL_ERR_Succeeded; | 388 return FWL_ERR_Succeeded; |
389 } | 389 } |
390 IFWL_Widget* CFWL_FormImp::DoModal() { | 390 IFWL_Widget* CFWL_FormImp::DoModal() { |
391 IFWL_NoteThread* pThread = GetOwnerThread(); | 391 IFWL_Thread* pThread = GetOwnerThread(); |
392 if (!pThread) | 392 if (!pThread) |
393 return NULL; | 393 return NULL; |
394 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); | 394 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); |
395 if (!pDriver) | 395 if (!pDriver) |
396 return NULL; | 396 return NULL; |
397 m_pNoteLoop = new CFWL_NoteLoop(this); | 397 m_pNoteLoop = new CFWL_NoteLoop(this); |
398 pDriver->PushNoteLoop(m_pNoteLoop); | 398 pDriver->PushNoteLoop(m_pNoteLoop); |
399 m_bDoModalFlag = TRUE; | 399 m_bDoModalFlag = TRUE; |
400 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 400 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
401 pDriver->Run(); | 401 pDriver->Run(); |
402 #if (_FX_OS_ == _FX_MACOSX_) | 402 #if (_FX_OS_ == _FX_MACOSX_) |
403 #else | 403 #else |
404 pDriver->PopNoteLoop(); | 404 pDriver->PopNoteLoop(); |
405 #endif | 405 #endif |
406 delete m_pNoteLoop; | 406 delete m_pNoteLoop; |
407 m_pNoteLoop = NULL; | 407 m_pNoteLoop = NULL; |
408 return NULL; | 408 return NULL; |
409 } | 409 } |
410 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 410 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
411 return DoModal(); | 411 return DoModal(); |
412 } | 412 } |
413 FWL_ERR CFWL_FormImp::EndDoModal() { | 413 FWL_ERR CFWL_FormImp::EndDoModal() { |
414 if (!m_pNoteLoop) | 414 if (!m_pNoteLoop) |
415 return FWL_ERR_Indefinite; | 415 return FWL_ERR_Indefinite; |
416 m_bDoModalFlag = FALSE; | 416 m_bDoModalFlag = FALSE; |
417 #if (_FX_OS_ == _FX_MACOSX_) | 417 #if (_FX_OS_ == _FX_MACOSX_) |
418 m_pNoteLoop->EndModalLoop(); | 418 m_pNoteLoop->EndModalLoop(); |
419 IFWL_NoteThread* pThread = GetOwnerThread(); | 419 IFWL_Thread* pThread = GetOwnerThread(); |
420 if (!pThread) | 420 if (!pThread) |
421 return FWL_ERR_Indefinite; | 421 return FWL_ERR_Indefinite; |
422 CFWL_NoteDriver* pDriver = | 422 CFWL_NoteDriver* pDriver = |
423 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 423 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
424 if (!pDriver) | 424 if (!pDriver) |
425 return FWL_ERR_Indefinite; | 425 return FWL_ERR_Indefinite; |
426 pDriver->PopNoteLoop(); | 426 pDriver->PopNoteLoop(); |
427 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 427 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
428 return FWL_ERR_Succeeded; | 428 return FWL_ERR_Succeeded; |
429 #else | 429 #else |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 742 } |
743 if (m_bCustomizeLayout) { | 743 if (m_bCustomizeLayout) { |
744 CFWL_ThemeText parma; | 744 CFWL_ThemeText parma; |
745 parma.m_pWidget = m_pInterface; | 745 parma.m_pWidget = m_pInterface; |
746 parma.m_iPart = FWL_PART_FRM_HeadText; | 746 parma.m_iPart = FWL_PART_FRM_HeadText; |
747 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); | 747 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); |
748 pTheme->GetPartRect(&parma, m_rtCaptionText); | 748 pTheme->GetPartRect(&parma, m_rtCaptionText); |
749 } | 749 } |
750 } | 750 } |
751 void CFWL_FormImp::RegisterForm() { | 751 void CFWL_FormImp::RegisterForm() { |
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->RegisterForm(this); | 759 pDriver->RegisterForm(this); |
760 } | 760 } |
761 void CFWL_FormImp::UnRegisterForm() { | 761 void CFWL_FormImp::UnRegisterForm() { |
762 IFWL_NoteThread* pThread = GetOwnerThread(); | 762 IFWL_Thread* pThread = GetOwnerThread(); |
763 if (!pThread) | 763 if (!pThread) |
764 return; | 764 return; |
765 CFWL_NoteDriver* pDriver = | 765 CFWL_NoteDriver* pDriver = |
766 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 766 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
767 if (!pDriver) | 767 if (!pDriver) |
768 return; | 768 return; |
769 pDriver->UnRegisterForm(this); | 769 pDriver->UnRegisterForm(this); |
770 } | 770 } |
771 FX_BOOL CFWL_FormImp::IsDoModal() { | 771 FX_BOOL CFWL_FormImp::IsDoModal() { |
772 return m_bDoModalFlag; | 772 return m_bDoModalFlag; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 } | 881 } |
882 return FWL_ERR_Succeeded; | 882 return FWL_ERR_Succeeded; |
883 #else | 883 #else |
884 if (!pMessage) | 884 if (!pMessage) |
885 return 0; | 885 return 0; |
886 uint32_t dwMsgCode = pMessage->GetClassID(); | 886 uint32_t dwMsgCode = pMessage->GetClassID(); |
887 int32_t iRet = 1; | 887 int32_t iRet = 1; |
888 switch (dwMsgCode) { | 888 switch (dwMsgCode) { |
889 case FWL_MSGHASH_Activate: { | 889 case FWL_MSGHASH_Activate: { |
890 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 890 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
891 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); | 891 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); |
892 CFWL_NoteDriver* pDriver = | 892 CFWL_NoteDriver* pDriver = |
893 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 893 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
894 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 894 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
895 IFWL_Widget* pSubFocus = | 895 IFWL_Widget* pSubFocus = |
896 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; | 896 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; |
897 if (pSubFocus && pSubFocus != pDriver->GetFocus()) { | 897 if (pSubFocus && pSubFocus != pDriver->GetFocus()) { |
898 pDriver->SetFocus(pSubFocus); | 898 pDriver->SetFocus(pSubFocus); |
899 } | 899 } |
900 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 900 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
901 break; | 901 break; |
902 } | 902 } |
903 case FWL_MSGHASH_Deactivate: { | 903 case FWL_MSGHASH_Deactivate: { |
904 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 904 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
905 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); | 905 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); |
906 CFWL_NoteDriver* pDriver = | 906 CFWL_NoteDriver* pDriver = |
907 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 907 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
908 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 908 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
909 IFWL_Widget* pSubFocus = | 909 IFWL_Widget* pSubFocus = |
910 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; | 910 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; |
911 if (pSubFocus) { | 911 if (pSubFocus) { |
912 if (pSubFocus == pDriver->GetFocus()) { | 912 if (pSubFocus == pDriver->GetFocus()) { |
913 pDriver->SetFocus(NULL); | 913 pDriver->SetFocus(NULL); |
914 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | 914 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { |
915 CFWL_MsgKillFocus ms; | 915 CFWL_MsgKillFocus ms; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 } | 1150 } |
1151 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1151 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
1152 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1152 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
1153 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1153 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
1154 } | 1154 } |
1155 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1155 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
1156 CFWL_EvtClose eClose; | 1156 CFWL_EvtClose eClose; |
1157 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1157 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
1158 m_pOwner->DispatchEvent(&eClose); | 1158 m_pOwner->DispatchEvent(&eClose); |
1159 } | 1159 } |
OLD | NEW |