| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 IFWL_Form::IFWL_Form() {} | 42 IFWL_Form::IFWL_Form() {} |
| 43 FWL_FORMSIZE IFWL_Form::GetFormSize() { | 43 FWL_FORMSIZE IFWL_Form::GetFormSize() { |
| 44 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); | 44 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); |
| 45 } | 45 } |
| 46 FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { | 46 FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 47 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); | 47 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); |
| 48 } | 48 } |
| 49 IFWL_Widget* IFWL_Form::DoModal() { | 49 IFWL_Widget* IFWL_Form::DoModal() { |
| 50 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); | 50 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); |
| 51 } | 51 } |
| 52 IFWL_Widget* IFWL_Form::DoModal(FX_DWORD& dwCommandID) { | 52 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { |
| 53 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); | 53 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); |
| 54 } | 54 } |
| 55 FWL_ERR IFWL_Form::EndDoModal() { | 55 FWL_ERR IFWL_Form::EndDoModal() { |
| 56 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); | 56 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); |
| 57 } | 57 } |
| 58 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { | 58 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { |
| 59 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); | 59 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); |
| 60 } | 60 } |
| 61 | 61 |
| 62 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 62 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 89 m_rtIcon.Reset(); | 89 m_rtIcon.Reset(); |
| 90 } | 90 } |
| 91 CFWL_FormImp::~CFWL_FormImp() { | 91 CFWL_FormImp::~CFWL_FormImp() { |
| 92 RemoveSysButtons(); | 92 RemoveSysButtons(); |
| 93 delete m_pNoteLoop; | 93 delete m_pNoteLoop; |
| 94 } | 94 } |
| 95 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 95 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { |
| 96 wsClass = FWL_CLASS_Form; | 96 wsClass = FWL_CLASS_Form; |
| 97 return FWL_ERR_Succeeded; | 97 return FWL_ERR_Succeeded; |
| 98 } | 98 } |
| 99 FX_DWORD CFWL_FormImp::GetClassID() const { | 99 uint32_t CFWL_FormImp::GetClassID() const { |
| 100 return FWL_CLASSHASH_Form; | 100 return FWL_CLASSHASH_Form; |
| 101 } | 101 } |
| 102 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { | 102 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { |
| 103 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) { | 103 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) { |
| 104 return TRUE; | 104 return TRUE; |
| 105 } | 105 } |
| 106 return CFWL_PanelImp::IsInstance(wsClass); | 106 return CFWL_PanelImp::IsInstance(wsClass); |
| 107 } | 107 } |
| 108 FWL_ERR CFWL_FormImp::Initialize() { | 108 FWL_ERR CFWL_FormImp::Initialize() { |
| 109 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 109 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 #else | 187 #else |
| 188 SetThemeData(); | 188 SetThemeData(); |
| 189 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { | 189 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { |
| 190 UpdateIcon(); | 190 UpdateIcon(); |
| 191 } | 191 } |
| 192 #endif | 192 #endif |
| 193 UpdateCaption(); | 193 UpdateCaption(); |
| 194 Layout(); | 194 Layout(); |
| 195 return FWL_ERR_Succeeded; | 195 return FWL_ERR_Succeeded; |
| 196 } | 196 } |
| 197 FX_DWORD CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 197 uint32_t CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 198 (void)GetAvailableTheme(); | 198 (void)GetAvailableTheme(); |
| 199 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { | 199 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { |
| 200 return FWL_WGTHITTEST_CloseBox; | 200 return FWL_WGTHITTEST_CloseBox; |
| 201 } | 201 } |
| 202 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { | 202 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { |
| 203 return FWL_WGTHITTEST_MaxBox; | 203 return FWL_WGTHITTEST_MaxBox; |
| 204 } | 204 } |
| 205 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { | 205 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { |
| 206 return FWL_WGTHITTEST_MinBox; | 206 return FWL_WGTHITTEST_MinBox; |
| 207 } | 207 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(FX_DWORD& 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_NoteThread* pThread = GetOwnerThread(); |
| 420 if (!pThread) | 420 if (!pThread) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 451 void CFWL_FormImp::SetSubFocus(CFWL_WidgetImp* pWidget) { | 451 void CFWL_FormImp::SetSubFocus(CFWL_WidgetImp* pWidget) { |
| 452 m_pSubFocus = pWidget; | 452 m_pSubFocus = pWidget; |
| 453 } | 453 } |
| 454 CFX_MapAccelerators& CFWL_FormImp::GetAccelerator() { | 454 CFX_MapAccelerators& CFWL_FormImp::GetAccelerator() { |
| 455 return m_mapAccelerators; | 455 return m_mapAccelerators; |
| 456 } | 456 } |
| 457 void CFWL_FormImp::SetAccelerator(CFX_MapAccelerators* pAccelerators) { | 457 void CFWL_FormImp::SetAccelerator(CFX_MapAccelerators* pAccelerators) { |
| 458 if (!pAccelerators) | 458 if (!pAccelerators) |
| 459 return; | 459 return; |
| 460 m_mapAccelerators.RemoveAll(); | 460 m_mapAccelerators.RemoveAll(); |
| 461 FX_DWORD vrKey, rValue; | 461 uint32_t vrKey, rValue; |
| 462 FX_POSITION pos = pAccelerators->GetStartPosition(); | 462 FX_POSITION pos = pAccelerators->GetStartPosition(); |
| 463 while (pos) { | 463 while (pos) { |
| 464 pAccelerators->GetNextAssoc(pos, vrKey, rValue); | 464 pAccelerators->GetNextAssoc(pos, vrKey, rValue); |
| 465 m_mapAccelerators.SetAt(vrKey, rValue); | 465 m_mapAccelerators.SetAt(vrKey, rValue); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) { | 468 void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) { |
| 469 IFWL_App* pApp = FWL_GetApp(); | 469 IFWL_App* pApp = FWL_GetApp(); |
| 470 if (!pApp) | 470 if (!pApp) |
| 471 return; | 471 return; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 return m_pMaxBox; | 519 return m_pMaxBox; |
| 520 } | 520 } |
| 521 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { | 521 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { |
| 522 return m_pMinBox; | 522 return m_pMinBox; |
| 523 } | 523 } |
| 524 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { | 524 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { |
| 525 return m_pCaptionBox; | 525 return m_pCaptionBox; |
| 526 } | 526 } |
| 527 return NULL; | 527 return NULL; |
| 528 } | 528 } |
| 529 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(FX_DWORD dwState) { | 529 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { |
| 530 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { | 530 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { |
| 531 return m_pCloseBox; | 531 return m_pCloseBox; |
| 532 } | 532 } |
| 533 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { | 533 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { |
| 534 return m_pMaxBox; | 534 return m_pMaxBox; |
| 535 } | 535 } |
| 536 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { | 536 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { |
| 537 return m_pMinBox; | 537 return m_pMinBox; |
| 538 } | 538 } |
| 539 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { | 539 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 564 } | 564 } |
| 565 if (m_pMaxBox) { | 565 if (m_pMaxBox) { |
| 566 arrBtn.Add(m_pMaxBox); | 566 arrBtn.Add(m_pMaxBox); |
| 567 } | 567 } |
| 568 if (m_pCloseBox) { | 568 if (m_pCloseBox) { |
| 569 arrBtn.Add(m_pCloseBox); | 569 arrBtn.Add(m_pCloseBox); |
| 570 } | 570 } |
| 571 return arrBtn.Find(pBtn); | 571 return arrBtn.Find(pBtn); |
| 572 } | 572 } |
| 573 FX_FLOAT CFWL_FormImp::GetCaptionHeight() { | 573 FX_FLOAT CFWL_FormImp::GetCaptionHeight() { |
| 574 FX_DWORD dwCapacity = 0; | 574 uint32_t dwCapacity = 0; |
| 575 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { | 575 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { |
| 576 dwCapacity = FWL_WGTCAPACITY_FRM_CYCaption; | 576 dwCapacity = FWL_WGTCAPACITY_FRM_CYCaption; |
| 577 } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { | 577 } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { |
| 578 dwCapacity = FWL_WGTCAPACITY_FRM_CYNarrowCaption; | 578 dwCapacity = FWL_WGTCAPACITY_FRM_CYNarrowCaption; |
| 579 } | 579 } |
| 580 if (dwCapacity > 0) { | 580 if (dwCapacity > 0) { |
| 581 FX_FLOAT* pfCapHeight = | 581 FX_FLOAT* pfCapHeight = |
| 582 static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); | 582 static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); |
| 583 return pfCapHeight ? *pfCapHeight : 0; | 583 return pfCapHeight ? *pfCapHeight : 0; |
| 584 } | 584 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 fHeight = fLimitMax; | 872 fHeight = fLimitMax; |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 } | 875 } |
| 876 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) | 876 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) |
| 877 : m_pOwner(pOwner) {} | 877 : m_pOwner(pOwner) {} |
| 878 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 878 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 879 #ifdef FWL_UseMacSystemBorder | 879 #ifdef FWL_UseMacSystemBorder |
| 880 if (!pMessage) | 880 if (!pMessage) |
| 881 return 0; | 881 return 0; |
| 882 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 882 uint32_t dwMsgCode = pMessage->GetClassID(); |
| 883 switch (dwMsgCode) { | 883 switch (dwMsgCode) { |
| 884 case FWL_MSGHASH_Activate: { | 884 case FWL_MSGHASH_Activate: { |
| 885 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 885 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 886 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 886 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 887 break; | 887 break; |
| 888 } | 888 } |
| 889 case FWL_MSGHASH_Deactivate: { | 889 case FWL_MSGHASH_Deactivate: { |
| 890 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 890 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 891 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 891 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 892 break; | 892 break; |
| 893 } | 893 } |
| 894 } | 894 } |
| 895 return FWL_ERR_Succeeded; | 895 return FWL_ERR_Succeeded; |
| 896 #else | 896 #else |
| 897 if (!pMessage) | 897 if (!pMessage) |
| 898 return 0; | 898 return 0; |
| 899 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 899 uint32_t dwMsgCode = pMessage->GetClassID(); |
| 900 int32_t iRet = 1; | 900 int32_t iRet = 1; |
| 901 switch (dwMsgCode) { | 901 switch (dwMsgCode) { |
| 902 case FWL_MSGHASH_Activate: { | 902 case FWL_MSGHASH_Activate: { |
| 903 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 903 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 904 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); | 904 IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread(); |
| 905 CFWL_NoteDriver* pDriver = | 905 CFWL_NoteDriver* pDriver = |
| 906 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 906 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 907 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 907 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 908 IFWL_Widget* pSubFocus = | 908 IFWL_Widget* pSubFocus = |
| 909 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; | 909 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1170 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1171 m_pOwner->DispatchEvent(&eClose); | 1171 m_pOwner->DispatchEvent(&eClose); |
| 1172 } | 1172 } |
| 1173 FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, | 1173 FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, |
| 1174 CFX_MapAccelerators* pMapAccel) { | 1174 CFX_MapAccelerators* pMapAccel) { |
| 1175 CFWL_FormImp* pImp = static_cast<CFWL_FormImp*>(pFrom->GetImpl()); | 1175 CFWL_FormImp* pImp = static_cast<CFWL_FormImp*>(pFrom->GetImpl()); |
| 1176 if (!pImp) | 1176 if (!pImp) |
| 1177 return FWL_ERR_Indefinite; | 1177 return FWL_ERR_Indefinite; |
| 1178 return FWL_ERR_Succeeded; | 1178 return FWL_ERR_Succeeded; |
| 1179 } | 1179 } |
| OLD | NEW |