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" | |
18 #include "xfa/fwl/core/fwl_targetimp.h" | 17 #include "xfa/fwl/core/fwl_targetimp.h" |
19 #include "xfa/fwl/core/fwl_threadimp.h" | 18 #include "xfa/fwl/core/fwl_threadimp.h" |
20 #include "xfa/fwl/core/fwl_widgetimp.h" | 19 #include "xfa/fwl/core/fwl_widgetimp.h" |
21 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
22 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | 21 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
23 #include "xfa/fwl/core/ifwl_app.h" | 22 #include "xfa/fwl/core/ifwl_app.h" |
24 #include "xfa/fwl/core/ifwl_themeprovider.h" | 23 #include "xfa/fwl/core/ifwl_themeprovider.h" |
25 | 24 |
26 #define FWL_SYSBTNSIZE 21 | 25 #define FWL_SYSBTNSIZE 21 |
27 #define FWL_SYSBTNMARGIN 5 | 26 #define FWL_SYSBTNMARGIN 5 |
(...skipping 25 matching lines...) Expand all Loading... |
53 } | 52 } |
54 FWL_ERR IFWL_Form::EndDoModal() { | 53 FWL_ERR IFWL_Form::EndDoModal() { |
55 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); | 54 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); |
56 } | 55 } |
57 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { | 56 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { |
58 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); | 57 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); |
59 } | 58 } |
60 | 59 |
61 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 60 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, |
62 IFWL_Widget* pOuter) | 61 IFWL_Widget* pOuter) |
63 : CFWL_PanelImp(properties, pOuter), | 62 : CFWL_WidgetImp(properties, pOuter), |
64 m_pCloseBox(NULL), | 63 m_pCloseBox(nullptr), |
65 m_pMinBox(NULL), | 64 m_pMinBox(nullptr), |
66 m_pMaxBox(NULL), | 65 m_pMaxBox(nullptr), |
67 m_pCaptionBox(NULL), | 66 m_pCaptionBox(nullptr), |
68 m_pNoteLoop(NULL), | 67 m_pNoteLoop(nullptr), |
69 m_pSubFocus(NULL), | 68 m_pSubFocus(nullptr), |
70 m_fCXBorder(0), | 69 m_fCXBorder(0), |
71 m_fCYBorder(0), | 70 m_fCYBorder(0), |
72 m_iCaptureBtn(-1), | 71 m_iCaptureBtn(-1), |
73 m_iSysBox(0), | 72 m_iSysBox(0), |
74 m_eResizeType(FORM_RESIZETYPE_None), | 73 m_eResizeType(FORM_RESIZETYPE_None), |
75 m_bLButtonDown(FALSE), | 74 m_bLButtonDown(FALSE), |
76 m_bMaximized(FALSE), | 75 m_bMaximized(FALSE), |
77 m_bSetMaximize(FALSE), | 76 m_bSetMaximize(FALSE), |
78 m_bCustomizeLayout(FALSE), | 77 m_bCustomizeLayout(FALSE), |
79 m_eFormSize(FWL_FORMSIZE_Manual), | 78 m_eFormSize(FWL_FORMSIZE_Manual), |
80 m_bDoModalFlag(FALSE), | 79 m_bDoModalFlag(FALSE), |
81 m_pBigIcon(NULL), | 80 m_pBigIcon(nullptr), |
82 m_pSmallIcon(NULL), | 81 m_pSmallIcon(nullptr), |
83 m_bMouseIn(FALSE) { | 82 m_bMouseIn(FALSE) { |
84 m_rtRelative.Reset(); | 83 m_rtRelative.Reset(); |
85 m_rtCaption.Reset(); | 84 m_rtCaption.Reset(); |
86 m_rtRestore.Reset(); | 85 m_rtRestore.Reset(); |
87 m_rtCaptionText.Reset(); | 86 m_rtCaptionText.Reset(); |
88 m_rtIcon.Reset(); | 87 m_rtIcon.Reset(); |
89 } | 88 } |
| 89 |
90 CFWL_FormImp::~CFWL_FormImp() { | 90 CFWL_FormImp::~CFWL_FormImp() { |
91 RemoveSysButtons(); | 91 RemoveSysButtons(); |
92 delete m_pNoteLoop; | 92 delete m_pNoteLoop; |
93 } | 93 } |
| 94 |
94 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 95 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { |
95 wsClass = FWL_CLASS_Form; | 96 wsClass = FWL_CLASS_Form; |
96 return FWL_ERR_Succeeded; | 97 return FWL_ERR_Succeeded; |
97 } | 98 } |
| 99 |
98 uint32_t CFWL_FormImp::GetClassID() const { | 100 uint32_t CFWL_FormImp::GetClassID() const { |
99 return FWL_CLASSHASH_Form; | 101 return FWL_CLASSHASH_Form; |
100 } | 102 } |
| 103 |
101 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { | 104 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { |
102 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) { | 105 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
103 return TRUE; | 106 return TRUE; |
104 } | 107 return CFWL_WidgetImp::IsInstance(wsClass); |
105 return CFWL_PanelImp::IsInstance(wsClass); | |
106 } | 108 } |
| 109 |
107 FWL_ERR CFWL_FormImp::Initialize() { | 110 FWL_ERR CFWL_FormImp::Initialize() { |
108 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 111 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
109 return FWL_ERR_Indefinite; | 112 return FWL_ERR_Indefinite; |
110 RegisterForm(); | 113 RegisterForm(); |
111 RegisterEventTarget(); | 114 RegisterEventTarget(); |
112 m_pDelegate = new CFWL_FormImpDelegate(this); | 115 m_pDelegate = new CFWL_FormImpDelegate(this); |
113 return FWL_ERR_Succeeded; | 116 return FWL_ERR_Succeeded; |
114 } | 117 } |
115 FWL_ERR CFWL_FormImp::Finalize() { | 118 FWL_ERR CFWL_FormImp::Finalize() { |
116 delete m_pDelegate; | 119 delete m_pDelegate; |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 } | 1143 } |
1141 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1144 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
1142 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1145 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
1143 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1146 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
1144 } | 1147 } |
1145 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1148 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
1146 CFWL_EvtClose eClose; | 1149 CFWL_EvtClose eClose; |
1147 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1150 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
1148 m_pOwner->DispatchEvent(&eClose); | 1151 m_pOwner->DispatchEvent(&eClose); |
1149 } | 1152 } |
OLD | NEW |