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 uint32_t IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 121 uint32_t 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 uint32_t CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 368 uint32_t 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_WGTHITTEST_Client; | 372 return FWL_WGTHITTEST_Client; |
373 } | 373 } |
374 if (HasEdge()) { | 374 if (HasEdge()) { |
375 CFX_RectF rtEdge; | 375 CFX_RectF rtEdge; |
376 GetEdgeRect(rtEdge); | 376 GetEdgeRect(rtEdge); |
377 if (rtEdge.Contains(fx, fy)) { | 377 if (rtEdge.Contains(fx, fy)) { |
378 return FWL_WGTHITTEST_Edge; | 378 return FWL_WGTHITTEST_Edge; |
379 } | 379 } |
380 } | 380 } |
381 if (HasBorder()) { | 381 if (HasBorder()) { |
382 CFX_RectF rtRelative; | 382 CFX_RectF rtRelative; |
383 GetRelativeRect(rtRelative); | 383 GetRelativeRect(rtRelative); |
384 if (rtRelative.Contains(fx, fy)) { | 384 if (rtRelative.Contains(fx, fy)) { |
385 return FWL_WGTHITTEST_Border; | 385 return FWL_WGTHITTEST_Border; |
386 } | 386 } |
387 } | 387 } |
388 return FWL_WGTHITTEST_Unknown; | 388 return FWL_WGTHITTEST_Unknown; |
389 } | 389 } |
390 FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, | 390 FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, |
391 FX_FLOAT& fx, | 391 FX_FLOAT& fx, |
392 FX_FLOAT& fy) { | 392 FX_FLOAT& fy) { |
393 if (m_pWidgetMgr->IsFormDisabled()) { | 393 if (m_pWidgetMgr->IsFormDisabled()) { |
394 CFX_SizeF szOffset; | 394 CFX_SizeF szOffset; |
395 if (IsParent(pWidget)) { | 395 if (IsParent(pWidget)) { |
396 szOffset = GetOffsetFromParent(pWidget); | 396 szOffset = GetOffsetFromParent(pWidget); |
397 } else { | 397 } else { |
398 szOffset = pWidget->GetOffsetFromParent(m_pInterface); | 398 szOffset = pWidget->GetOffsetFromParent(m_pInterface); |
399 szOffset.x = -szOffset.x; | 399 szOffset.x = -szOffset.x; |
400 szOffset.y = -szOffset.y; | 400 szOffset.y = -szOffset.y; |
401 } | 401 } |
402 fx += szOffset.x; | 402 fx += szOffset.x; |
403 fy += szOffset.y; | 403 fy += szOffset.y; |
404 return FWL_ERR_Succeeded; | 404 return FWL_Error::Succeeded; |
405 } | 405 } |
406 CFX_RectF r; | 406 CFX_RectF r; |
407 CFX_Matrix m; | 407 CFX_Matrix m; |
408 IFWL_Widget* parent = GetParent(); | 408 IFWL_Widget* parent = GetParent(); |
409 if (parent) { | 409 if (parent) { |
410 GetWidgetRect(r); | 410 GetWidgetRect(r); |
411 fx += r.left; | 411 fx += r.left; |
412 fy += r.top; | 412 fy += r.top; |
413 GetMatrix(m, TRUE); | 413 GetMatrix(m, TRUE); |
414 m.TransformPoint(fx, fy); | 414 m.TransformPoint(fx, fy); |
415 } | 415 } |
416 IFWL_Widget* form1 = | 416 IFWL_Widget* form1 = |
417 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); | 417 m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); |
418 if (!form1) | 418 if (!form1) |
419 return FWL_ERR_Indefinite; | 419 return FWL_Error::Indefinite; |
420 if (!pWidget) { | 420 if (!pWidget) { |
421 form1->GetWidgetRect(r); | 421 form1->GetWidgetRect(r); |
422 fx += r.left; | 422 fx += r.left; |
423 fy += r.top; | 423 fy += r.top; |
424 #ifdef FWL_UseMacSystemBorder | 424 #ifdef FWL_UseMacSystemBorder |
425 if (form1->GetStyles() & FWL_WGTSTYLE_Caption) { | 425 if (form1->GetStyles() & FWL_WGTSTYLE_Caption) { |
426 FX_FLOAT l, t, r, b; | 426 FX_FLOAT l, t, r, b; |
427 l = t = r = b = 0; | 427 l = t = r = b = 0; |
428 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); | 428 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); |
429 fy += t; | 429 fy += t; |
430 } | 430 } |
431 #endif | 431 #endif |
432 return FWL_ERR_Succeeded; | 432 return FWL_Error::Succeeded; |
433 } | 433 } |
434 IFWL_Widget* form2 = | 434 IFWL_Widget* form2 = |
435 m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); | 435 m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); |
436 if (!form2) | 436 if (!form2) |
437 return FWL_ERR_Indefinite; | 437 return FWL_Error::Indefinite; |
438 if (form1 != form2) { | 438 if (form1 != form2) { |
439 form1->GetWidgetRect(r); | 439 form1->GetWidgetRect(r); |
440 fx += r.left; | 440 fx += r.left; |
441 fy += r.top; | 441 fy += r.top; |
442 form2->GetWidgetRect(r); | 442 form2->GetWidgetRect(r); |
443 fx -= r.left; | 443 fx -= r.left; |
444 fy -= r.top; | 444 fy -= r.top; |
445 #ifdef FWL_UseMacSystemBorder | 445 #ifdef FWL_UseMacSystemBorder |
446 if ((form1->GetStyles() & FWL_WGTSTYLE_Caption) != | 446 if ((form1->GetStyles() & FWL_WGTSTYLE_Caption) != |
447 (form2->GetStyles() & FWL_WGTSTYLE_Caption)) { | 447 (form2->GetStyles() & FWL_WGTSTYLE_Caption)) { |
448 FX_FLOAT l, t, r, b; | 448 FX_FLOAT l, t, r, b; |
449 l = t = r = b = 0; | 449 l = t = r = b = 0; |
450 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); | 450 FWL_GetAdapterWidgetMgr()->GetSystemBorder(l, t, r, b); |
451 (form1->GetStyles() & FWL_WGTSTYLE_Caption) ? (fy += t) : (fy -= t); | 451 (form1->GetStyles() & FWL_WGTSTYLE_Caption) ? (fy += t) : (fy -= t); |
452 } | 452 } |
453 #endif | 453 #endif |
454 } | 454 } |
455 parent = pWidget->GetParent(); | 455 parent = pWidget->GetParent(); |
456 if (parent) { | 456 if (parent) { |
457 pWidget->GetMatrix(m, TRUE); | 457 pWidget->GetMatrix(m, TRUE); |
458 CFX_Matrix m1; | 458 CFX_Matrix m1; |
459 m1.SetIdentity(); | 459 m1.SetIdentity(); |
460 m1.SetReverse(m); | 460 m1.SetReverse(m); |
461 m1.TransformPoint(fx, fy); | 461 m1.TransformPoint(fx, fy); |
462 pWidget->GetWidgetRect(r); | 462 pWidget->GetWidgetRect(r); |
463 fx -= r.left; | 463 fx -= r.left; |
464 fy -= r.top; | 464 fy -= r.top; |
465 } | 465 } |
466 return FWL_ERR_Succeeded; | 466 return FWL_Error::Succeeded; |
467 } | 467 } |
468 FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { | 468 FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { |
469 return TransformTo(pWidget, rt.left, rt.top); | 469 return TransformTo(pWidget, rt.left, rt.top); |
470 } | 470 } |
471 FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { | 471 FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { |
472 if (!m_pProperties) | 472 if (!m_pProperties) |
473 return FWL_ERR_Indefinite; | 473 return FWL_Error::Indefinite; |
474 if (bGlobal) { | 474 if (bGlobal) { |
475 IFWL_Widget* parent = GetParent(); | 475 IFWL_Widget* parent = GetParent(); |
476 CFX_ArrayTemplate<IFWL_Widget*> parents; | 476 CFX_ArrayTemplate<IFWL_Widget*> parents; |
477 while (parent) { | 477 while (parent) { |
478 parents.Add(parent); | 478 parents.Add(parent); |
479 parent = parent->GetParent(); | 479 parent = parent->GetParent(); |
480 } | 480 } |
481 matrix.SetIdentity(); | 481 matrix.SetIdentity(); |
482 CFX_Matrix ctmOnParent; | 482 CFX_Matrix ctmOnParent; |
483 CFX_RectF rect; | 483 CFX_RectF rect; |
484 int32_t count = parents.GetSize(); | 484 int32_t count = parents.GetSize(); |
485 for (int32_t i = count - 2; i >= 0; i--) { | 485 for (int32_t i = count - 2; i >= 0; i--) { |
486 parent = parents.GetAt(i); | 486 parent = parents.GetAt(i); |
487 parent->GetMatrix(ctmOnParent, FALSE); | 487 parent->GetMatrix(ctmOnParent, FALSE); |
488 parent->GetWidgetRect(rect); | 488 parent->GetWidgetRect(rect); |
489 matrix.Concat(ctmOnParent, TRUE); | 489 matrix.Concat(ctmOnParent, TRUE); |
490 matrix.Translate(rect.left, rect.top, TRUE); | 490 matrix.Translate(rect.left, rect.top, TRUE); |
491 } | 491 } |
492 matrix.Concat(m_pProperties->m_ctmOnParent, TRUE); | 492 matrix.Concat(m_pProperties->m_ctmOnParent, TRUE); |
493 parents.RemoveAll(); | 493 parents.RemoveAll(); |
494 } else { | 494 } else { |
495 matrix = m_pProperties->m_ctmOnParent; | 495 matrix = m_pProperties->m_ctmOnParent; |
496 } | 496 } |
497 return FWL_ERR_Succeeded; | 497 return FWL_Error::Succeeded; |
498 } | 498 } |
499 FWL_ERR CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { | 499 FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { |
500 if (!m_pProperties) | 500 if (!m_pProperties) |
501 return FWL_ERR_Indefinite; | 501 return FWL_Error::Indefinite; |
502 IFWL_Widget* parent = GetParent(); | 502 IFWL_Widget* parent = GetParent(); |
503 if (!parent) { | 503 if (!parent) { |
504 return FWL_ERR_Indefinite; | 504 return FWL_Error::Indefinite; |
505 } | 505 } |
506 m_pProperties->m_ctmOnParent = matrix; | 506 m_pProperties->m_ctmOnParent = matrix; |
507 return FWL_ERR_Succeeded; | 507 return FWL_Error::Succeeded; |
508 } | 508 } |
509 FWL_ERR CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, | 509 FWL_Error CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, |
510 const CFX_Matrix* pMatrix) { | 510 const CFX_Matrix* pMatrix) { |
511 return FWL_ERR_Indefinite; | 511 return FWL_Error::Indefinite; |
512 } | 512 } |
513 IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { | 513 IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { |
514 return m_pProperties->m_pThemeProvider; | 514 return m_pProperties->m_pThemeProvider; |
515 } | 515 } |
516 FWL_ERR CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 516 FWL_Error CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
517 m_pProperties->m_pThemeProvider = pThemeProvider; | 517 m_pProperties->m_pThemeProvider = pThemeProvider; |
518 return FWL_ERR_Succeeded; | 518 return FWL_Error::Succeeded; |
519 } | 519 } |
520 FWL_ERR CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { | 520 FWL_Error CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { |
521 m_pProperties->m_pDataProvider = pDataProvider; | 521 m_pProperties->m_pDataProvider = pDataProvider; |
522 return FWL_ERR_Succeeded; | 522 return FWL_Error::Succeeded; |
523 } | 523 } |
524 IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( | 524 IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( |
525 IFWL_WidgetDelegate* pDelegate) { | 525 IFWL_WidgetDelegate* pDelegate) { |
526 if (!m_pCurDelegate) { | 526 if (!m_pCurDelegate) { |
527 m_pCurDelegate = m_pDelegate; | 527 m_pCurDelegate = m_pDelegate; |
528 } | 528 } |
529 if (!pDelegate) { | 529 if (!pDelegate) { |
530 return m_pCurDelegate; | 530 return m_pCurDelegate; |
531 } | 531 } |
532 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; | 532 IFWL_WidgetDelegate* pOldDelegate = m_pCurDelegate; |
533 m_pCurDelegate = pDelegate; | 533 m_pCurDelegate = pDelegate; |
534 return pOldDelegate; | 534 return pOldDelegate; |
535 } | 535 } |
536 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { | 536 IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { |
537 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); | 537 return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); |
538 } | 538 } |
539 FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { | 539 FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { |
540 m_pOwnerApp = pOwnerApp; | 540 m_pOwnerApp = pOwnerApp; |
541 return FWL_ERR_Succeeded; | 541 return FWL_Error::Succeeded; |
542 } | 542 } |
543 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { | 543 IFWL_Widget* CFWL_WidgetImp::GetInterface() const { |
544 return m_pInterface; | 544 return m_pInterface; |
545 } | 545 } |
546 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { | 546 void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) { |
547 m_pInterface = pInterface; | 547 m_pInterface = pInterface; |
548 } | 548 } |
549 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, | 549 CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, |
550 IFWL_Widget* pOuter) | 550 IFWL_Widget* pOuter) |
551 : m_pProperties(new CFWL_WidgetImpProperties), | 551 : m_pProperties(new CFWL_WidgetImpProperties), |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 evt.m_pKillFocus = pWidget->m_pInterface; | 1063 evt.m_pKillFocus = pWidget->m_pInterface; |
1064 pWidget->DispatchEvent(&evt); | 1064 pWidget->DispatchEvent(&evt); |
1065 break; | 1065 break; |
1066 } | 1066 } |
1067 default: | 1067 default: |
1068 break; | 1068 break; |
1069 } | 1069 } |
1070 return 1; | 1070 return 1; |
1071 } | 1071 } |
1072 | 1072 |
1073 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1073 FWL_Error CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
1074 return FWL_ERR_Succeeded; | 1074 return FWL_Error::Succeeded; |
1075 } | 1075 } |
1076 | 1076 |
1077 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1077 FWL_Error CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1078 const CFX_Matrix* pMatrix) { | 1078 const CFX_Matrix* pMatrix) { |
1079 CFWL_EvtDraw evt; | 1079 CFWL_EvtDraw evt; |
1080 evt.m_pGraphics = pGraphics; | 1080 evt.m_pGraphics = pGraphics; |
1081 return FWL_ERR_Succeeded; | 1081 return FWL_Error::Succeeded; |
1082 } | 1082 } |
OLD | NEW |