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/cfwl_widgetmgr.h" | 7 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 const int kNeedRepaintHitPiece = 3; | 21 const int kNeedRepaintHitPiece = 3; |
22 | 22 |
23 struct FWL_NEEDREPAINTHITDATA { | 23 struct FWL_NEEDREPAINTHITDATA { |
24 CFX_PointF hitPoint; | 24 CFX_PointF hitPoint; |
25 bool bNotNeedRepaint; | 25 bool bNotNeedRepaint; |
26 bool bNotContainByDirty; | 26 bool bNotContainByDirty; |
27 }; | 27 }; |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 bool FWL_UseOffscreen(IFWL_Widget* pWidget) { | 31 bool FWL_UseOffscreen(CFWL_Widget* pWidget) { |
32 #if (_FX_OS_ == _FX_MACOSX_) | 32 #if (_FX_OS_ == _FX_MACOSX_) |
33 return false; | 33 return false; |
34 #else | 34 #else |
35 return !!(pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen); | 35 return !!(pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen); |
36 #endif | 36 #endif |
37 } | 37 } |
38 | 38 |
39 CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) | 39 CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) |
40 : m_dwCapability(0), m_pAdapter(pAdapterNative->GetWidgetMgr(this)) { | 40 : m_dwCapability(0), m_pAdapter(pAdapterNative->GetWidgetMgr(this)) { |
41 ASSERT(m_pAdapter); | 41 ASSERT(m_pAdapter); |
42 m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>(); | 42 m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>(); |
43 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 43 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
44 m_rtScreen.Reset(); | 44 m_rtScreen.Reset(); |
45 #endif | 45 #endif |
46 } | 46 } |
47 | 47 |
48 CFWL_WidgetMgr::~CFWL_WidgetMgr() {} | 48 CFWL_WidgetMgr::~CFWL_WidgetMgr() {} |
49 | 49 |
50 IFWL_Widget* CFWL_WidgetMgr::GetParentWidget(IFWL_Widget* pWidget) const { | 50 CFWL_Widget* CFWL_WidgetMgr::GetParentWidget(CFWL_Widget* pWidget) const { |
51 Item* pItem = GetWidgetMgrItem(pWidget); | 51 Item* pItem = GetWidgetMgrItem(pWidget); |
52 return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr; | 52 return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr; |
53 } | 53 } |
54 | 54 |
55 IFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(IFWL_Widget* pWidget) const { | 55 CFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(CFWL_Widget* pWidget) const { |
56 Item* pItem = GetWidgetMgrItem(pWidget); | 56 Item* pItem = GetWidgetMgrItem(pWidget); |
57 return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr; | 57 return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr; |
58 } | 58 } |
59 | 59 |
60 IFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(IFWL_Widget* pWidget) const { | 60 CFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(CFWL_Widget* pWidget) const { |
61 Item* pItem = GetWidgetMgrItem(pWidget); | 61 Item* pItem = GetWidgetMgrItem(pWidget); |
62 if (!pItem) | 62 if (!pItem) |
63 return nullptr; | 63 return nullptr; |
64 | 64 |
65 pItem = pItem->pPrevious; | 65 pItem = pItem->pPrevious; |
66 while (pItem && pItem->pPrevious) | 66 while (pItem && pItem->pPrevious) |
67 pItem = pItem->pPrevious; | 67 pItem = pItem->pPrevious; |
68 return pItem ? pItem->pWidget : nullptr; | 68 return pItem ? pItem->pWidget : nullptr; |
69 } | 69 } |
70 | 70 |
71 IFWL_Widget* CFWL_WidgetMgr::GetPriorSiblingWidget(IFWL_Widget* pWidget) const { | 71 CFWL_Widget* CFWL_WidgetMgr::GetPriorSiblingWidget(CFWL_Widget* pWidget) const { |
72 Item* pItem = GetWidgetMgrItem(pWidget); | 72 Item* pItem = GetWidgetMgrItem(pWidget); |
73 return pItem && pItem->pPrevious ? pItem->pPrevious->pWidget : nullptr; | 73 return pItem && pItem->pPrevious ? pItem->pPrevious->pWidget : nullptr; |
74 } | 74 } |
75 | 75 |
76 IFWL_Widget* CFWL_WidgetMgr::GetNextSiblingWidget(IFWL_Widget* pWidget) const { | 76 CFWL_Widget* CFWL_WidgetMgr::GetNextSiblingWidget(CFWL_Widget* pWidget) const { |
77 Item* pItem = GetWidgetMgrItem(pWidget); | 77 Item* pItem = GetWidgetMgrItem(pWidget); |
78 return pItem && pItem->pNext ? pItem->pNext->pWidget : nullptr; | 78 return pItem && pItem->pNext ? pItem->pNext->pWidget : nullptr; |
79 } | 79 } |
80 | 80 |
81 IFWL_Widget* CFWL_WidgetMgr::GetFirstChildWidget(IFWL_Widget* pWidget) const { | 81 CFWL_Widget* CFWL_WidgetMgr::GetFirstChildWidget(CFWL_Widget* pWidget) const { |
82 Item* pItem = GetWidgetMgrItem(pWidget); | 82 Item* pItem = GetWidgetMgrItem(pWidget); |
83 return pItem && pItem->pChild ? pItem->pChild->pWidget : nullptr; | 83 return pItem && pItem->pChild ? pItem->pChild->pWidget : nullptr; |
84 } | 84 } |
85 | 85 |
86 IFWL_Widget* CFWL_WidgetMgr::GetLastChildWidget(IFWL_Widget* pWidget) const { | 86 CFWL_Widget* CFWL_WidgetMgr::GetLastChildWidget(CFWL_Widget* pWidget) const { |
87 Item* pItem = GetWidgetMgrItem(pWidget); | 87 Item* pItem = GetWidgetMgrItem(pWidget); |
88 if (!pItem) | 88 if (!pItem) |
89 return nullptr; | 89 return nullptr; |
90 | 90 |
91 pItem = pItem->pChild; | 91 pItem = pItem->pChild; |
92 while (pItem && pItem->pNext) | 92 while (pItem && pItem->pNext) |
93 pItem = pItem->pNext; | 93 pItem = pItem->pNext; |
94 return pItem ? pItem->pWidget : nullptr; | 94 return pItem ? pItem->pWidget : nullptr; |
95 } | 95 } |
96 | 96 |
97 IFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(IFWL_Widget* pWidget) const { | 97 CFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(CFWL_Widget* pWidget) const { |
98 Item* pItem = GetWidgetMgrItem(pWidget); | 98 Item* pItem = GetWidgetMgrItem(pWidget); |
99 while (pItem) { | 99 while (pItem) { |
100 if (IsAbleNative(pItem->pWidget)) | 100 if (IsAbleNative(pItem->pWidget)) |
101 return pItem->pWidget; | 101 return pItem->pWidget; |
102 pItem = pItem->pParent; | 102 pItem = pItem->pParent; |
103 } | 103 } |
104 return nullptr; | 104 return nullptr; |
105 } | 105 } |
106 | 106 |
107 void CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { | 107 void CFWL_WidgetMgr::SetWidgetIndex(CFWL_Widget* pWidget, int32_t nIndex) { |
108 Item* pItem = GetWidgetMgrItem(pWidget); | 108 Item* pItem = GetWidgetMgrItem(pWidget); |
109 if (!pItem) | 109 if (!pItem) |
110 return; | 110 return; |
111 if (!pItem->pParent) | 111 if (!pItem->pParent) |
112 return; | 112 return; |
113 | 113 |
114 Item* pChild = pItem->pParent->pChild; | 114 Item* pChild = pItem->pParent->pChild; |
115 int32_t i = 0; | 115 int32_t i = 0; |
116 while (pChild) { | 116 while (pChild) { |
117 if (pChild == pItem) { | 117 if (pChild == pItem) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 pItem->pNext = pChild; | 166 pItem->pNext = pChild; |
167 if (pItem->pParent->pChild == pChild) | 167 if (pItem->pParent->pChild == pChild) |
168 pItem->pParent->pChild = pItem; | 168 pItem->pParent->pChild = pItem; |
169 } else { | 169 } else { |
170 pItem->pParent->pChild = pItem; | 170 pItem->pParent->pChild = pItem; |
171 pItem->pPrevious = nullptr; | 171 pItem->pPrevious = nullptr; |
172 pItem->pNext = nullptr; | 172 pItem->pNext = nullptr; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, | 176 void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, |
177 const CFX_RectF* pRect) { | 177 const CFX_RectF* pRect) { |
178 if (!m_pAdapter) | 178 if (!m_pAdapter) |
179 return; | 179 return; |
180 | 180 |
181 IFWL_Widget* pNative = pWidget; | 181 CFWL_Widget* pNative = pWidget; |
182 CFX_RectF rect(*pRect); | 182 CFX_RectF rect(*pRect); |
183 if (IsFormDisabled()) { | 183 if (IsFormDisabled()) { |
184 IFWL_Widget* pOuter = pWidget->GetOuter(); | 184 CFWL_Widget* pOuter = pWidget->GetOuter(); |
185 while (pOuter) { | 185 while (pOuter) { |
186 CFX_RectF rtTemp; | 186 CFX_RectF rtTemp; |
187 pNative->GetWidgetRect(rtTemp); | 187 pNative->GetWidgetRect(rtTemp); |
188 rect.left += rtTemp.left; | 188 rect.left += rtTemp.left; |
189 rect.top += rtTemp.top; | 189 rect.top += rtTemp.top; |
190 pNative = pOuter; | 190 pNative = pOuter; |
191 pOuter = pOuter->GetOuter(); | 191 pOuter = pOuter->GetOuter(); |
192 } | 192 } |
193 } else if (!IsAbleNative(pWidget)) { | 193 } else if (!IsAbleNative(pWidget)) { |
194 pNative = GetSystemFormWidget(pWidget); | 194 pNative = GetSystemFormWidget(pWidget); |
195 if (!pNative) | 195 if (!pNative) |
196 return; | 196 return; |
197 | 197 |
198 pWidget->TransformTo(pNative, rect.left, rect.top); | 198 pWidget->TransformTo(pNative, rect.left, rect.top); |
199 } | 199 } |
200 AddRedrawCounts(pNative); | 200 AddRedrawCounts(pNative); |
201 m_pAdapter->RepaintWidget(pNative, &rect); | 201 m_pAdapter->RepaintWidget(pNative, &rect); |
202 } | 202 } |
203 | 203 |
204 void CFWL_WidgetMgr::InsertWidget(IFWL_Widget* pParent, | 204 void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent, |
205 IFWL_Widget* pChild, | 205 CFWL_Widget* pChild, |
206 int32_t nIndex) { | 206 int32_t nIndex) { |
207 Item* pParentItem = GetWidgetMgrItem(pParent); | 207 Item* pParentItem = GetWidgetMgrItem(pParent); |
208 if (!pParentItem) { | 208 if (!pParentItem) { |
209 auto item = pdfium::MakeUnique<Item>(pParent); | 209 auto item = pdfium::MakeUnique<Item>(pParent); |
210 pParentItem = item.get(); | 210 pParentItem = item.get(); |
211 m_mapWidgetItem[pParent] = std::move(item); | 211 m_mapWidgetItem[pParent] = std::move(item); |
212 | 212 |
213 pParentItem->pParent = GetWidgetMgrItem(nullptr); | 213 pParentItem->pParent = GetWidgetMgrItem(nullptr); |
214 SetWidgetIndex(pParent, -1); | 214 SetWidgetIndex(pParent, -1); |
215 } | 215 } |
216 | 216 |
217 Item* pItem = GetWidgetMgrItem(pChild); | 217 Item* pItem = GetWidgetMgrItem(pChild); |
218 if (!pItem) { | 218 if (!pItem) { |
219 auto item = pdfium::MakeUnique<Item>(pChild); | 219 auto item = pdfium::MakeUnique<Item>(pChild); |
220 pItem = item.get(); | 220 pItem = item.get(); |
221 m_mapWidgetItem[pChild] = std::move(item); | 221 m_mapWidgetItem[pChild] = std::move(item); |
222 } | 222 } |
223 if (pItem->pParent && pItem->pParent != pParentItem) { | 223 if (pItem->pParent && pItem->pParent != pParentItem) { |
224 if (pItem->pPrevious) | 224 if (pItem->pPrevious) |
225 pItem->pPrevious->pNext = pItem->pNext; | 225 pItem->pPrevious->pNext = pItem->pNext; |
226 if (pItem->pNext) | 226 if (pItem->pNext) |
227 pItem->pNext->pPrevious = pItem->pPrevious; | 227 pItem->pNext->pPrevious = pItem->pPrevious; |
228 if (pItem->pParent->pChild == pItem) | 228 if (pItem->pParent->pChild == pItem) |
229 pItem->pParent->pChild = pItem->pNext; | 229 pItem->pParent->pChild = pItem->pNext; |
230 } | 230 } |
231 pItem->pParent = pParentItem; | 231 pItem->pParent = pParentItem; |
232 SetWidgetIndex(pChild, nIndex); | 232 SetWidgetIndex(pChild, nIndex); |
233 } | 233 } |
234 | 234 |
235 void CFWL_WidgetMgr::RemoveWidget(IFWL_Widget* pWidget) { | 235 void CFWL_WidgetMgr::RemoveWidget(CFWL_Widget* pWidget) { |
236 Item* pItem = GetWidgetMgrItem(pWidget); | 236 Item* pItem = GetWidgetMgrItem(pWidget); |
237 if (!pItem) | 237 if (!pItem) |
238 return; | 238 return; |
239 if (pItem->pPrevious) | 239 if (pItem->pPrevious) |
240 pItem->pPrevious->pNext = pItem->pNext; | 240 pItem->pPrevious->pNext = pItem->pNext; |
241 if (pItem->pNext) | 241 if (pItem->pNext) |
242 pItem->pNext->pPrevious = pItem->pPrevious; | 242 pItem->pNext->pPrevious = pItem->pPrevious; |
243 if (pItem->pParent && pItem->pParent->pChild == pItem) | 243 if (pItem->pParent && pItem->pParent->pChild == pItem) |
244 pItem->pParent->pChild = pItem->pNext; | 244 pItem->pParent->pChild = pItem->pNext; |
245 | 245 |
246 Item* pChild = pItem->pChild; | 246 Item* pChild = pItem->pChild; |
247 while (pChild) { | 247 while (pChild) { |
248 Item* pNext = pChild->pNext; | 248 Item* pNext = pChild->pNext; |
249 RemoveWidget(pChild->pWidget); | 249 RemoveWidget(pChild->pWidget); |
250 pChild = pNext; | 250 pChild = pNext; |
251 } | 251 } |
252 m_mapWidgetItem.erase(pWidget); | 252 m_mapWidgetItem.erase(pWidget); |
253 } | 253 } |
254 | 254 |
255 void CFWL_WidgetMgr::SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned) { | 255 void CFWL_WidgetMgr::SetOwner(CFWL_Widget* pOwner, CFWL_Widget* pOwned) { |
256 Item* pParentItem = GetWidgetMgrItem(pOwner); | 256 Item* pParentItem = GetWidgetMgrItem(pOwner); |
257 if (!pParentItem) { | 257 if (!pParentItem) { |
258 auto item = pdfium::MakeUnique<Item>(pOwner); | 258 auto item = pdfium::MakeUnique<Item>(pOwner); |
259 pParentItem = item.get(); | 259 pParentItem = item.get(); |
260 m_mapWidgetItem[pOwner] = std::move(item); | 260 m_mapWidgetItem[pOwner] = std::move(item); |
261 | 261 |
262 pParentItem->pParent = GetWidgetMgrItem(nullptr); | 262 pParentItem->pParent = GetWidgetMgrItem(nullptr); |
263 SetWidgetIndex(pOwner, -1); | 263 SetWidgetIndex(pOwner, -1); |
264 } | 264 } |
265 | 265 |
266 Item* pItem = GetWidgetMgrItem(pOwned); | 266 Item* pItem = GetWidgetMgrItem(pOwned); |
267 if (!pItem) { | 267 if (!pItem) { |
268 auto item = pdfium::MakeUnique<Item>(pOwned); | 268 auto item = pdfium::MakeUnique<Item>(pOwned); |
269 pItem = item.get(); | 269 pItem = item.get(); |
270 m_mapWidgetItem[pOwned] = std::move(item); | 270 m_mapWidgetItem[pOwned] = std::move(item); |
271 } | 271 } |
272 pItem->pOwner = pParentItem; | 272 pItem->pOwner = pParentItem; |
273 } | 273 } |
274 void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) { | 274 void CFWL_WidgetMgr::SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild) { |
275 Item* pParentItem = GetWidgetMgrItem(pParent); | 275 Item* pParentItem = GetWidgetMgrItem(pParent); |
276 Item* pItem = GetWidgetMgrItem(pChild); | 276 Item* pItem = GetWidgetMgrItem(pChild); |
277 if (!pItem) | 277 if (!pItem) |
278 return; | 278 return; |
279 if (pItem->pParent && pItem->pParent != pParentItem) { | 279 if (pItem->pParent && pItem->pParent != pParentItem) { |
280 if (pItem->pPrevious) | 280 if (pItem->pPrevious) |
281 pItem->pPrevious->pNext = pItem->pNext; | 281 pItem->pPrevious->pNext = pItem->pNext; |
282 if (pItem->pNext) | 282 if (pItem->pNext) |
283 pItem->pNext->pPrevious = pItem->pPrevious; | 283 pItem->pNext->pPrevious = pItem->pPrevious; |
284 if (pItem->pParent->pChild == pItem) | 284 if (pItem->pParent->pChild == pItem) |
285 pItem->pParent->pChild = pItem->pNext; | 285 pItem->pParent->pChild = pItem->pNext; |
286 | 286 |
287 pItem->pNext = nullptr; | 287 pItem->pNext = nullptr; |
288 pItem->pPrevious = nullptr; | 288 pItem->pPrevious = nullptr; |
289 } | 289 } |
290 pItem->pParent = pParentItem; | 290 pItem->pParent = pParentItem; |
291 SetWidgetIndex(pChild, -1); | 291 SetWidgetIndex(pChild, -1); |
292 } | 292 } |
293 | 293 |
294 void CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, | 294 void CFWL_WidgetMgr::SetWidgetRect_Native(CFWL_Widget* pWidget, |
295 const CFX_RectF& rect) { | 295 const CFX_RectF& rect) { |
296 if (!FWL_UseOffscreen(pWidget)) | 296 if (!FWL_UseOffscreen(pWidget)) |
297 return; | 297 return; |
298 | 298 |
299 Item* pItem = GetWidgetMgrItem(pWidget); | 299 Item* pItem = GetWidgetMgrItem(pWidget); |
300 pItem->iRedrawCounter++; | 300 pItem->iRedrawCounter++; |
301 if (pItem->pOffscreen) { | 301 if (pItem->pOffscreen) { |
302 CFX_RenderDevice* pDevice = pItem->pOffscreen->GetRenderDevice(); | 302 CFX_RenderDevice* pDevice = pItem->pOffscreen->GetRenderDevice(); |
303 if (pDevice && pDevice->GetBitmap()) { | 303 if (pDevice && pDevice->GetBitmap()) { |
304 CFX_DIBitmap* pBitmap = pDevice->GetBitmap(); | 304 CFX_DIBitmap* pBitmap = pDevice->GetBitmap(); |
305 if (pBitmap->GetWidth() - rect.width > 1 || | 305 if (pBitmap->GetWidth() - rect.width > 1 || |
306 pBitmap->GetHeight() - rect.height > 1) { | 306 pBitmap->GetHeight() - rect.height > 1) { |
307 pItem->pOffscreen.reset(); | 307 pItem->pOffscreen.reset(); |
308 } | 308 } |
309 } | 309 } |
310 } | 310 } |
311 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 311 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
312 pItem->bOutsideChanged = !m_rtScreen.Contains(rect); | 312 pItem->bOutsideChanged = !m_rtScreen.Contains(rect); |
313 #endif | 313 #endif |
314 } | 314 } |
315 | 315 |
316 IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, | 316 CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, |
317 FX_FLOAT x, | 317 FX_FLOAT x, |
318 FX_FLOAT y) { | 318 FX_FLOAT y) { |
319 if (!parent) | 319 if (!parent) |
320 return nullptr; | 320 return nullptr; |
321 | 321 |
322 FX_FLOAT x1; | 322 FX_FLOAT x1; |
323 FX_FLOAT y1; | 323 FX_FLOAT y1; |
324 IFWL_Widget* child = GetLastChildWidget(parent); | 324 CFWL_Widget* child = GetLastChildWidget(parent); |
325 while (child) { | 325 while (child) { |
326 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { | 326 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { |
327 x1 = x; | 327 x1 = x; |
328 y1 = y; | 328 y1 = y; |
329 CFX_Matrix matrixOnParent; | 329 CFX_Matrix matrixOnParent; |
330 child->GetMatrix(matrixOnParent); | 330 child->GetMatrix(matrixOnParent); |
331 CFX_Matrix m; | 331 CFX_Matrix m; |
332 m.SetIdentity(); | 332 m.SetIdentity(); |
333 m.SetReverse(matrixOnParent); | 333 m.SetReverse(matrixOnParent); |
334 m.TransformPoint(x1, y1); | 334 m.TransformPoint(x1, y1); |
335 CFX_RectF bounds; | 335 CFX_RectF bounds; |
336 child->GetWidgetRect(bounds); | 336 child->GetWidgetRect(bounds); |
337 if (bounds.Contains(x1, y1)) { | 337 if (bounds.Contains(x1, y1)) { |
338 x1 -= bounds.left; | 338 x1 -= bounds.left; |
339 y1 -= bounds.top; | 339 y1 -= bounds.top; |
340 return GetWidgetAtPoint(child, x1, y1); | 340 return GetWidgetAtPoint(child, x1, y1); |
341 } | 341 } |
342 } | 342 } |
343 child = GetPriorSiblingWidget(child); | 343 child = GetPriorSiblingWidget(child); |
344 } | 344 } |
345 return parent; | 345 return parent; |
346 } | 346 } |
347 | 347 |
348 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, | 348 void CFWL_WidgetMgr::NotifySizeChanged(CFWL_Widget* pForm, |
349 FX_FLOAT fx, | 349 FX_FLOAT fx, |
350 FX_FLOAT fy) { | 350 FX_FLOAT fy) { |
351 if (FWL_UseOffscreen(pForm)) | 351 if (FWL_UseOffscreen(pForm)) |
352 GetWidgetMgrItem(pForm)->pOffscreen.reset(); | 352 GetWidgetMgrItem(pForm)->pOffscreen.reset(); |
353 } | 353 } |
354 | 354 |
355 IFWL_Widget* CFWL_WidgetMgr::NextTab(IFWL_Widget* parent, | 355 CFWL_Widget* CFWL_WidgetMgr::NextTab(CFWL_Widget* parent, |
356 IFWL_Widget* focus, | 356 CFWL_Widget* focus, |
357 bool& bFind) { | 357 bool& bFind) { |
358 CFWL_WidgetMgr* pMgr = parent->GetOwnerApp()->GetWidgetMgr(); | 358 CFWL_WidgetMgr* pMgr = parent->GetOwnerApp()->GetWidgetMgr(); |
359 IFWL_Widget* child = pMgr->GetFirstChildWidget(parent); | 359 CFWL_Widget* child = pMgr->GetFirstChildWidget(parent); |
360 while (child) { | 360 while (child) { |
361 if (focus == child) | 361 if (focus == child) |
362 bFind = true; | 362 bFind = true; |
363 | 363 |
364 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && | 364 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && |
365 (!focus || (focus != child && bFind))) { | 365 (!focus || (focus != child && bFind))) { |
366 return child; | 366 return child; |
367 } | 367 } |
368 IFWL_Widget* bRet = NextTab(child, focus, bFind); | 368 CFWL_Widget* bRet = NextTab(child, focus, bFind); |
369 if (bRet) | 369 if (bRet) |
370 return bRet; | 370 return bRet; |
371 | 371 |
372 child = pMgr->GetNextSiblingWidget(child); | 372 child = pMgr->GetNextSiblingWidget(child); |
373 } | 373 } |
374 return nullptr; | 374 return nullptr; |
375 } | 375 } |
376 | 376 |
377 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) const { | 377 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(CFWL_Widget* pFirst) const { |
378 int32_t iRet = 0; | 378 int32_t iRet = 0; |
379 IFWL_Widget* pChild = pFirst; | 379 CFWL_Widget* pChild = pFirst; |
380 while (pChild) { | 380 while (pChild) { |
381 pChild = GetNextSiblingWidget(pChild); | 381 pChild = GetNextSiblingWidget(pChild); |
382 ++iRet; | 382 ++iRet; |
383 } | 383 } |
384 return iRet; | 384 return iRet; |
385 } | 385 } |
386 | 386 |
387 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( | 387 CFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( |
388 IFWL_Widget* pRadioButton) const { | 388 CFWL_Widget* pRadioButton) const { |
389 IFWL_Widget* pNext = pRadioButton; | 389 CFWL_Widget* pNext = pRadioButton; |
390 if (pNext && (pNext->GetStyles() & FWL_WGTSTYLE_Group)) | 390 if (pNext && (pNext->GetStyles() & FWL_WGTSTYLE_Group)) |
391 return pNext; | 391 return pNext; |
392 return nullptr; | 392 return nullptr; |
393 } | 393 } |
394 | 394 |
395 void CFWL_WidgetMgr::GetSameGroupRadioButton( | 395 void CFWL_WidgetMgr::GetSameGroupRadioButton( |
396 IFWL_Widget* pRadioButton, | 396 CFWL_Widget* pRadioButton, |
397 CFX_ArrayTemplate<IFWL_Widget*>& group) const { | 397 CFX_ArrayTemplate<CFWL_Widget*>& group) const { |
398 IFWL_Widget* pFirst = GetFirstSiblingWidget(pRadioButton); | 398 CFWL_Widget* pFirst = GetFirstSiblingWidget(pRadioButton); |
399 if (!pFirst) | 399 if (!pFirst) |
400 pFirst = pRadioButton; | 400 pFirst = pRadioButton; |
401 | 401 |
402 int32_t iGroup = CountRadioButtonGroup(pFirst); | 402 int32_t iGroup = CountRadioButtonGroup(pFirst); |
403 if (iGroup < 2) | 403 if (iGroup < 2) |
404 return; | 404 return; |
405 group.Add(GetRadioButtonGroupHeader(pRadioButton)); | 405 group.Add(GetRadioButtonGroupHeader(pRadioButton)); |
406 } | 406 } |
407 | 407 |
408 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) const { | 408 CFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(CFWL_Widget* pParent) const { |
409 if ((pParent->GetClassID() == FWL_Type::PushButton) && | 409 if ((pParent->GetClassID() == FWL_Type::PushButton) && |
410 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { | 410 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { |
411 return pParent; | 411 return pParent; |
412 } | 412 } |
413 | 413 |
414 IFWL_Widget* child = | 414 CFWL_Widget* child = |
415 pParent->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pParent); | 415 pParent->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pParent); |
416 while (child) { | 416 while (child) { |
417 if ((child->GetClassID() == FWL_Type::PushButton) && | 417 if ((child->GetClassID() == FWL_Type::PushButton) && |
418 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { | 418 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { |
419 return child; | 419 return child; |
420 } | 420 } |
421 if (IFWL_Widget* find = GetDefaultButton(child)) | 421 if (CFWL_Widget* find = GetDefaultButton(child)) |
422 return find; | 422 return find; |
423 | 423 |
424 child = child->GetOwnerApp()->GetWidgetMgr()->GetNextSiblingWidget(child); | 424 child = child->GetOwnerApp()->GetWidgetMgr()->GetNextSiblingWidget(child); |
425 } | 425 } |
426 return nullptr; | 426 return nullptr; |
427 } | 427 } |
428 | 428 |
429 void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) { | 429 void CFWL_WidgetMgr::AddRedrawCounts(CFWL_Widget* pWidget) { |
430 GetWidgetMgrItem(pWidget)->iRedrawCounter++; | 430 GetWidgetMgrItem(pWidget)->iRedrawCounter++; |
431 } | 431 } |
432 | 432 |
433 void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) { | 433 void CFWL_WidgetMgr::ResetRedrawCounts(CFWL_Widget* pWidget) { |
434 GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; | 434 GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; |
435 } | 435 } |
436 | 436 |
437 CFWL_WidgetMgr::Item* CFWL_WidgetMgr::GetWidgetMgrItem( | 437 CFWL_WidgetMgr::Item* CFWL_WidgetMgr::GetWidgetMgrItem( |
438 IFWL_Widget* pWidget) const { | 438 CFWL_Widget* pWidget) const { |
439 auto it = m_mapWidgetItem.find(pWidget); | 439 auto it = m_mapWidgetItem.find(pWidget); |
440 return it != m_mapWidgetItem.end() ? static_cast<Item*>(it->second.get()) | 440 return it != m_mapWidgetItem.end() ? static_cast<Item*>(it->second.get()) |
441 : nullptr; | 441 : nullptr; |
442 } | 442 } |
443 | 443 |
444 bool CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) const { | 444 bool CFWL_WidgetMgr::IsAbleNative(CFWL_Widget* pWidget) const { |
445 if (!pWidget) | 445 if (!pWidget) |
446 return false; | 446 return false; |
447 if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) | 447 if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) |
448 return false; | 448 return false; |
449 | 449 |
450 uint32_t dwStyles = pWidget->GetStyles(); | 450 uint32_t dwStyles = pWidget->GetStyles(); |
451 return ((dwStyles & FWL_WGTSTYLE_WindowTypeMask) == | 451 return ((dwStyles & FWL_WGTSTYLE_WindowTypeMask) == |
452 FWL_WGTSTYLE_OverLapper) || | 452 FWL_WGTSTYLE_OverLapper) || |
453 (dwStyles & FWL_WGTSTYLE_Popup); | 453 (dwStyles & FWL_WGTSTYLE_Popup); |
454 } | 454 } |
455 | 455 |
456 void CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, | 456 void CFWL_WidgetMgr::GetAdapterPopupPos(CFWL_Widget* pWidget, |
457 FX_FLOAT fMinHeight, | 457 FX_FLOAT fMinHeight, |
458 FX_FLOAT fMaxHeight, | 458 FX_FLOAT fMaxHeight, |
459 const CFX_RectF& rtAnchor, | 459 const CFX_RectF& rtAnchor, |
460 CFX_RectF& rtPopup) const { | 460 CFX_RectF& rtPopup) const { |
461 m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup); | 461 m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup); |
462 } | 462 } |
463 | 463 |
464 void CFWL_WidgetMgr::OnSetCapability(uint32_t dwCapability) { | 464 void CFWL_WidgetMgr::OnSetCapability(uint32_t dwCapability) { |
465 m_dwCapability = dwCapability; | 465 m_dwCapability = dwCapability; |
466 } | 466 } |
467 | 467 |
468 void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) { | 468 void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) { |
469 if (!pMessage) | 469 if (!pMessage) |
470 return; | 470 return; |
471 if (!pMessage->m_pDstTarget) | 471 if (!pMessage->m_pDstTarget) |
472 return; | 472 return; |
473 | 473 |
474 IFWL_Widget* pDstWidget = pMessage->m_pDstTarget; | 474 CFWL_Widget* pDstWidget = pMessage->m_pDstTarget; |
475 const CFWL_App* pApp = pDstWidget->GetOwnerApp(); | 475 const CFWL_App* pApp = pDstWidget->GetOwnerApp(); |
476 if (!pApp) | 476 if (!pApp) |
477 return; | 477 return; |
478 | 478 |
479 CFWL_NoteDriver* pNoteDriver = | 479 CFWL_NoteDriver* pNoteDriver = |
480 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 480 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
481 if (!pNoteDriver) | 481 if (!pNoteDriver) |
482 return; | 482 return; |
483 | 483 |
484 std::unique_ptr<CFWL_Message> pClonedMessage = pMessage->Clone(); | 484 std::unique_ptr<CFWL_Message> pClonedMessage = pMessage->Clone(); |
485 if (IsFormDisabled()) | 485 if (IsFormDisabled()) |
486 pNoteDriver->ProcessMessage(pClonedMessage.get()); | 486 pNoteDriver->ProcessMessage(pClonedMessage.get()); |
487 else | 487 else |
488 pNoteDriver->QueueMessage(std::move(pClonedMessage)); | 488 pNoteDriver->QueueMessage(std::move(pClonedMessage)); |
489 | 489 |
490 #if (_FX_OS_ == _FX_MACOSX_) | 490 #if (_FX_OS_ == _FX_MACOSX_) |
491 CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); | 491 CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); |
492 if (pTopLoop) | 492 if (pTopLoop) |
493 pNoteDriver->UnqueueMessage(pTopLoop); | 493 pNoteDriver->UnqueueMessage(pTopLoop); |
494 #endif | 494 #endif |
495 } | 495 } |
496 | 496 |
497 void CFWL_WidgetMgr::OnDrawWidget(IFWL_Widget* pWidget, | 497 void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, |
498 CFX_Graphics* pGraphics, | 498 CFX_Graphics* pGraphics, |
499 const CFX_Matrix* pMatrix) { | 499 const CFX_Matrix* pMatrix) { |
500 if (!pWidget || !pGraphics) | 500 if (!pWidget || !pGraphics) |
501 return; | 501 return; |
502 | 502 |
503 CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); | 503 CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); |
504 CFX_RectF clipCopy; | 504 CFX_RectF clipCopy; |
505 pWidget->GetWidgetRect(clipCopy); | 505 pWidget->GetWidgetRect(clipCopy); |
506 clipCopy.left = clipCopy.top = 0; | 506 clipCopy.left = clipCopy.top = 0; |
507 | 507 |
(...skipping 25 matching lines...) Expand all Loading... |
533 pWidget->GetClientRect(rtClient); | 533 pWidget->GetClientRect(rtClient); |
534 clipBounds.Intersect(rtClient); | 534 clipBounds.Intersect(rtClient); |
535 } | 535 } |
536 if (!clipBounds.IsEmpty()) | 536 if (!clipBounds.IsEmpty()) |
537 DrawChild(pWidget, clipBounds, pTemp, pMatrix); | 537 DrawChild(pWidget, clipBounds, pTemp, pMatrix); |
538 | 538 |
539 DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); | 539 DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); |
540 ResetRedrawCounts(pWidget); | 540 ResetRedrawCounts(pWidget); |
541 } | 541 } |
542 | 542 |
543 void CFWL_WidgetMgr::DrawChild(IFWL_Widget* parent, | 543 void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, |
544 const CFX_RectF& rtClip, | 544 const CFX_RectF& rtClip, |
545 CFX_Graphics* pGraphics, | 545 CFX_Graphics* pGraphics, |
546 const CFX_Matrix* pMatrix) { | 546 const CFX_Matrix* pMatrix) { |
547 if (!parent) | 547 if (!parent) |
548 return; | 548 return; |
549 | 549 |
550 bool bFormDisable = IsFormDisabled(); | 550 bool bFormDisable = IsFormDisabled(); |
551 IFWL_Widget* pNextChild = GetFirstChildWidget(parent); | 551 CFWL_Widget* pNextChild = GetFirstChildWidget(parent); |
552 while (pNextChild) { | 552 while (pNextChild) { |
553 IFWL_Widget* child = pNextChild; | 553 CFWL_Widget* child = pNextChild; |
554 pNextChild = GetNextSiblingWidget(child); | 554 pNextChild = GetNextSiblingWidget(child); |
555 if (child->GetStates() & FWL_WGTSTATE_Invisible) | 555 if (child->GetStates() & FWL_WGTSTATE_Invisible) |
556 continue; | 556 continue; |
557 | 557 |
558 CFX_RectF rtWidget; | 558 CFX_RectF rtWidget; |
559 child->GetWidgetRect(rtWidget); | 559 child->GetWidgetRect(rtWidget); |
560 if (rtWidget.IsEmpty()) | 560 if (rtWidget.IsEmpty()) |
561 continue; | 561 continue; |
562 | 562 |
563 CFX_Matrix widgetMatrix; | 563 CFX_Matrix widgetMatrix; |
(...skipping 20 matching lines...) Expand all Loading... |
584 } | 584 } |
585 if (!bFormDisable) | 585 if (!bFormDisable) |
586 pGraphics->RestoreGraphState(); | 586 pGraphics->RestoreGraphState(); |
587 | 587 |
588 DrawChild(child, clipBounds, pGraphics, | 588 DrawChild(child, clipBounds, pGraphics, |
589 bFormDisable ? &widgetMatrix : pMatrix); | 589 bFormDisable ? &widgetMatrix : pMatrix); |
590 child = GetNextSiblingWidget(child); | 590 child = GetNextSiblingWidget(child); |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(IFWL_Widget* pWidget, | 594 CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget, |
595 CFX_Graphics* pGraphics, | 595 CFX_Graphics* pGraphics, |
596 const CFX_Matrix* pMatrix) { | 596 const CFX_Matrix* pMatrix) { |
597 if (!FWL_UseOffscreen(pWidget)) | 597 if (!FWL_UseOffscreen(pWidget)) |
598 return pGraphics; | 598 return pGraphics; |
599 | 599 |
600 Item* pItem = GetWidgetMgrItem(pWidget); | 600 Item* pItem = GetWidgetMgrItem(pWidget); |
601 if (!pItem->pOffscreen) { | 601 if (!pItem->pOffscreen) { |
602 pItem->pOffscreen.reset(new CFX_Graphics); | 602 pItem->pOffscreen.reset(new CFX_Graphics); |
603 CFX_RectF rect; | 603 CFX_RectF rect; |
604 pWidget->GetWidgetRect(rect); | 604 pWidget->GetWidgetRect(rect); |
605 pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, | 605 pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, |
606 FXDIB_Argb); | 606 FXDIB_Argb); |
607 } | 607 } |
608 CFX_RectF rect; | 608 CFX_RectF rect; |
609 pGraphics->GetClipRect(rect); | 609 pGraphics->GetClipRect(rect); |
610 pItem->pOffscreen->SetClipRect(rect); | 610 pItem->pOffscreen->SetClipRect(rect); |
611 return pItem->pOffscreen.get(); | 611 return pItem->pOffscreen.get(); |
612 } | 612 } |
613 | 613 |
614 void CFWL_WidgetMgr::DrawWidgetAfter(IFWL_Widget* pWidget, | 614 void CFWL_WidgetMgr::DrawWidgetAfter(CFWL_Widget* pWidget, |
615 CFX_Graphics* pGraphics, | 615 CFX_Graphics* pGraphics, |
616 CFX_RectF& rtClip, | 616 CFX_RectF& rtClip, |
617 const CFX_Matrix* pMatrix) { | 617 const CFX_Matrix* pMatrix) { |
618 if (FWL_UseOffscreen(pWidget)) { | 618 if (FWL_UseOffscreen(pWidget)) { |
619 Item* pItem = GetWidgetMgrItem(pWidget); | 619 Item* pItem = GetWidgetMgrItem(pWidget); |
620 pGraphics->Transfer(pItem->pOffscreen.get(), rtClip.left, rtClip.top, | 620 pGraphics->Transfer(pItem->pOffscreen.get(), rtClip.left, rtClip.top, |
621 rtClip, pMatrix); | 621 rtClip, pMatrix); |
622 #ifdef _WIN32 | 622 #ifdef _WIN32 |
623 pItem->pOffscreen->ClearClip(); | 623 pItem->pOffscreen->ClearClip(); |
624 #endif | 624 #endif |
625 } | 625 } |
626 Item* pItem = GetWidgetMgrItem(pWidget); | 626 Item* pItem = GetWidgetMgrItem(pWidget); |
627 pItem->iRedrawCounter = 0; | 627 pItem->iRedrawCounter = 0; |
628 } | 628 } |
629 | 629 |
630 bool CFWL_WidgetMgr::IsNeedRepaint(IFWL_Widget* pWidget, | 630 bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, |
631 CFX_Matrix* pMatrix, | 631 CFX_Matrix* pMatrix, |
632 const CFX_RectF& rtDirty) { | 632 const CFX_RectF& rtDirty) { |
633 Item* pItem = GetWidgetMgrItem(pWidget); | 633 Item* pItem = GetWidgetMgrItem(pWidget); |
634 if (pItem && pItem->iRedrawCounter > 0) { | 634 if (pItem && pItem->iRedrawCounter > 0) { |
635 pItem->iRedrawCounter = 0; | 635 pItem->iRedrawCounter = 0; |
636 return true; | 636 return true; |
637 } | 637 } |
638 | 638 |
639 CFX_RectF rtWidget; | 639 CFX_RectF rtWidget; |
640 pWidget->GetWidgetRect(rtWidget); | 640 pWidget->GetWidgetRect(rtWidget); |
641 rtWidget.left = rtWidget.top = 0; | 641 rtWidget.left = rtWidget.top = 0; |
642 pMatrix->TransformRect(rtWidget); | 642 pMatrix->TransformRect(rtWidget); |
643 if (!rtWidget.IntersectWith(rtDirty)) | 643 if (!rtWidget.IntersectWith(rtDirty)) |
644 return false; | 644 return false; |
645 | 645 |
646 IFWL_Widget* pChild = | 646 CFWL_Widget* pChild = |
647 pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget); | 647 pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget); |
648 if (!pChild) | 648 if (!pChild) |
649 return true; | 649 return true; |
650 | 650 |
651 CFX_RectF rtChilds; | 651 CFX_RectF rtChilds; |
652 rtChilds.Empty(); | 652 rtChilds.Empty(); |
653 bool bChildIntersectWithDirty = false; | 653 bool bChildIntersectWithDirty = false; |
654 bool bOrginPtIntersectWidthChild = false; | 654 bool bOrginPtIntersectWidthChild = false; |
655 bool bOrginPtIntersectWidthDirty = | 655 bool bOrginPtIntersectWidthDirty = |
656 rtDirty.Contains(rtWidget.left, rtWidget.top); | 656 rtDirty.Contains(rtWidget.left, rtWidget.top); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 } | 720 } |
721 if (repaintPoint > 0) | 721 if (repaintPoint > 0) |
722 return true; | 722 return true; |
723 | 723 |
724 pMatrix->TransformRect(rtChilds); | 724 pMatrix->TransformRect(rtChilds); |
725 if (rtChilds.Contains(rtDirty) || rtChilds.Contains(rtWidget)) | 725 if (rtChilds.Contains(rtDirty) || rtChilds.Contains(rtWidget)) |
726 return false; | 726 return false; |
727 return true; | 727 return true; |
728 } | 728 } |
729 | 729 |
730 bool CFWL_WidgetMgr::UseOffscreenDirect(IFWL_Widget* pWidget) const { | 730 bool CFWL_WidgetMgr::UseOffscreenDirect(CFWL_Widget* pWidget) const { |
731 Item* pItem = GetWidgetMgrItem(pWidget); | 731 Item* pItem = GetWidgetMgrItem(pWidget); |
732 if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) | 732 if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) |
733 return false; | 733 return false; |
734 | 734 |
735 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 735 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
736 if (pItem->bOutsideChanged) { | 736 if (pItem->bOutsideChanged) { |
737 CFX_RectF r; | 737 CFX_RectF r; |
738 pWidget->GetWidgetRect(r); | 738 pWidget->GetWidgetRect(r); |
739 CFX_RectF temp(m_rtScreen); | 739 CFX_RectF temp(m_rtScreen); |
740 temp.Deflate(50, 50); | 740 temp.Deflate(50, 50); |
741 if (!temp.Contains(r)) | 741 if (!temp.Contains(r)) |
742 return false; | 742 return false; |
743 | 743 |
744 pItem->bOutsideChanged = false; | 744 pItem->bOutsideChanged = false; |
745 } | 745 } |
746 #endif | 746 #endif |
747 | 747 |
748 return pItem->iRedrawCounter == 0; | 748 return pItem->iRedrawCounter == 0; |
749 } | 749 } |
750 | 750 |
751 CFWL_WidgetMgr::Item::Item() : CFWL_WidgetMgr::Item(nullptr) {} | 751 CFWL_WidgetMgr::Item::Item() : CFWL_WidgetMgr::Item(nullptr) {} |
752 | 752 |
753 CFWL_WidgetMgr::Item::Item(IFWL_Widget* widget) | 753 CFWL_WidgetMgr::Item::Item(CFWL_Widget* widget) |
754 : pParent(nullptr), | 754 : pParent(nullptr), |
755 pOwner(nullptr), | 755 pOwner(nullptr), |
756 pChild(nullptr), | 756 pChild(nullptr), |
757 pPrevious(nullptr), | 757 pPrevious(nullptr), |
758 pNext(nullptr), | 758 pNext(nullptr), |
759 pWidget(widget), | 759 pWidget(widget), |
760 iRedrawCounter(0) | 760 iRedrawCounter(0) |
761 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | 761 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) |
762 , | 762 , |
763 bOutsideChanged(false) | 763 bOutsideChanged(false) |
764 #endif | 764 #endif |
765 { | 765 { |
766 } | 766 } |
767 | 767 |
768 CFWL_WidgetMgr::Item::~Item() {} | 768 CFWL_WidgetMgr::Item::~Item() {} |
OLD | NEW |