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/ifwl_form.h" | 7 #include "xfa/fwl/core/ifwl_form.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 m_pCaptionBox(nullptr), | 45 m_pCaptionBox(nullptr), |
46 m_pSubFocus(nullptr), | 46 m_pSubFocus(nullptr), |
47 m_fCXBorder(0), | 47 m_fCXBorder(0), |
48 m_fCYBorder(0), | 48 m_fCYBorder(0), |
49 m_iCaptureBtn(-1), | 49 m_iCaptureBtn(-1), |
50 m_iSysBox(0), | 50 m_iSysBox(0), |
51 m_eResizeType(FORM_RESIZETYPE_None), | 51 m_eResizeType(FORM_RESIZETYPE_None), |
52 m_bLButtonDown(FALSE), | 52 m_bLButtonDown(FALSE), |
53 m_bMaximized(false), | 53 m_bMaximized(false), |
54 m_bSetMaximize(FALSE), | 54 m_bSetMaximize(FALSE), |
55 m_bCustomizeLayout(FALSE), | 55 m_bCustomizeLayout(false), |
56 m_eFormSize(FWL_FORMSIZE_Manual), | 56 m_eFormSize(FWL_FORMSIZE_Manual), |
57 m_bDoModalFlag(FALSE), | 57 m_bDoModalFlag(FALSE), |
58 m_pBigIcon(nullptr), | 58 m_pBigIcon(nullptr), |
59 m_pSmallIcon(nullptr), | 59 m_pSmallIcon(nullptr), |
60 m_bMouseIn(FALSE) { | 60 m_bMouseIn(FALSE) { |
61 m_rtRelative.Reset(); | 61 m_rtRelative.Reset(); |
62 m_rtCaption.Reset(); | 62 m_rtCaption.Reset(); |
63 m_rtRestore.Reset(); | 63 m_rtRestore.Reset(); |
64 m_rtCaptionText.Reset(); | 64 m_rtCaptionText.Reset(); |
65 m_rtIcon.Reset(); | 65 m_rtIcon.Reset(); |
66 } | 66 } |
67 | 67 |
68 IFWL_Form::~IFWL_Form() { | 68 IFWL_Form::~IFWL_Form() { |
69 RemoveSysButtons(); | 69 RemoveSysButtons(); |
70 } | 70 } |
71 | 71 |
72 FWL_Error IFWL_Form::GetClassName(CFX_WideString& wsClass) const { | |
73 wsClass = FWL_CLASS_Form; | |
74 return FWL_Error::Succeeded; | |
75 } | |
76 | |
77 FWL_Type IFWL_Form::GetClassID() const { | 72 FWL_Type IFWL_Form::GetClassID() const { |
78 return FWL_Type::Form; | 73 return FWL_Type::Form; |
79 } | 74 } |
80 | 75 |
81 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { | 76 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { |
82 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) | 77 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
83 return TRUE; | 78 return TRUE; |
84 return IFWL_Widget::IsInstance(wsClass); | 79 return IFWL_Widget::IsInstance(wsClass); |
85 } | 80 } |
86 | 81 |
87 FWL_Error IFWL_Form::Initialize() { | 82 FWL_Error IFWL_Form::Initialize() { |
88 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 83 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
89 return FWL_Error::Indefinite; | 84 return FWL_Error::Indefinite; |
90 RegisterForm(); | 85 RegisterForm(); |
91 RegisterEventTarget(); | 86 RegisterEventTarget(); |
92 m_pDelegate = new CFWL_FormImpDelegate(this); | 87 m_pDelegate = new CFWL_FormImpDelegate(this); |
93 return FWL_Error::Succeeded; | 88 return FWL_Error::Succeeded; |
94 } | 89 } |
95 FWL_Error IFWL_Form::Finalize() { | 90 |
| 91 void IFWL_Form::Finalize() { |
96 delete m_pDelegate; | 92 delete m_pDelegate; |
97 m_pDelegate = nullptr; | 93 m_pDelegate = nullptr; |
98 UnregisterEventTarget(); | 94 UnregisterEventTarget(); |
99 UnRegisterForm(); | 95 UnRegisterForm(); |
100 return IFWL_Widget::Finalize(); | 96 IFWL_Widget::Finalize(); |
101 } | 97 } |
| 98 |
102 FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 99 FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
103 if (bAutoSize) { | 100 if (bAutoSize) { |
104 rect.Reset(); | 101 rect.Reset(); |
105 FX_FLOAT fCapHeight = GetCaptionHeight(); | 102 FX_FLOAT fCapHeight = GetCaptionHeight(); |
106 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 103 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
107 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 104 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
108 FX_FLOAT fEdge = GetEdgeWidth(); | 105 FX_FLOAT fEdge = GetEdgeWidth(); |
109 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 106 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
110 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 107 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
111 } else { | 108 } else { |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 | 1094 |
1098 uint32_t CFWL_SysBtn::GetPartState() const { | 1095 uint32_t CFWL_SysBtn::GetPartState() const { |
1099 if (IsDisabled()) | 1096 if (IsDisabled()) |
1100 return CFWL_PartState_Disabled; | 1097 return CFWL_PartState_Disabled; |
1101 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | 1098 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) |
1102 return CFWL_PartState_Pressed; | 1099 return CFWL_PartState_Pressed; |
1103 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | 1100 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) |
1104 return CFWL_PartState_Hovered; | 1101 return CFWL_PartState_Hovered; |
1105 return CFWL_PartState_Normal; | 1102 return CFWL_PartState_Normal; |
1106 } | 1103 } |
OLD | NEW |