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

Side by Side Diff: xfa/fwl/core/fwl_formimp.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_appimp.cpp ('k') | xfa/fwl/core/fwl_noteimp.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_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
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* pApp = GetOwnerApp();
393 if (!pThread) 391 if (!pApp)
394 return NULL; 392 return nullptr;
395 IFWL_NoteDriver* pDriver = pThread->GetNoteDriver(); 393
394 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
396 if (!pDriver) 395 if (!pDriver)
397 return NULL; 396 return nullptr;
397
398 m_pNoteLoop = new CFWL_NoteLoop(this); 398 m_pNoteLoop = new CFWL_NoteLoop(this);
399 pDriver->PushNoteLoop(m_pNoteLoop); 399 pDriver->PushNoteLoop(m_pNoteLoop);
400 m_bDoModalFlag = TRUE; 400 m_bDoModalFlag = TRUE;
401 SetStates(FWL_WGTSTATE_Invisible, FALSE); 401 SetStates(FWL_WGTSTATE_Invisible, FALSE);
402 pDriver->Run(); 402 pDriver->Run();
403 #if (_FX_OS_ == _FX_MACOSX_) 403 #if (_FX_OS_ == _FX_MACOSX_)
404 #else 404 #else
405 pDriver->PopNoteLoop(); 405 pDriver->PopNoteLoop();
406 #endif 406 #endif
407 delete m_pNoteLoop; 407 delete m_pNoteLoop;
408 m_pNoteLoop = NULL; 408 m_pNoteLoop = NULL;
409 return NULL; 409 return NULL;
410 } 410 }
411 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { 411 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) {
412 return DoModal(); 412 return DoModal();
413 } 413 }
414 FWL_ERR CFWL_FormImp::EndDoModal() { 414 FWL_ERR CFWL_FormImp::EndDoModal() {
415 if (!m_pNoteLoop) 415 if (!m_pNoteLoop)
416 return FWL_ERR_Indefinite; 416 return FWL_ERR_Indefinite;
417 m_bDoModalFlag = FALSE; 417 m_bDoModalFlag = FALSE;
418 #if (_FX_OS_ == _FX_MACOSX_) 418 #if (_FX_OS_ == _FX_MACOSX_)
419 m_pNoteLoop->EndModalLoop(); 419 m_pNoteLoop->EndModalLoop();
420 IFWL_Thread* pThread = GetOwnerThread(); 420 IFWL_App* pApp = GetOwnerApp();
421 if (!pThread) 421 if (!pApp)
422 return FWL_ERR_Indefinite; 422 return FWL_ERR_Indefinite;
423
423 CFWL_NoteDriver* pDriver = 424 CFWL_NoteDriver* pDriver =
424 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 425 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
425 if (!pDriver) 426 if (!pDriver)
426 return FWL_ERR_Indefinite; 427 return FWL_ERR_Indefinite;
428
427 pDriver->PopNoteLoop(); 429 pDriver->PopNoteLoop();
428 SetStates(FWL_WGTSTATE_Invisible, TRUE); 430 SetStates(FWL_WGTSTATE_Invisible, TRUE);
429 return FWL_ERR_Succeeded; 431 return FWL_ERR_Succeeded;
430 #else 432 #else
431 SetStates(FWL_WGTSTATE_Invisible, TRUE); 433 SetStates(FWL_WGTSTATE_Invisible, TRUE);
432 return m_pNoteLoop->EndModalLoop(); 434 return m_pNoteLoop->EndModalLoop();
433 #endif 435 #endif
434 } 436 }
435 FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { 437 FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) {
436 return FWL_ERR_Succeeded; 438 return FWL_ERR_Succeeded;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 740 }
739 if (m_bCustomizeLayout) { 741 if (m_bCustomizeLayout) {
740 CFWL_ThemeText parma; 742 CFWL_ThemeText parma;
741 parma.m_pWidget = m_pInterface; 743 parma.m_pWidget = m_pInterface;
742 parma.m_iPart = CFWL_Part::HeadText; 744 parma.m_iPart = CFWL_Part::HeadText;
743 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText); 745 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, parma.m_wsText);
744 pTheme->GetPartRect(&parma, m_rtCaptionText); 746 pTheme->GetPartRect(&parma, m_rtCaptionText);
745 } 747 }
746 } 748 }
747 void CFWL_FormImp::RegisterForm() { 749 void CFWL_FormImp::RegisterForm() {
748 IFWL_Thread* pThread = GetOwnerThread(); 750 IFWL_App* pApp = GetOwnerApp();
749 if (!pThread) 751 if (!pApp)
750 return; 752 return;
753
751 CFWL_NoteDriver* pDriver = 754 CFWL_NoteDriver* pDriver =
752 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 755 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
753 if (!pDriver) 756 if (!pDriver)
754 return; 757 return;
758
755 pDriver->RegisterForm(this); 759 pDriver->RegisterForm(this);
756 } 760 }
757 void CFWL_FormImp::UnRegisterForm() { 761 void CFWL_FormImp::UnRegisterForm() {
758 IFWL_Thread* pThread = GetOwnerThread(); 762 IFWL_App* pApp = GetOwnerApp();
759 if (!pThread) 763 if (!pApp)
760 return; 764 return;
765
761 CFWL_NoteDriver* pDriver = 766 CFWL_NoteDriver* pDriver =
762 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 767 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
763 if (!pDriver) 768 if (!pDriver)
764 return; 769 return;
770
765 pDriver->UnRegisterForm(this); 771 pDriver->UnRegisterForm(this);
766 } 772 }
767 FX_BOOL CFWL_FormImp::IsDoModal() { 773 FX_BOOL CFWL_FormImp::IsDoModal() {
768 return m_bDoModalFlag; 774 return m_bDoModalFlag;
769 } 775 }
770 void CFWL_FormImp::SetThemeData() { 776 void CFWL_FormImp::SetThemeData() {
771 m_fSmallIconSz = 777 m_fSmallIconSz =
772 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); 778 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon));
773 m_fBigIconSz = 779 m_fBigIconSz =
774 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); 780 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 return FWL_ERR_Succeeded; 887 return FWL_ERR_Succeeded;
882 } 888 }
883 #else 889 #else
884 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 890 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
885 if (!pMessage) 891 if (!pMessage)
886 return 0; 892 return 0;
887 int32_t iRet = 1; 893 int32_t iRet = 1;
888 switch (pMessage->GetClassID()) { 894 switch (pMessage->GetClassID()) {
889 case CFWL_MessageType::Activate: { 895 case CFWL_MessageType::Activate: {
890 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; 896 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
891 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); 897 IFWL_App* pApp = m_pOwner->GetOwnerApp();
892 CFWL_NoteDriver* pDriver = 898 CFWL_NoteDriver* pDriver =
893 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 899 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
894 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); 900 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
895 IFWL_Widget* pSubFocus = 901 IFWL_Widget* pSubFocus =
896 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; 902 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
897 if (pSubFocus && pSubFocus != pDriver->GetFocus()) 903 if (pSubFocus && pSubFocus != pDriver->GetFocus())
898 pDriver->SetFocus(pSubFocus); 904 pDriver->SetFocus(pSubFocus);
899 905
900 m_pOwner->Repaint(&m_pOwner->m_rtRelative); 906 m_pOwner->Repaint(&m_pOwner->m_rtRelative);
901 break; 907 break;
902 } 908 }
903 case CFWL_MessageType::Deactivate: { 909 case CFWL_MessageType::Deactivate: {
904 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; 910 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated;
905 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); 911 IFWL_App* pApp = m_pOwner->GetOwnerApp();
906 CFWL_NoteDriver* pDriver = 912 CFWL_NoteDriver* pDriver =
907 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 913 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
908 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); 914 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
909 IFWL_Widget* pSubFocus = 915 IFWL_Widget* pSubFocus =
910 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; 916 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
911 if (pSubFocus) { 917 if (pSubFocus) {
912 if (pSubFocus == pDriver->GetFocus()) { 918 if (pSubFocus == pDriver->GetFocus()) {
913 pDriver->SetFocus(nullptr); 919 pDriver->SetFocus(nullptr);
914 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { 920 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) {
915 CFWL_MsgKillFocus ms; 921 CFWL_MsgKillFocus ms;
916 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr); 922 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr);
917 if (pDelegate) 923 if (pDelegate)
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1158 }
1153 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { 1159 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) {
1154 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; 1160 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx;
1155 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; 1161 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy;
1156 } 1162 }
1157 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { 1163 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) {
1158 CFWL_EvtClose eClose; 1164 CFWL_EvtClose eClose;
1159 eClose.m_pSrcTarget = m_pOwner->m_pInterface; 1165 eClose.m_pSrcTarget = m_pOwner->m_pInterface;
1160 m_pOwner->DispatchEvent(&eClose); 1166 m_pOwner->DispatchEvent(&eClose);
1161 } 1167 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_appimp.cpp ('k') | xfa/fwl/core/fwl_noteimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698