Chromium Code Reviews| 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" |
| 11 #include "xfa/fwl/core/cfwl_message.h" | 11 #include "xfa/fwl/core/cfwl_message.h" |
| 12 #include "xfa/fwl/core/cfwl_themebackground.h" | 12 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 13 #include "xfa/fwl/core/cfwl_themepart.h" | 13 #include "xfa/fwl/core/cfwl_themepart.h" |
| 14 #include "xfa/fwl/core/cfwl_themetext.h" | 14 #include "xfa/fwl/core/cfwl_themetext.h" |
| 15 #include "xfa/fwl/core/fwl_appimp.h" | 15 #include "xfa/fwl/core/fwl_appimp.h" |
| 16 #include "xfa/fwl/core/fwl_noteimp.h" | 16 #include "xfa/fwl/core/fwl_noteimp.h" |
| 17 #include "xfa/fwl/core/fwl_targetimp.h" | |
| 18 #include "xfa/fwl/core/fwl_threadimp.h" | |
| 19 #include "xfa/fwl/core/fwl_widgetimp.h" | 17 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 18 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 21 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | 19 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
| 22 #include "xfa/fwl/core/ifwl_app.h" | 20 #include "xfa/fwl/core/ifwl_app.h" |
| 23 #include "xfa/fwl/core/ifwl_themeprovider.h" | 21 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 24 #include "xfa/fwl/theme/cfwl_widgettp.h" | 22 #include "xfa/fwl/theme/cfwl_widgettp.h" |
| 25 | 23 |
| 26 #define FWL_SYSBTNSIZE 21 | 24 #define FWL_SYSBTNSIZE 21 |
| 27 #define FWL_SYSBTNMARGIN 5 | 25 #define FWL_SYSBTNMARGIN 5 |
| 28 #define FWL_SYSBTNSPAN 2 | 26 #define FWL_SYSBTNSPAN 2 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 return FWL_ERR_Succeeded; | 380 return FWL_ERR_Succeeded; |
| 383 } | 381 } |
| 384 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 382 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
| 385 return m_eFormSize; | 383 return m_eFormSize; |
| 386 } | 384 } |
| 387 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 385 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 388 m_eFormSize = eFormSize; | 386 m_eFormSize = eFormSize; |
| 389 return FWL_ERR_Succeeded; | 387 return FWL_ERR_Succeeded; |
| 390 } | 388 } |
| 391 IFWL_Widget* CFWL_FormImp::DoModal() { | 389 IFWL_Widget* CFWL_FormImp::DoModal() { |
| 392 IFWL_Thread* pThread = GetOwnerThread(); | 390 IFWL_App* pThread = GetOwnerThread(); |
| 393 if (!pThread) | 391 if (!pThread) |
| 394 return NULL; | 392 return NULL; |
| 395 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); | 393 CFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); |
| 396 if (!pDriver) | 394 if (!pDriver) |
| 397 return NULL; | 395 return NULL; |
| 398 m_pNoteLoop = new CFWL_NoteLoop(this); | 396 m_pNoteLoop = new CFWL_NoteLoop(this); |
| 399 pDriver->PushNoteLoop(m_pNoteLoop); | 397 pDriver->PushNoteLoop(m_pNoteLoop); |
| 400 m_bDoModalFlag = TRUE; | 398 m_bDoModalFlag = TRUE; |
| 401 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 399 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
| 402 pDriver->Run(); | 400 pDriver->Run(); |
| 403 #if (_FX_OS_ == _FX_MACOSX_) | 401 #if (_FX_OS_ == _FX_MACOSX_) |
| 404 #else | 402 #else |
| 405 pDriver->PopNoteLoop(); | 403 pDriver->PopNoteLoop(); |
| 406 #endif | 404 #endif |
| 407 delete m_pNoteLoop; | 405 delete m_pNoteLoop; |
| 408 m_pNoteLoop = NULL; | 406 m_pNoteLoop = NULL; |
| 409 return NULL; | 407 return NULL; |
| 410 } | 408 } |
| 411 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 409 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
| 412 return DoModal(); | 410 return DoModal(); |
| 413 } | 411 } |
| 414 FWL_ERR CFWL_FormImp::EndDoModal() { | 412 FWL_ERR CFWL_FormImp::EndDoModal() { |
| 415 if (!m_pNoteLoop) | 413 if (!m_pNoteLoop) |
| 416 return FWL_ERR_Indefinite; | 414 return FWL_ERR_Indefinite; |
| 417 m_bDoModalFlag = FALSE; | 415 m_bDoModalFlag = FALSE; |
| 418 #if (_FX_OS_ == _FX_MACOSX_) | 416 #if (_FX_OS_ == _FX_MACOSX_) |
| 419 m_pNoteLoop->EndModalLoop(); | 417 m_pNoteLoop->EndModalLoop(); |
| 420 IFWL_Thread* pThread = GetOwnerThread(); | 418 IFWL_App* pThread = GetOwnerThread(); |
|
Tom Sepez
2016/04/27 20:23:34
Can we get rid of the word Thread (maybe subsquent
dsinclair
2016/04/27 20:58:55
Done.
| |
| 421 if (!pThread) | 419 if (!pThread) |
| 422 return FWL_ERR_Indefinite; | 420 return FWL_ERR_Indefinite; |
| 423 CFWL_NoteDriver* pDriver = | 421 CFWL_NoteDriver* pDriver = |
| 424 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 422 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 425 if (!pDriver) | 423 if (!pDriver) |
| 426 return FWL_ERR_Indefinite; | 424 return FWL_ERR_Indefinite; |
| 427 pDriver->PopNoteLoop(); | 425 pDriver->PopNoteLoop(); |
| 428 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 426 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 429 return FWL_ERR_Succeeded; | 427 return FWL_ERR_Succeeded; |
| 430 #else | 428 #else |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 } | 736 } |
| 739 if (m_bCustomizeLayout) { | 737 if (m_bCustomizeLayout) { |
| 740 CFWL_ThemeText parma; | 738 CFWL_ThemeText parma; |
| 741 parma.m_pWidget = m_pInterface; | 739 parma.m_pWidget = m_pInterface; |
| 742 parma.m_iPart = CFWL_Part::HeadText; | 740 parma.m_iPart = CFWL_Part::HeadText; |
| 743 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); | 741 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); |
| 744 pTheme->GetPartRect(&parma, m_rtCaptionText); | 742 pTheme->GetPartRect(&parma, m_rtCaptionText); |
| 745 } | 743 } |
| 746 } | 744 } |
| 747 void CFWL_FormImp::RegisterForm() { | 745 void CFWL_FormImp::RegisterForm() { |
| 748 IFWL_Thread* pThread = GetOwnerThread(); | 746 IFWL_App* pThread = GetOwnerThread(); |
| 749 if (!pThread) | 747 if (!pThread) |
| 750 return; | 748 return; |
| 751 CFWL_NoteDriver* pDriver = | 749 CFWL_NoteDriver* pDriver = |
| 752 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 750 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 753 if (!pDriver) | 751 if (!pDriver) |
| 754 return; | 752 return; |
| 755 pDriver->RegisterForm(this); | 753 pDriver->RegisterForm(this); |
| 756 } | 754 } |
| 757 void CFWL_FormImp::UnRegisterForm() { | 755 void CFWL_FormImp::UnRegisterForm() { |
| 758 IFWL_Thread* pThread = GetOwnerThread(); | 756 IFWL_App* pThread = GetOwnerThread(); |
| 759 if (!pThread) | 757 if (!pThread) |
| 760 return; | 758 return; |
| 761 CFWL_NoteDriver* pDriver = | 759 CFWL_NoteDriver* pDriver = |
| 762 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 760 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 763 if (!pDriver) | 761 if (!pDriver) |
| 764 return; | 762 return; |
| 765 pDriver->UnRegisterForm(this); | 763 pDriver->UnRegisterForm(this); |
| 766 } | 764 } |
| 767 FX_BOOL CFWL_FormImp::IsDoModal() { | 765 FX_BOOL CFWL_FormImp::IsDoModal() { |
| 768 return m_bDoModalFlag; | 766 return m_bDoModalFlag; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 return FWL_ERR_Succeeded; | 879 return FWL_ERR_Succeeded; |
| 882 } | 880 } |
| 883 #else | 881 #else |
| 884 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 882 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 885 if (!pMessage) | 883 if (!pMessage) |
| 886 return 0; | 884 return 0; |
| 887 int32_t iRet = 1; | 885 int32_t iRet = 1; |
| 888 switch (pMessage->GetClassID()) { | 886 switch (pMessage->GetClassID()) { |
| 889 case CFWL_MessageType::Activate: { | 887 case CFWL_MessageType::Activate: { |
| 890 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 888 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 891 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); | 889 IFWL_App* pThread = m_pOwner->GetOwnerThread(); |
| 892 CFWL_NoteDriver* pDriver = | 890 CFWL_NoteDriver* pDriver = |
| 893 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 891 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 894 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 892 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 895 IFWL_Widget* pSubFocus = | 893 IFWL_Widget* pSubFocus = |
| 896 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | 894 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; |
| 897 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | 895 if (pSubFocus && pSubFocus != pDriver->GetFocus()) |
| 898 pDriver->SetFocus(pSubFocus); | 896 pDriver->SetFocus(pSubFocus); |
| 899 | 897 |
| 900 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 898 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 901 break; | 899 break; |
| 902 } | 900 } |
| 903 case CFWL_MessageType::Deactivate: { | 901 case CFWL_MessageType::Deactivate: { |
| 904 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 902 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 905 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); | 903 IFWL_App* pThread = m_pOwner->GetOwnerThread(); |
| 906 CFWL_NoteDriver* pDriver = | 904 CFWL_NoteDriver* pDriver = |
| 907 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 905 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 908 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 906 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 909 IFWL_Widget* pSubFocus = | 907 IFWL_Widget* pSubFocus = |
| 910 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | 908 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; |
| 911 if (pSubFocus) { | 909 if (pSubFocus) { |
| 912 if (pSubFocus == pDriver->GetFocus()) { | 910 if (pSubFocus == pDriver->GetFocus()) { |
| 913 pDriver->SetFocus(nullptr); | 911 pDriver->SetFocus(nullptr); |
| 914 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | 912 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { |
| 915 CFWL_MsgKillFocus ms; | 913 CFWL_MsgKillFocus ms; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1152 } | 1150 } |
| 1153 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1151 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
| 1154 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1152 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
| 1155 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1153 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
| 1156 } | 1154 } |
| 1157 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1155 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
| 1158 CFWL_EvtClose eClose; | 1156 CFWL_EvtClose eClose; |
| 1159 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1157 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1160 m_pOwner->DispatchEvent(&eClose); | 1158 m_pOwner->DispatchEvent(&eClose); |
| 1161 } | 1159 } |
| OLD | NEW |