| 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_panelimp.h" | 17 #include "xfa/fwl/core/fwl_panelimp.h" |
| 18 #include "xfa/fwl/core/fwl_targetimp.h" | 18 #include "xfa/fwl/core/fwl_targetimp.h" |
| 19 #include "xfa/fwl/core/fwl_threadimp.h" | 19 #include "xfa/fwl/core/fwl_threadimp.h" |
| 20 #include "xfa/fwl/core/fwl_widgetimp.h" | 20 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 21 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 21 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 22 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | 22 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
| 23 #include "xfa/fwl/core/ifwl_app.h" | 23 #include "xfa/fwl/core/ifwl_app.h" |
| 24 #include "xfa/fwl/core/ifwl_content.h" | |
| 25 #include "xfa/fwl/core/ifwl_themeprovider.h" | 24 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 26 | 25 |
| 27 #define FWL_SYSBTNSIZE 21 | 26 #define FWL_SYSBTNSIZE 21 |
| 28 #define FWL_SYSBTNMARGIN 5 | 27 #define FWL_SYSBTNMARGIN 5 |
| 29 #define FWL_SYSBTNSPAN 2 | 28 #define FWL_SYSBTNSPAN 2 |
| 30 #define FWL_CornerEnlarge 10 | 29 #define FWL_CornerEnlarge 10 |
| 31 | 30 |
| 32 // static | 31 // static |
| 33 IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties, | 32 IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties, |
| 34 CFX_WideString* classname, | 33 CFX_WideString* classname, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 UnRegisterForm(); | 119 UnRegisterForm(); |
| 121 return CFWL_WidgetImp::Finalize(); | 120 return CFWL_WidgetImp::Finalize(); |
| 122 } | 121 } |
| 123 FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 122 FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 124 if (bAutoSize) { | 123 if (bAutoSize) { |
| 125 rect.Reset(); | 124 rect.Reset(); |
| 126 FX_FLOAT fCapHeight = GetCaptionHeight(); | 125 FX_FLOAT fCapHeight = GetCaptionHeight(); |
| 127 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 126 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
| 128 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 127 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
| 129 FX_FLOAT fEdge = GetEdgeWidth(); | 128 FX_FLOAT fEdge = GetEdgeWidth(); |
| 130 if (m_pContent) { | |
| 131 m_pContent->GetWidgetRect(rect, TRUE); | |
| 132 } | |
| 133 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 129 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
| 134 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 130 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
| 135 } else { | 131 } else { |
| 136 rect = m_pProperties->m_rtWidget; | 132 rect = m_pProperties->m_rtWidget; |
| 137 } | 133 } |
| 138 return FWL_ERR_Succeeded; | 134 return FWL_ERR_Succeeded; |
| 139 } | 135 } |
| 140 FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { | 136 FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { |
| 141 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { | 137 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { |
| 142 rect = m_pProperties->m_rtWidget; | 138 rect = m_pProperties->m_rtWidget; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 m_bSetMaximize = TRUE; | 633 m_bSetMaximize = TRUE; |
| 638 pWidgetMgr->SetMaximize_Native(m_pInterface); | 634 pWidgetMgr->SetMaximize_Native(m_pInterface); |
| 639 Repaint(&m_rtRelative); | 635 Repaint(&m_rtRelative); |
| 640 } | 636 } |
| 641 void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} | 637 void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} |
| 642 void CFWL_FormImp::Layout() { | 638 void CFWL_FormImp::Layout() { |
| 643 GetRelativeRect(m_rtRelative); | 639 GetRelativeRect(m_rtRelative); |
| 644 #ifndef FWL_UseMacSystemBorder | 640 #ifndef FWL_UseMacSystemBorder |
| 645 ReSetSysBtn(); | 641 ReSetSysBtn(); |
| 646 #endif | 642 #endif |
| 647 if (m_pContent) { | |
| 648 CFX_RectF rtClient; | |
| 649 GetClientRect(rtClient); | |
| 650 m_pContent->SetWidgetRect(rtClient); | |
| 651 m_pContent->Update(); | |
| 652 } | |
| 653 } | 643 } |
| 654 void CFWL_FormImp::ReSetSysBtn() { | 644 void CFWL_FormImp::ReSetSysBtn() { |
| 655 m_fCXBorder = | 645 m_fCXBorder = |
| 656 *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CXBorder)); | 646 *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CXBorder)); |
| 657 m_fCYBorder = | 647 m_fCYBorder = |
| 658 *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CYBorder)); | 648 *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CYBorder)); |
| 659 RemoveSysButtons(); | 649 RemoveSysButtons(); |
| 660 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 650 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 661 m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface); | 651 m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface); |
| 662 FX_FLOAT fCapHeight = GetCaptionHeight(); | 652 FX_FLOAT fCapHeight = GetCaptionHeight(); |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 } | 1140 } |
| 1151 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1141 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
| 1152 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1142 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
| 1153 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1143 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
| 1154 } | 1144 } |
| 1155 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1145 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
| 1156 CFWL_EvtClose eClose; | 1146 CFWL_EvtClose eClose; |
| 1157 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1147 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1158 m_pOwner->DispatchEvent(&eClose); | 1148 m_pOwner->DispatchEvent(&eClose); |
| 1159 } | 1149 } |
| OLD | NEW |