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_widgetimp.h" | 7 #include "xfa/fwl/core/fwl_widgetimp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" | 23 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
24 #include "xfa/fwl/core/ifwl_app.h" | 24 #include "xfa/fwl/core/ifwl_app.h" |
25 #include "xfa/fwl/core/ifwl_form.h" | 25 #include "xfa/fwl/core/ifwl_form.h" |
26 #include "xfa/fwl/core/ifwl_themeprovider.h" | 26 #include "xfa/fwl/core/ifwl_themeprovider.h" |
27 | 27 |
28 #define FWL_CLASSHASH_Menu 3957949655 | 28 #define FWL_CLASSHASH_Menu 3957949655 |
29 #define FWL_STYLEEXT_MNU_Vert (1L << 0) | 29 #define FWL_STYLEEXT_MNU_Vert (1L << 0) |
30 | 30 |
31 IFWL_Widget::~IFWL_Widget() {} | 31 IFWL_Widget::~IFWL_Widget() {} |
32 | 32 |
33 FWL_ERR IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { | 33 FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { |
34 return m_pImpl->GetClassName(wsClass); | 34 return m_pImpl->GetClassName(wsClass); |
35 } | 35 } |
36 | 36 |
37 uint32_t IFWL_Widget::GetClassID() const { | 37 uint32_t IFWL_Widget::GetClassID() const { |
38 return m_pImpl->GetClassID(); | 38 return m_pImpl->GetClassID(); |
39 } | 39 } |
40 | 40 |
41 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { | 41 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { |
42 return m_pImpl->IsInstance(wsClass); | 42 return m_pImpl->IsInstance(wsClass); |
43 } | 43 } |
44 | 44 |
45 FWL_ERR IFWL_Widget::Initialize() { | 45 FWL_Error IFWL_Widget::Initialize() { |
46 return m_pImpl->Initialize(); | 46 return m_pImpl->Initialize(); |
47 } | 47 } |
48 | 48 |
49 FWL_ERR IFWL_Widget::Finalize() { | 49 FWL_Error IFWL_Widget::Finalize() { |
50 return m_pImpl->Finalize(); | 50 return m_pImpl->Finalize(); |
51 } | 51 } |
52 | 52 |
53 FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 53 FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
54 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 54 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
55 ->GetWidgetRect(rect, bAutoSize); | 55 ->GetWidgetRect(rect, bAutoSize); |
56 } | 56 } |
57 FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { | 57 FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { |
58 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); | 58 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); |
59 } | 59 } |
60 FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { | 60 FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { |
61 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); | 61 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); |
62 } | 62 } |
63 FWL_ERR IFWL_Widget::GetClientRect(CFX_RectF& rect) { | 63 FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) { |
64 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetClientRect(rect); | 64 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetClientRect(rect); |
65 } | 65 } |
66 IFWL_Widget* IFWL_Widget::GetParent() { | 66 IFWL_Widget* IFWL_Widget::GetParent() { |
67 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetParent(); | 67 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetParent(); |
68 } | 68 } |
69 FWL_ERR IFWL_Widget::SetParent(IFWL_Widget* pParent) { | 69 FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) { |
70 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetParent(pParent); | 70 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetParent(pParent); |
71 } | 71 } |
72 IFWL_Widget* IFWL_Widget::GetOwner() { | 72 IFWL_Widget* IFWL_Widget::GetOwner() { |
73 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwner(); | 73 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwner(); |
74 } | 74 } |
75 FWL_ERR IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { | 75 FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { |
76 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetOwner(pOwner); | 76 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetOwner(pOwner); |
77 } | 77 } |
78 IFWL_Widget* IFWL_Widget::GetOuter() { | 78 IFWL_Widget* IFWL_Widget::GetOuter() { |
79 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOuter(); | 79 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOuter(); |
80 } | 80 } |
81 uint32_t IFWL_Widget::GetStyles() { | 81 uint32_t IFWL_Widget::GetStyles() { |
82 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStyles(); | 82 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStyles(); |
83 } | 83 } |
84 FWL_ERR IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, | 84 FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, |
85 uint32_t dwStylesRemoved) { | 85 uint32_t dwStylesRemoved) { |
86 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 86 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
87 ->ModifyStyles(dwStylesAdded, dwStylesRemoved); | 87 ->ModifyStyles(dwStylesAdded, dwStylesRemoved); |
88 } | 88 } |
89 uint32_t IFWL_Widget::GetStylesEx() { | 89 uint32_t IFWL_Widget::GetStylesEx() { |
90 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStylesEx(); | 90 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStylesEx(); |
91 } | 91 } |
92 FWL_ERR IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, | 92 FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, |
93 uint32_t dwStylesExRemoved) { | 93 uint32_t dwStylesExRemoved) { |
94 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 94 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
95 ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 95 ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
96 } | 96 } |
97 uint32_t IFWL_Widget::GetStates() { | 97 uint32_t IFWL_Widget::GetStates() { |
98 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStates(); | 98 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStates(); |
99 } | 99 } |
100 FWL_ERR IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 100 FWL_Error IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
101 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet); | 101 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet); |
102 } | 102 } |
103 FWL_ERR IFWL_Widget::SetPrivateData(void* module_id, | 103 FWL_Error IFWL_Widget::SetPrivateData(void* module_id, |
104 void* pData, | 104 void* pData, |
105 PD_CALLBACK_FREEDATA callback) { | 105 PD_CALLBACK_FREEDATA callback) { |
106 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 106 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
107 ->SetPrivateData(module_id, pData, callback); | 107 ->SetPrivateData(module_id, pData, callback); |
108 } | 108 } |
109 void* IFWL_Widget::GetPrivateData(void* module_id) { | 109 void* IFWL_Widget::GetPrivateData(void* module_id) { |
110 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetPrivateData(module_id); | 110 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetPrivateData(module_id); |
111 } | 111 } |
112 FWL_ERR IFWL_Widget::Update() { | 112 FWL_Error IFWL_Widget::Update() { |
113 return static_cast<CFWL_WidgetImp*>(GetImpl())->Update(); | 113 return static_cast<CFWL_WidgetImp*>(GetImpl())->Update(); |
114 } | 114 } |
115 FWL_ERR IFWL_Widget::LockUpdate() { | 115 FWL_Error IFWL_Widget::LockUpdate() { |
116 return static_cast<CFWL_WidgetImp*>(GetImpl())->LockUpdate(); | 116 return static_cast<CFWL_WidgetImp*>(GetImpl())->LockUpdate(); |
117 } | 117 } |
118 FWL_ERR IFWL_Widget::UnlockUpdate() { | 118 FWL_Error IFWL_Widget::UnlockUpdate() { |
119 return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate(); | 119 return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate(); |
120 } | 120 } |
121 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 121 FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
122 return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy); | 122 return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy); |
123 } | 123 } |
124 FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, | 124 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, |
125 FX_FLOAT& fx, | 125 FX_FLOAT& fx, |
126 FX_FLOAT& fy) { | 126 FX_FLOAT& fy) { |
127 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, fx, fy); | 127 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, fx, fy); |
128 } | 128 } |
129 FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { | 129 FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { |
130 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, rt); | 130 return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, rt); |
131 } | 131 } |
132 FWL_ERR IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { | 132 FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { |
133 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetMatrix(matrix, bGlobal); | 133 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetMatrix(matrix, bGlobal); |
134 } | 134 } |
135 FWL_ERR IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { | 135 FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { |
136 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetMatrix(matrix); | 136 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetMatrix(matrix); |
137 } | 137 } |
138 FWL_ERR IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, | 138 FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, |
139 const CFX_Matrix* pMatrix) { | 139 const CFX_Matrix* pMatrix) { |
140 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 140 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
141 ->DrawWidget(pGraphics, pMatrix); | 141 ->DrawWidget(pGraphics, pMatrix); |
142 } | 142 } |
143 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { | 143 IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { |
144 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetThemeProvider(); | 144 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetThemeProvider(); |
145 } | 145 } |
146 FWL_ERR IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 146 FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
147 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 147 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
148 ->SetThemeProvider(pThemeProvider); | 148 ->SetThemeProvider(pThemeProvider); |
149 } | 149 } |
150 FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { | 150 FWL_Error IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { |
151 return static_cast<CFWL_WidgetImp*>(GetImpl()) | 151 return static_cast<CFWL_WidgetImp*>(GetImpl()) |
152 ->SetDataProvider(pDataProvider); | 152 ->SetDataProvider(pDataProvider); |
153 } | 153 } |
154 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { | 154 IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { |
155 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate); | 155 return static_cast<CFWL_WidgetImp*>(GetImpl())->SetDelegate(pDelegate); |
156 } | 156 } |
157 IFWL_App* IFWL_Widget::GetOwnerApp() const { | 157 IFWL_App* IFWL_Widget::GetOwnerApp() const { |
158 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerApp(); | 158 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwnerApp(); |
159 } | 159 } |
160 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { | 160 CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { |
161 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); | 161 return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); |
162 } | 162 } |
163 | 163 |
164 FWL_ERR CFWL_WidgetImp::Initialize() { | 164 FWL_Error CFWL_WidgetImp::Initialize() { |
165 IFWL_App* pApp = FWL_GetApp(); | 165 IFWL_App* pApp = FWL_GetApp(); |
166 if (!pApp) | 166 if (!pApp) |
167 return FWL_ERR_Indefinite; | 167 return FWL_Error::Indefinite; |
168 IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative(); | 168 IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative(); |
169 if (!pAdapter) | 169 if (!pAdapter) |
170 return FWL_ERR_Indefinite; | 170 return FWL_Error::Indefinite; |
171 IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr(); | 171 IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr(); |
172 if (!pAdapterThread) | 172 if (!pAdapterThread) |
173 return FWL_ERR_Indefinite; | 173 return FWL_Error::Indefinite; |
174 SetOwnerApp( | 174 SetOwnerApp( |
175 static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl())); | 175 static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl())); |
176 IFWL_Widget* pParent = m_pProperties->m_pParent; | 176 IFWL_Widget* pParent = m_pProperties->m_pParent; |
177 m_pWidgetMgr->InsertWidget(pParent, m_pInterface); | 177 m_pWidgetMgr->InsertWidget(pParent, m_pInterface); |
178 if (!IsChild()) { | 178 if (!IsChild()) { |
179 { | 179 { |
180 IFWL_Widget* pOwner = m_pProperties->m_pOwner; | 180 IFWL_Widget* pOwner = m_pProperties->m_pOwner; |
181 if (pOwner) { | 181 if (pOwner) { |
182 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); | 182 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); |
183 } | 183 } |
184 } | 184 } |
185 m_pWidgetMgr->CreateWidget_Native(m_pInterface); | 185 m_pWidgetMgr->CreateWidget_Native(m_pInterface); |
186 } | 186 } |
187 return FWL_ERR_Succeeded; | 187 return FWL_Error::Succeeded; |
188 } | 188 } |
189 | 189 |
190 FWL_ERR CFWL_WidgetImp::Finalize() { | 190 FWL_Error CFWL_WidgetImp::Finalize() { |
191 NotifyDriver(); | 191 NotifyDriver(); |
192 if (!IsChild()) | 192 if (!IsChild()) |
193 m_pWidgetMgr->DestroyWidget_Native(m_pInterface); | 193 m_pWidgetMgr->DestroyWidget_Native(m_pInterface); |
194 | 194 |
195 m_pWidgetMgr->RemoveWidget(m_pInterface); | 195 m_pWidgetMgr->RemoveWidget(m_pInterface); |
196 return FWL_ERR_Succeeded; | 196 return FWL_Error::Succeeded; |
197 } | 197 } |
198 | 198 |
199 FWL_ERR CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { | 199 FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { |
200 wsClass.clear(); | 200 wsClass.clear(); |
201 return FWL_ERR_Succeeded; | 201 return FWL_Error::Succeeded; |
202 } | 202 } |
203 | 203 |
204 uint32_t CFWL_WidgetImp::GetClassID() const { | 204 uint32_t CFWL_WidgetImp::GetClassID() const { |
205 return 0; | 205 return 0; |
206 } | 206 } |
207 | 207 |
208 FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { | 208 FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { |
209 return FALSE; | 209 return FALSE; |
210 } | 210 } |
211 | 211 |
212 FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 212 FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
213 if (bAutoSize) { | 213 if (bAutoSize) { |
214 if (HasEdge()) { | 214 if (HasEdge()) { |
215 FX_FLOAT fEdge = GetEdgeWidth(); | 215 FX_FLOAT fEdge = GetEdgeWidth(); |
216 rect.Inflate(fEdge, fEdge); | 216 rect.Inflate(fEdge, fEdge); |
217 } | 217 } |
218 if (HasBorder()) { | 218 if (HasBorder()) { |
219 FX_FLOAT fBorder = GetBorderSize(); | 219 FX_FLOAT fBorder = GetBorderSize(); |
220 rect.Inflate(fBorder, fBorder); | 220 rect.Inflate(fBorder, fBorder); |
221 } | 221 } |
222 } else { | 222 } else { |
223 rect = m_pProperties->m_rtWidget; | 223 rect = m_pProperties->m_rtWidget; |
224 } | 224 } |
225 return FWL_ERR_Succeeded; | 225 return FWL_Error::Succeeded; |
226 } | 226 } |
227 FWL_ERR CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { | 227 FWL_Error CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { |
228 IFWL_Widget* pForm = | 228 IFWL_Widget* pForm = |
229 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); | 229 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); |
230 if (!pForm) | 230 if (!pForm) |
231 return FWL_ERR_Indefinite; | 231 return FWL_Error::Indefinite; |
232 rect.Set(0, 0, m_pProperties->m_rtWidget.width, | 232 rect.Set(0, 0, m_pProperties->m_rtWidget.width, |
233 m_pProperties->m_rtWidget.height); | 233 m_pProperties->m_rtWidget.height); |
234 if (pForm == m_pInterface) { | 234 if (pForm == m_pInterface) { |
235 return FWL_ERR_Succeeded; | 235 return FWL_Error::Succeeded; |
236 } | 236 } |
237 return TransformTo(pForm, rect); | 237 return TransformTo(pForm, rect); |
238 } | 238 } |
239 FWL_ERR CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { | 239 FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { |
240 CFX_RectF rtOld = m_pProperties->m_rtWidget; | 240 CFX_RectF rtOld = m_pProperties->m_rtWidget; |
241 m_pProperties->m_rtWidget = rect; | 241 m_pProperties->m_rtWidget = rect; |
242 if (IsChild()) { | 242 if (IsChild()) { |
243 if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f || | 243 if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f || |
244 FXSYS_fabs(rtOld.height - rect.height) > 0.5f) { | 244 FXSYS_fabs(rtOld.height - rect.height) > 0.5f) { |
245 CFWL_EvtSizeChanged ev; | 245 CFWL_EvtSizeChanged ev; |
246 ev.m_pSrcTarget = m_pInterface; | 246 ev.m_pSrcTarget = m_pInterface; |
247 ev.m_rtOld = rtOld; | 247 ev.m_rtOld = rtOld; |
248 ev.m_rtNew = rect; | 248 ev.m_rtNew = rect; |
249 IFWL_WidgetDelegate* pDelegate = SetDelegate(NULL); | 249 IFWL_WidgetDelegate* pDelegate = SetDelegate(NULL); |
250 if (pDelegate) { | 250 if (pDelegate) { |
251 pDelegate->OnProcessEvent(&ev); | 251 pDelegate->OnProcessEvent(&ev); |
252 } | 252 } |
253 } | 253 } |
254 return FWL_ERR_Succeeded; | 254 return FWL_Error::Succeeded; |
255 } | 255 } |
256 m_pWidgetMgr->SetWidgetRect_Native(m_pInterface, rect); | 256 m_pWidgetMgr->SetWidgetRect_Native(m_pInterface, rect); |
257 return FWL_ERR_Succeeded; | 257 return FWL_Error::Succeeded; |
258 } | 258 } |
259 FWL_ERR CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { | 259 FWL_Error CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { |
260 GetEdgeRect(rect); | 260 GetEdgeRect(rect); |
261 if (HasEdge()) { | 261 if (HasEdge()) { |
262 FX_FLOAT fEdge = GetEdgeWidth(); | 262 FX_FLOAT fEdge = GetEdgeWidth(); |
263 rect.Deflate(fEdge, fEdge); | 263 rect.Deflate(fEdge, fEdge); |
264 } | 264 } |
265 return FWL_ERR_Succeeded; | 265 return FWL_Error::Succeeded; |
266 } | 266 } |
267 IFWL_Widget* CFWL_WidgetImp::GetParent() { | 267 IFWL_Widget* CFWL_WidgetImp::GetParent() { |
268 return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Parent); | 268 return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Parent); |
269 } | 269 } |
270 FWL_ERR CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { | 270 FWL_Error CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { |
271 m_pProperties->m_pParent = pParent; | 271 m_pProperties->m_pParent = pParent; |
272 m_pWidgetMgr->SetParent(pParent, m_pInterface); | 272 m_pWidgetMgr->SetParent(pParent, m_pInterface); |
273 return FWL_ERR_Succeeded; | 273 return FWL_Error::Succeeded; |
274 } | 274 } |
275 IFWL_Widget* CFWL_WidgetImp::GetOwner() { | 275 IFWL_Widget* CFWL_WidgetImp::GetOwner() { |
276 return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Owner); | 276 return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Owner); |
277 } | 277 } |
278 FWL_ERR CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { | 278 FWL_Error CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { |
279 m_pProperties->m_pOwner = pOwner; | 279 m_pProperties->m_pOwner = pOwner; |
280 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); | 280 m_pWidgetMgr->SetOwner(pOwner, m_pInterface); |
281 return FWL_ERR_Succeeded; | 281 return FWL_Error::Succeeded; |
282 } | 282 } |
283 IFWL_Widget* CFWL_WidgetImp::GetOuter() { | 283 IFWL_Widget* CFWL_WidgetImp::GetOuter() { |
284 return m_pOuter; | 284 return m_pOuter; |
285 } | 285 } |
286 uint32_t CFWL_WidgetImp::GetStyles() { | 286 uint32_t CFWL_WidgetImp::GetStyles() { |
287 return m_pProperties->m_dwStyles; | 287 return m_pProperties->m_dwStyles; |
288 } | 288 } |
289 FWL_ERR CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, | 289 FWL_Error CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, |
290 uint32_t dwStylesRemoved) { | 290 uint32_t dwStylesRemoved) { |
291 m_pProperties->m_dwStyles = | 291 m_pProperties->m_dwStyles = |
292 (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; | 292 (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; |
293 return FWL_ERR_Succeeded; | 293 return FWL_Error::Succeeded; |
294 } | 294 } |
295 uint32_t CFWL_WidgetImp::GetStylesEx() { | 295 uint32_t CFWL_WidgetImp::GetStylesEx() { |
296 return m_pProperties->m_dwStyleExes; | 296 return m_pProperties->m_dwStyleExes; |
297 } | 297 } |
298 FWL_ERR CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, | 298 FWL_Error CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, |
299 uint32_t dwStylesExRemoved) { | 299 uint32_t dwStylesExRemoved) { |
300 m_pProperties->m_dwStyleExes = | 300 m_pProperties->m_dwStyleExes = |
301 (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; | 301 (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; |
302 return FWL_ERR_Succeeded; | 302 return FWL_Error::Succeeded; |
303 } | 303 } |
304 uint32_t CFWL_WidgetImp::GetStates() { | 304 uint32_t CFWL_WidgetImp::GetStates() { |
305 return m_pProperties->m_dwStates; | 305 return m_pProperties->m_dwStates; |
306 } | 306 } |
307 static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr, | 307 static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr, |
308 IFWL_Widget* widget, | 308 IFWL_Widget* widget, |
309 CFWL_NoteDriver* noteDriver) { | 309 CFWL_NoteDriver* noteDriver) { |
310 IFWL_Widget* child = widgetMgr->GetWidget(widget, FWL_WGTRELATION_FirstChild); | 310 IFWL_Widget* child = widgetMgr->GetWidget(widget, FWL_WGTRELATION_FirstChild); |
311 while (child) { | 311 while (child) { |
312 noteDriver->NotifyTargetHide(child); | 312 noteDriver->NotifyTargetHide(child); |
313 NotifyHideChildWidget(widgetMgr, child, noteDriver); | 313 NotifyHideChildWidget(widgetMgr, child, noteDriver); |
314 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); | 314 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); |
315 } | 315 } |
316 } | 316 } |
317 FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 317 FWL_Error CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
318 bSet ? (m_pProperties->m_dwStates |= dwStates) | 318 bSet ? (m_pProperties->m_dwStates |= dwStates) |
319 : (m_pProperties->m_dwStates &= ~dwStates); | 319 : (m_pProperties->m_dwStates &= ~dwStates); |
320 FWL_ERR ret = FWL_ERR_Succeeded; | 320 FWL_Error ret = FWL_Error::Succeeded; |
321 if (dwStates & FWL_WGTSTATE_Invisible) { | 321 if (dwStates & FWL_WGTSTATE_Invisible) { |
322 if (bSet) { | 322 if (bSet) { |
323 ret = m_pWidgetMgr->HideWidget_Native(m_pInterface); | 323 ret = m_pWidgetMgr->HideWidget_Native(m_pInterface); |
324 CFWL_NoteDriver* noteDriver = | 324 CFWL_NoteDriver* noteDriver = |
325 static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver()); | 325 static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver()); |
326 IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); | 326 IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); |
327 noteDriver->NotifyTargetHide(m_pInterface); | 327 noteDriver->NotifyTargetHide(m_pInterface); |
328 IFWL_Widget* child = | 328 IFWL_Widget* child = |
329 widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); | 329 widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); |
330 while (child) { | 330 while (child) { |
331 noteDriver->NotifyTargetHide(child); | 331 noteDriver->NotifyTargetHide(child); |
332 NotifyHideChildWidget(widgetMgr, child, noteDriver); | 332 NotifyHideChildWidget(widgetMgr, child, noteDriver); |
333 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); | 333 child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); |
334 } | 334 } |
335 } else { | 335 } else { |
336 ret = m_pWidgetMgr->ShowWidget_Native(m_pInterface); | 336 ret = m_pWidgetMgr->ShowWidget_Native(m_pInterface); |
337 } | 337 } |
338 } | 338 } |
339 return ret; | 339 return ret; |
340 } | 340 } |
341 FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id, | 341 FWL_Error CFWL_WidgetImp::SetPrivateData(void* module_id, |
342 void* pData, | 342 void* pData, |
343 PD_CALLBACK_FREEDATA callback) { | 343 PD_CALLBACK_FREEDATA callback) { |
344 if (!m_pPrivateData) { | 344 if (!m_pPrivateData) { |
345 m_pPrivateData = new CFX_PrivateData; | 345 m_pPrivateData = new CFX_PrivateData; |
346 } | 346 } |
347 m_pPrivateData->SetPrivateData(module_id, pData, callback); | 347 m_pPrivateData->SetPrivateData(module_id, pData, callback); |
348 return FWL_ERR_Succeeded; | 348 return FWL_Error::Succeeded; |
349 } | 349 } |
350 void* CFWL_WidgetImp::GetPrivateData(void* module_id) { | 350 void* CFWL_WidgetImp::GetPrivateData(void* module_id) { |
351 if (!m_pPrivateData) | 351 if (!m_pPrivateData) |
352 return NULL; | 352 return NULL; |
353 return m_pPrivateData->GetPrivateData(module_id); | 353 return m_pPrivateData->GetPrivateData(module_id); |
354 } | 354 } |
355 FWL_ERR CFWL_WidgetImp::Update() { | 355 FWL_Error CFWL_WidgetImp::Update() { |
356 return FWL_ERR_Succeeded; | 356 return FWL_Error::Succeeded; |
357 } | 357 } |
358 FWL_ERR CFWL_WidgetImp::LockUpdate() { | 358 FWL_Error CFWL_WidgetImp::LockUpdate() { |
359 m_iLock++; | 359 m_iLock++; |
360 return FWL_ERR_Succeeded; | 360 return FWL_Error::Succeeded; |
361 } | 361 } |
362 FWL_ERR CFWL_WidgetImp::UnlockUpdate() { | 362 FWL_Error CFWL_WidgetImp::UnlockUpdate() { |
363 if (IsLocked()) { | 363 if (IsLocked()) { |
364 m_iLock--; | 364 m_iLock--; |
365 } | 365 } |
366 return FWL_ERR_Succeeded; | 366 return FWL_Error::Succeeded; |
367 } | 367 } |
368 FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 368 FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
369 CFX_RectF rtClient; | 369 CFX_RectF rtClient; |
370 GetClientRect(rtClient); | 370 GetClientRect(rtClient); |
371 if (rtClient.Contains(fx, fy)) | 371 if (rtClient.Contains(fx, fy)) |
372 return FWL_WidgetHit::Client; | 372 return FWL_WidgetHit::Client; |
373 if (HasEdge()) { | 373 if (HasEdge()) { |
374 CFX_RectF rtEdge; | 374 CFX_RectF rtEdge; |
375 GetEdgeRect(rtEdge); | 375 GetEdgeRect(rtEdge); |
376 if (rtEdge.Contains(fx, fy)) | 376 if (rtEdge.Contains(fx, fy)) |
377 return FWL_WidgetHit::Edge; | 377 return FWL_WidgetHit::Edge; |
378 } | 378 } |
379 if (HasBorder()) { | 379 if (HasBorder()) { |
380 CFX_RectF rtRelative; | 380 CFX_RectF rtRelative; |
381 GetRelativeRect(rtRelative); | 381 GetRelativeRect(rtRelative); |
382 if (rtRelative.Contains(fx, fy)) | 382 if (rtRelative.Contains(fx, fy)) |
383 return FWL_WidgetHit::Border; | 383 return FWL_WidgetHit::Border; |
384 } | 384 } |
385 return FWL_WidgetHit::Unknown; | 385 return FWL_WidgetHit::Unknown; |
386 } | 386 } |
387 FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, | 387 FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, |
388 FX_FLOAT& fx, | 388 FX_FLOAT& fx, |
389 FX_FLOAT& fy) { | 389 FX_FLOAT& fy) { |
390 if (m_pWidgetMgr->IsFormDisabled()) { | 390 if (m_pWidgetMgr->IsFormDisabled()) { |
391 CFX_SizeF szOffset; | 391 CFX_SizeF szOffset; |
392 if (IsParent(pWidget)) { | 392 if (IsParent(pWidget)) { |
393 szOffset = GetOffsetFromParent(pWidget); | 393 szOffset = GetOffsetFromParent(pWidget); |
394 } else { | 394 } else { |
395 szOffset = pWidget->GetOffsetFromParent(m_pInterface); | 395 szOffset = pWidget->GetOffsetFromParent(m_pInterface); |
396 szOffset.x = -szOffset.x; | 396 szOffset.x = -szOffset.x; |
397 szOffset.y = -szOffset.y; | 397 szOffset.y = -szOffset.y; |
398 } | 398 } |
399 fx += szOffset.x; | 399 fx += szOffset.x; |
400 fy += szOffset.y; | 400 fy += szOffset.y; |
401 return FWL_ERR_Succeeded; | 401 return FWL_Error::Succeeded; |
402 } | 402 } |
403 CFX_RectF r; | 403 CFX_RectF r; |
404 CFX_Matrix m; | 404 CFX_Matrix m; |
405 IFWL_Widget* parent = GetParent(); | 405 IFWL_Widget* parent = GetParent(); |
406 if (parent) { | 406 if (parent) { |
407 GetWidgetRect(r); | 407 GetWidgetRect(r); |
408 fx += r.left; | 408 fx += r.left; |
409 fy += r.top; | 409 fy += r.top; |
410 GetMatrix(m, TRUE); | 410 GetMatrix(m, TRUE); |
411 m.TransformPoint(fx, fy); | 411 m.TransformPoint(fx, fy); |
412 } | 412 } |
413 IFWL_Widget* form1 = | 413 IFWL_Widget* form1 = |
414 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); | 414 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); |
415 if (!form1) | 415 if (!form1) |
416 return FWL_ERR_Indefinite; | 416 return FWL_Error::Indefinite; |
417 if (!pWidget) { | 417 if (!pWidget) { |
418 form1->GetWidgetRect(r); | 418 form1->GetWidgetRect(r); |
419 fx += r.left; | 419 fx += r.left; |
420 fy += r.top; | 420 fy += r.top; |
421 #ifdef FWL_UseMacSystemBorder | 421 #ifdef FWL_UseMacSystemBorder |
422 if (form1->GetStyles() & FWL_WGTSTYLE_Caption) { | 422 if (form1->GetStyles() & FWL_WGTSTYLE_Caption) { |
423 FX_FLOAT l, t, r, b; | 423 FX_FLOAT l, t, r, b; |
424 l = t = r = b = 0; | 424 l = t = r = b = 0; |
425 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); | 425 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); |
426 fy += t; | 426 fy += t; |
427 } | 427 } |
428 #endif | 428 #endif |
429 return FWL_ERR_Succeeded; | 429 return FWL_Error::Succeeded; |
430 } | 430 } |
431 IFWL_Widget* form2 = | 431 IFWL_Widget* form2 = |
432 m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); | 432 m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); |
433 if (!form2) | 433 if (!form2) |
434 return FWL_ERR_Indefinite; | 434 return FWL_Error::Indefinite; |
435 if (form1 != form2) { | 435 if (form1 != form2) { |
436 form1->GetWidgetRect(r); | 436 form1->GetWidgetRect(r); |
437 fx += r.left; | 437 fx += r.left; |
438 fy += r.top; | 438 fy += r.top; |
439 form2->GetWidgetRect(r); | 439 form2->GetWidgetRect(r); |
440 fx -= r.left; | 440 fx -= r.left; |
441 fy -= r.top; | 441 fy -= r.top; |
442 #ifdef FWL_UseMacSystemBorder | 442 #ifdef FWL_UseMacSystemBorder |
443 if ((form1->GetStyles() & FWL_WGTSTYLE_Caption) != | 443 if ((form1->GetStyles() & FWL_WGTSTYLE_Caption) != |
444 (form2->GetStyles() & FWL_WGTSTYLE_Caption)) { | 444 (form2->GetStyles() & FWL_WGTSTYLE_Caption)) { |
445 FX_FLOAT l, t, r, b; | 445 FX_FLOAT l, t, r, b; |
446 l = t = r = b = 0; | 446 l = t = r = b = 0; |
447 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); | 447 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); |
448 (form1->GetStyles() & FWL_WGTSTYLE_Caption) ? (fy += t) : (fy -= t); | 448 (form1->GetStyles() & FWL_WGTSTYLE_Caption) ? (fy += t) : (fy -= t); |
449 } | 449 } |
450 #endif | 450 #endif |
451 } | 451 } |
452 parent = pWidget->GetParent(); | 452 parent = pWidget->GetParent(); |
453 if (parent) { | 453 if (parent) { |
454 pWidget->GetMatrix(m, TRUE); | 454 pWidget->GetMatrix(m, TRUE); |
455 CFX_Matrix m1; | 455 CFX_Matrix m1; |
456 m1.SetIdentity(); | 456 m1.SetIdentity(); |
457 m1.SetReverse(m); | 457 m1.SetReverse(m); |
458 m1.TransformPoint(fx, fy); | 458 m1.TransformPoint(fx, fy); |
459 pWidget->GetWidgetRect(r); | 459 pWidget->GetWidgetRect(r); |
460 fx -= r.left; | 460 fx -= r.left; |
461 fy -= r.top; | 461 fy -= r.top; |
462 } | 462 } |
463 return FWL_ERR_Succeeded; | 463 return FWL_Error::Succeeded; |
464 } | 464 } |
465 FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { | 465 FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { |
466 return TransformTo(pWidget, rt.left, rt.top); | 466 return TransformTo(pWidget, rt.left, rt.top); |
467 } | 467 } |
468 FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { | 468 FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { |
469 if (!m_pProperties) | 469 if (!m_pProperties) |
470 return FWL_ERR_Indefinite; | 470 return FWL_Error::Indefinite; |
471 if (bGlobal) { | 471 if (bGlobal) { |
472 IFWL_Widget* parent = GetParent(); | 472 IFWL_Widget* parent = GetParent(); |
473 CFX_ArrayTemplate<IFWL_Widget*> parents; | 473 CFX_ArrayTemplate<IFWL_Widget*> parents; |
474 while (parent) { | 474 while (parent) { |
475 parents.Add(parent); | 475 parents.Add(parent); |
476 parent = parent->GetParent(); | 476 parent = parent->GetParent(); |
477 } | 477 } |
478 matrix.SetIdentity(); | 478 matrix.SetIdentity(); |
479 CFX_Matrix ctmOnParent; | 479 CFX_Matrix ctmOnParent; |
480 CFX_RectF rect; | 480 CFX_RectF rect; |
481 int32_t count = parents.GetSize(); | 481 int32_t count = parents.GetSize(); |
482 for (int32_t i = count - 2; i >= 0; i--) { | 482 for (int32_t i = count - 2; i >= 0; i--) { |
483 parent = parents.GetAt(i); | 483 parent = parents.GetAt(i); |
484 parent->GetMatrix(ctmOnParent, FALSE); | 484 parent->GetMatrix(ctmOnParent, FALSE); |
485 parent->GetWidgetRect(rect); | 485 parent->GetWidgetRect(rect); |
486 matrix.Concat(ctmOnParent, TRUE); | 486 matrix.Concat(ctmOnParent, TRUE); |
487 matrix.Translate(rect.left, rect.top, TRUE); | 487 matrix.Translate(rect.left, rect.top, TRUE); |
488 } | 488 } |
489 matrix.Concat(m_pProperties->m_ctmOnParent, TRUE); | 489 matrix.Concat(m_pProperties->m_ctmOnParent, TRUE); |
490 parents.RemoveAll(); | 490 parents.RemoveAll(); |
491 } else { | 491 } else { |
492 matrix = m_pProperties->m_ctmOnParent; | 492 matrix = m_pProperties->m_ctmOnParent; |
493 } | 493 } |
494 return FWL_ERR_Succeeded; | 494 return FWL_Error::Succeeded; |
495 } | 495 } |
496 FWL_ERR CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { | 496 FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { |
497 if (!m_pProperties) | 497 if (!m_pProperties) |
498 return FWL_ERR_Indefinite; | 498 return FWL_Error::Indefinite; |
499 IFWL_Widget* parent = GetParent(); | 499 IFWL_Widget* parent = GetParent(); |
500 if (!parent) { | 500 if (!parent) { |
501 return FWL_ERR_Indefinite; | 501 return FWL_Error::Indefinite; |
502 } | 502 } |
503 m_pProperties->m_ctmOnParent = matrix; | 503 m_pProperties->m_ctmOnParent = matrix; |
504 return FWL_ERR_Succeeded; | 504 return FWL_Error::Succeeded; |
505 } | 505 } |
506 FWL_ERR CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, | 506 FWL_Error CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, |
507 const CFX_Matrix* pMatrix) { | 507 const CFX_Matrix* pMatrix) { |
508 return FWL_ERR_Indefinite; | 508 return FWL_Error::Indefinite; |
509 } | 509 } |
510 IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { | 510 IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { |
511 return m_pProperties->m_pThemeProvider; | 511 return m_pProperties->m_pThemeProvider; |
512 } | 512 } |
513 FWL_ERR CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 513 FWL_Error CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
514 m_pProperties->m_pThemeProvider = pThemeProvider; | 514 m_pProperties->m_pThemeProvider = pThemeProvider; |
515 return FWL_ERR_Succeeded; | 515 return FWL_Error::Succeeded; |
516 } | 516 } |
517 FWL_ERR CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { | 517 FWL_Error CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { |
518 m_pProperties->m_pDataProvider = pDataProvider; | 518 m_pProperties->m_pDataProvider = pDataProvider; |
519 return FWL_ERR_Succeeded; | 519 return FWL_Error::Succeeded; |
520 } | 520 } |
521 IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( | 521 IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( |
522 IFWL_WidgetDelegate* pDelegate) { | 522 IFWL_WidgetDelegate* pDelegate) { |
523 if (!m_pCurDelegate) { | 523 if (!m_pCurDelegate) { |
524 m_pCurDelegate = m_pDelegate; | 524 m_pCurDelegate = m_pDelegate; |
525 } | 525 } |
526 if (!pDelegate) { | 526 if (!pDelegate) { |
527 return m_pCurDelegate; | 527 return m_pCurDelegate; |
528 } | 528 } |
529 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; | 529 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; |
530 m_pCurDelegate = pDelegate; | 530 m_pCurDelegate = pDelegate; |
531 return pOldDelegate; | 531 return pOldDelegate; |
532 } | 532 } |
533 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { | 533 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { |
534 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); | 534 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); |
535 } | 535 } |
536 FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { | 536 FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { |
537 m_pOwnerApp = pOwnerApp; | 537 m_pOwnerApp = pOwnerApp; |
538 return FWL_ERR_Succeeded; | 538 return FWL_Error::Succeeded; |
539 } | 539 } |
540 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { | 540 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { |
541 return m_pInterface; | 541 return m_pInterface; |
542 } | 542 } |
543 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { | 543 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { |
544 m_pInterface = pInterface; | 544 m_pInterface = pInterface; |
545 } | 545 } |
546 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, | 546 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, |
547 IFWL_Widget* pOuter) | 547 IFWL_Widget* pOuter) |
548 : m_pProperties(new CFWL_WidgetImpProperties), | 548 : m_pProperties(new CFWL_WidgetImpProperties), |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 while (pUpWidget) { | 990 while (pUpWidget) { |
991 if (pUpWidget == pParent) | 991 if (pUpWidget == pParent) |
992 return TRUE; | 992 return TRUE; |
993 pUpWidget = pUpWidget->GetParent(); | 993 pUpWidget = pUpWidget->GetParent(); |
994 } | 994 } |
995 return FALSE; | 995 return FALSE; |
996 } | 996 } |
997 | 997 |
998 CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} | 998 CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} |
999 | 999 |
1000 int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1000 void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
1001 if (!pMessage->m_pDstTarget) | 1001 if (!pMessage->m_pDstTarget) |
1002 return 0; | 1002 return; |
1003 | 1003 |
1004 CFWL_WidgetImp* pWidget = | 1004 CFWL_WidgetImp* pWidget = |
1005 static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); | 1005 static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); |
1006 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 1006 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
1007 switch (dwMsgCode) { | 1007 switch (dwMsgCode) { |
1008 case CFWL_MessageType::Mouse: { | 1008 case CFWL_MessageType::Mouse: { |
1009 CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 1009 CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
1010 CFWL_EvtMouse evt; | 1010 CFWL_EvtMouse evt; |
1011 evt.m_pSrcTarget = pWidget->m_pInterface; | 1011 evt.m_pSrcTarget = pWidget->m_pInterface; |
1012 evt.m_pDstTarget = pWidget->m_pInterface; | 1012 evt.m_pDstTarget = pWidget->m_pInterface; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 CFWL_EvtKillFocus evt; | 1057 CFWL_EvtKillFocus evt; |
1058 evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget; | 1058 evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget; |
1059 evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget; | 1059 evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget; |
1060 evt.m_pKillFocus = pWidget->m_pInterface; | 1060 evt.m_pKillFocus = pWidget->m_pInterface; |
1061 pWidget->DispatchEvent(&evt); | 1061 pWidget->DispatchEvent(&evt); |
1062 break; | 1062 break; |
1063 } | 1063 } |
1064 default: | 1064 default: |
1065 break; | 1065 break; |
1066 } | 1066 } |
1067 return 1; | |
1068 } | 1067 } |
1069 | 1068 |
1070 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1069 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
1071 return FWL_ERR_Succeeded; | |
1072 } | |
1073 | 1070 |
1074 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1071 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1075 const CFX_Matrix* pMatrix) { | 1072 const CFX_Matrix* pMatrix) { |
1076 CFWL_EvtDraw evt; | 1073 CFWL_EvtDraw evt; |
1077 evt.m_pGraphics = pGraphics; | 1074 evt.m_pGraphics = pGraphics; |
1078 return FWL_ERR_Succeeded; | |
1079 } | 1075 } |
OLD | NEW |