Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: xfa/fwl/core/fwl_widgetmgrimp.cpp

Issue 2004213002: Remove IWFL_WidgetMgr in favor of CFWL_WidgetMgr (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Explicit ctor Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/fwl_widgetmgrimp.h ('k') | xfa/fwl/core/ifwl_app.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_widgetmgrimp.h" 7 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
8 8
9 #include "xfa/fwl/core/cfwl_message.h" 9 #include "xfa/fwl/core/cfwl_message.h"
10 #include "xfa/fwl/core/fwl_appimp.h" 10 #include "xfa/fwl/core/fwl_appimp.h"
(...skipping 18 matching lines...) Expand all
29 } // namespace 29 } // namespace
30 30
31 FX_BOOL FWL_UseOffscreen(IFWL_Widget* pWidget) { 31 FX_BOOL FWL_UseOffscreen(IFWL_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 IFWL_WidgetMgr* FWL_GetWidgetMgr() { 39 // static
40 CFWL_WidgetMgr* CFWL_WidgetMgr::GetInstance() {
40 IFWL_App* pApp = FWL_GetApp(); 41 IFWL_App* pApp = FWL_GetApp();
41 if (!pApp) 42 return pApp ? pApp->GetWidgetMgr() : nullptr;
42 return NULL;
43 return pApp->GetWidgetMgr();
44 } 43 }
45 44
46 CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) 45 CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative)
47 : m_dwCapability(0), 46 : m_dwCapability(0),
48 m_pDelegate(new CFWL_WidgetMgrDelegate(this)), 47 m_pDelegate(new CFWL_WidgetMgrDelegate(this)),
49 m_pAdapter(pAdapterNative->GetWidgetMgr(m_pDelegate.get())) { 48 m_pAdapter(pAdapterNative->GetWidgetMgr(m_pDelegate.get())) {
50 ASSERT(m_pAdapter); 49 ASSERT(m_pAdapter);
51 m_mapWidgetItem[nullptr].reset(new CFWL_WidgetMgrItem); 50 m_mapWidgetItem[nullptr].reset(new CFWL_WidgetMgrItem);
52 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 51 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
53 m_rtScreen.Reset(); 52 m_rtScreen.Reset();
54 #endif 53 #endif
55 } 54 }
56 55
57 CFWL_WidgetMgr::~CFWL_WidgetMgr() {} 56 CFWL_WidgetMgr::~CFWL_WidgetMgr() {}
58 57
59 int32_t CFWL_WidgetMgr::CountWidgets(IFWL_Widget* pParent) { 58 IFWL_Widget* CFWL_WidgetMgr::GetParentWidget(IFWL_Widget* pWidget) const {
60 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); 59 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
61 return TravelWidgetMgr(pParentItem, NULL, NULL); 60 return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr;
62 } 61 }
63 IFWL_Widget* CFWL_WidgetMgr::GetWidget(int32_t nIndex, IFWL_Widget* pParent) { 62
64 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); 63 IFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(IFWL_Widget* pWidget) const {
65 IFWL_Widget* pWidget = NULL; 64 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
66 TravelWidgetMgr(pParentItem, &nIndex, NULL, &pWidget); 65 return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr;
67 return pWidget;
68 } 66 }
69 IFWL_Widget* CFWL_WidgetMgr::GetWidget(IFWL_Widget* pWidget, 67
70 FWL_WGTRELATION eRelation) { 68 IFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(IFWL_Widget* pWidget) const {
71 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 69 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
72 if (!pItem) { 70 pItem = pItem ? pItem->pPrevious : nullptr; // Not self.
73 return NULL; 71 while (pItem && pItem->pPrevious)
72 pItem = pItem->pPrevious;
73
74 return pItem ? pItem->pWidget : nullptr;
75 }
76
77 IFWL_Widget* CFWL_WidgetMgr::GetPriorSiblingWidget(IFWL_Widget* pWidget) const {
78 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
79 return pItem && pItem->pPrevious ? pItem->pPrevious->pWidget : nullptr;
80 }
81
82 IFWL_Widget* CFWL_WidgetMgr::GetNextSiblingWidget(IFWL_Widget* pWidget) const {
83 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
84 return pItem && pItem->pNext ? pItem->pNext->pWidget : nullptr;
85 }
86
87 IFWL_Widget* CFWL_WidgetMgr::GetLastSiblingWidget(IFWL_Widget* pWidget) const {
88 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
89 pItem = pItem ? pItem->pNext : nullptr; // Not self.
90 while (pItem && pItem->pNext)
91 pItem = pItem->pNext;
92
93 return pItem ? pItem->pWidget : nullptr;
94 }
95
96 IFWL_Widget* CFWL_WidgetMgr::GetFirstChildWidget(IFWL_Widget* pWidget) const {
97 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
98 return pItem && pItem->pChild ? pItem->pChild->pWidget : nullptr;
99 }
100
101 IFWL_Widget* CFWL_WidgetMgr::GetLastChildWidget(IFWL_Widget* pWidget) const {
102 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
103 pItem = pItem ? pItem->pChild : nullptr;
104 while (pItem && pItem->pNext)
105 pItem = pItem->pNext;
106
107 return pItem ? pItem->pWidget : nullptr;
108 }
109
110 IFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(IFWL_Widget* pWidget) const {
111 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
112 while (pItem) {
113 if (IsAbleNative(pItem->pWidget))
114 return pItem->pWidget;
115 pItem = pItem->pParent;
74 } 116 }
75 IFWL_Widget* pRet = NULL; 117 return nullptr;
76 switch (eRelation) {
77 case FWL_WGTRELATION_Parent: {
78 pRet = pItem->pParent ? pItem->pParent->pWidget : NULL;
79 break;
80 }
81 case FWL_WGTRELATION_Owner: {
82 pRet = pItem->pOwner ? pItem->pOwner->pWidget : NULL;
83 break;
84 }
85 case FWL_WGTRELATION_FirstSibling: {
86 pItem = pItem->pPrevious;
87 while (pItem && pItem->pPrevious) {
88 pItem = pItem->pPrevious;
89 }
90 pRet = pItem ? pItem->pWidget : NULL;
91 break;
92 }
93 case FWL_WGTRELATION_PriorSibling: {
94 pRet = pItem->pPrevious ? pItem->pPrevious->pWidget : NULL;
95 break;
96 }
97 case FWL_WGTRELATION_NextSibling: {
98 pRet = pItem->pNext ? pItem->pNext->pWidget : NULL;
99 break;
100 }
101 case FWL_WGTRELATION_LastSibling: {
102 pItem = pItem->pNext;
103 while (pItem && pItem->pNext) {
104 pItem = pItem->pNext;
105 }
106 pRet = pItem ? pItem->pWidget : NULL;
107 break;
108 }
109 case FWL_WGTRELATION_FirstChild: {
110 pRet = pItem->pChild ? pItem->pChild->pWidget : NULL;
111 break;
112 }
113 case FWL_WGTRELATION_LastChild: {
114 pItem = pItem->pChild;
115 while (pItem && pItem->pNext) {
116 pItem = pItem->pNext;
117 }
118 pRet = pItem ? pItem->pWidget : NULL;
119 break;
120 }
121 case FWL_WGTRELATION_SystemForm: {
122 while (pItem) {
123 if (IsAbleNative(pItem->pWidget)) {
124 pRet = pItem->pWidget;
125 break;
126 }
127 pItem = pItem->pParent;
128 }
129 break;
130 }
131 default: {}
132 }
133 return pRet;
134 } 118 }
135 int32_t CFWL_WidgetMgr::GetWidgetIndex(IFWL_Widget* pWidget) { 119
136 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
137 if (!pItem)
138 return -1;
139 return TravelWidgetMgr(pItem->pParent, NULL, pItem);
140 }
141 FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { 120 FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) {
142 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 121 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
143 if (!pItem) 122 if (!pItem)
144 return FALSE; 123 return FALSE;
145 if (!pItem->pParent) 124 if (!pItem->pParent)
146 return FALSE; 125 return FALSE;
147 CFWL_WidgetMgrItem* pChild = pItem->pParent->pChild; 126 CFWL_WidgetMgrItem* pChild = pItem->pParent->pChild;
148 int32_t i = 0; 127 int32_t i = 0;
149 while (pChild) { 128 while (pChild) {
150 if (pChild == pItem) { 129 if (pChild == pItem) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 IFWL_Widget* pOuter = pWidget->GetOuter(); 197 IFWL_Widget* pOuter = pWidget->GetOuter();
219 while (pOuter) { 198 while (pOuter) {
220 CFX_RectF rtTemp; 199 CFX_RectF rtTemp;
221 pNative->GetWidgetRect(rtTemp); 200 pNative->GetWidgetRect(rtTemp);
222 rect.left += rtTemp.left; 201 rect.left += rtTemp.left;
223 rect.top += rtTemp.top; 202 rect.top += rtTemp.top;
224 pNative = pOuter; 203 pNative = pOuter;
225 pOuter = pOuter->GetOuter(); 204 pOuter = pOuter->GetOuter();
226 } 205 }
227 } else if (!IsAbleNative(pWidget)) { 206 } else if (!IsAbleNative(pWidget)) {
228 pNative = GetWidget(pWidget, FWL_WGTRELATION_SystemForm); 207 pNative = GetSystemFormWidget(pWidget);
229 if (!pNative) 208 if (!pNative)
230 return FWL_Error::Indefinite; 209 return FWL_Error::Indefinite;
231 pWidget->TransformTo(pNative, rect.left, rect.top); 210 pWidget->TransformTo(pNative, rect.left, rect.top);
232 } 211 }
233 AddRedrawCounts(pNative); 212 AddRedrawCounts(pNative);
234 return m_pAdapter->RepaintWidget(pNative, &rect); 213 return m_pAdapter->RepaintWidget(pNative, &rect);
235 } 214 }
236 void CFWL_WidgetMgr::AddWidget(IFWL_Widget* pWidget) { 215 void CFWL_WidgetMgr::AddWidget(IFWL_Widget* pWidget) {
237 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(NULL); 216 CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(NULL);
238 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 217 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 pItem->pNext = NULL; 317 pItem->pNext = NULL;
339 pItem->pPrevious = NULL; 318 pItem->pPrevious = NULL;
340 } 319 }
341 pItem->pParent = pParentItem; 320 pItem->pParent = pParentItem;
342 SetWidgetIndex(pChild, -1); 321 SetWidgetIndex(pChild, -1);
343 } 322 }
344 323
345 FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) { 324 FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) {
346 IFWL_Widget* pTemp = pChild; 325 IFWL_Widget* pTemp = pChild;
347 do { 326 do {
348 if (pTemp == pParent) { 327 if (pTemp == pParent)
349 return TRUE; 328 return TRUE;
350 } 329 pTemp = GetParentWidget(pTemp);
351 pTemp = GetWidget(pTemp, FWL_WGTRELATION_Parent);
352 } while (pTemp); 330 } while (pTemp);
353 return FALSE; 331 return FALSE;
354 } 332 }
355 333
356 FWL_Error CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, 334 FWL_Error CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget,
357 const CFX_RectF& rect) { 335 const CFX_RectF& rect) {
358 if (FWL_UseOffscreen(pWidget)) { 336 if (FWL_UseOffscreen(pWidget)) {
359 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 337 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
360 pItem->iRedrawCounter++; 338 pItem->iRedrawCounter++;
361 if (pItem->pOffscreen) { 339 if (pItem->pOffscreen) {
(...skipping 13 matching lines...) Expand all
375 return FWL_Error::Succeeded; 353 return FWL_Error::Succeeded;
376 } 354 }
377 355
378 IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, 356 IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent,
379 FX_FLOAT x, 357 FX_FLOAT x,
380 FX_FLOAT y) { 358 FX_FLOAT y) {
381 if (!parent) 359 if (!parent)
382 return NULL; 360 return NULL;
383 FX_FLOAT x1; 361 FX_FLOAT x1;
384 FX_FLOAT y1; 362 FX_FLOAT y1;
385 IFWL_Widget* child = GetWidget(parent, FWL_WGTRELATION_LastChild); 363 IFWL_Widget* child = GetLastChildWidget(parent);
386 while (child) { 364 while (child) {
387 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { 365 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) {
388 x1 = x; 366 x1 = x;
389 y1 = y; 367 y1 = y;
390 CFX_Matrix matrixOnParent; 368 CFX_Matrix matrixOnParent;
391 child->GetMatrix(matrixOnParent); 369 child->GetMatrix(matrixOnParent);
392 CFX_Matrix m; 370 CFX_Matrix m;
393 m.SetIdentity(); 371 m.SetIdentity();
394 m.SetReverse(matrixOnParent); 372 m.SetReverse(matrixOnParent);
395 m.TransformPoint(x1, y1); 373 m.TransformPoint(x1, y1);
396 CFX_RectF bounds; 374 CFX_RectF bounds;
397 child->GetWidgetRect(bounds); 375 child->GetWidgetRect(bounds);
398 if (bounds.Contains(x1, y1)) { 376 if (bounds.Contains(x1, y1)) {
399 x1 -= bounds.left; 377 x1 -= bounds.left;
400 y1 -= bounds.top; 378 y1 -= bounds.top;
401 return GetWidgetAtPoint(child, x1, y1); 379 return GetWidgetAtPoint(child, x1, y1);
402 } 380 }
403 } 381 }
404 child = GetWidget(child, FWL_WGTRELATION_PriorSibling); 382 child = GetPriorSiblingWidget(child);
405 } 383 }
406 return parent; 384 return parent;
407 } 385 }
408 386
409 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, 387 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm,
410 FX_FLOAT fx, 388 FX_FLOAT fx,
411 FX_FLOAT fy) { 389 FX_FLOAT fy) {
412 if (FWL_UseOffscreen(pForm)) 390 if (FWL_UseOffscreen(pForm))
413 GetWidgetMgrItem(pForm)->pOffscreen.reset(); 391 GetWidgetMgrItem(pForm)->pOffscreen.reset();
414 } 392 }
415 393
416 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, 394 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent,
417 IFWL_Widget* focus, 395 IFWL_Widget* focus,
418 FX_BOOL& bFind) { 396 FX_BOOL& bFind) {
419 IFWL_Widget* child = 397 CFWL_WidgetMgr* pMgr = CFWL_WidgetMgr::GetInstance();
420 FWL_GetWidgetMgr()->GetWidget(parent, FWL_WGTRELATION_FirstChild); 398 IFWL_Widget* child = pMgr->GetFirstChildWidget(parent);
421 while (child) { 399 while (child) {
422 if (focus == child) { 400 if (focus == child)
423 bFind = TRUE; 401 bFind = TRUE;
424 } 402
425 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && 403 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) &&
426 (!focus || (focus != child && bFind))) { 404 (!focus || (focus != child && bFind))) {
427 return child; 405 return child;
428 } 406 }
429 IFWL_Widget* bRet = nextTab(child, focus, bFind); 407 IFWL_Widget* bRet = nextTab(child, focus, bFind);
430 if (bRet) { 408 if (bRet)
431 return bRet; 409 return bRet;
432 } 410
433 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 411 child = pMgr->GetNextSiblingWidget(child);
434 } 412 }
435 return NULL; 413 return nullptr;
436 } 414 }
415
437 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { 416 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) {
438 int32_t iRet = 0; 417 int32_t iRet = 0;
439 IFWL_Widget* pChild = pFirst; 418 IFWL_Widget* pChild = pFirst;
440 while (pChild) 419 while (pChild) {
441 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); 420 pChild = GetNextSiblingWidget(pChild);
421 ++iRet;
422 }
442 return iRet; 423 return iRet;
443 } 424 }
444 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, 425 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget,
445 FX_BOOL bNext) { 426 FX_BOOL bNext) {
446 return nullptr; 427 return nullptr;
447 } 428 }
448 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( 429 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader(
449 IFWL_Widget* pRadioButton) { 430 IFWL_Widget* pRadioButton) {
450 IFWL_Widget* pNext = pRadioButton; 431 IFWL_Widget* pNext = pRadioButton;
451 while (pNext) { 432 while (pNext) {
452 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) 433 if (pNext->GetStyles() & FWL_WGTSTYLE_Group)
453 return pNext; 434 return pNext;
454 pNext = GetSiblingRadioButton(pNext, FALSE); 435 pNext = GetSiblingRadioButton(pNext, FALSE);
455 } 436 }
456 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling); 437 pNext = GetLastSiblingWidget(pRadioButton);
457 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != nullptr && 438 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != nullptr &&
458 pNext != pRadioButton) { 439 pNext != pRadioButton) {
459 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) 440 if (pNext->GetStyles() & FWL_WGTSTYLE_Group)
460 return pNext; 441 return pNext;
461 } 442 }
462 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); 443 pNext = GetFirstSiblingWidget(pRadioButton);
463 return GetSiblingRadioButton(pNext, TRUE); 444 return GetSiblingRadioButton(pNext, TRUE);
464 } 445 }
465 void CFWL_WidgetMgr::GetSameGroupRadioButton( 446 void CFWL_WidgetMgr::GetSameGroupRadioButton(
466 IFWL_Widget* pRadioButton, 447 IFWL_Widget* pRadioButton,
467 CFX_ArrayTemplate<IFWL_Widget*>& group) { 448 CFX_ArrayTemplate<IFWL_Widget*>& group) {
468 IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); 449 IFWL_Widget* pFirst = GetFirstSiblingWidget(pRadioButton);
469 if (!pFirst) { 450 if (!pFirst) {
470 pFirst = pRadioButton; 451 pFirst = pRadioButton;
471 } 452 }
472 int32_t iGroup = CountRadioButtonGroup(pFirst); 453 int32_t iGroup = CountRadioButtonGroup(pFirst);
473 if (iGroup < 2) { 454 if (iGroup < 2) {
474 IFWL_Widget* pNext = pFirst; 455 IFWL_Widget* pNext = pFirst;
475 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { 456 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) {
476 group.Add(pNext); 457 group.Add(pNext);
477 } 458 }
478 return; 459 return;
479 } 460 }
480 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton); 461 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton);
481 do { 462 do {
482 group.Add(pNext); 463 group.Add(pNext);
483 pNext = GetSiblingRadioButton(pNext, TRUE); 464 pNext = GetSiblingRadioButton(pNext, TRUE);
484 if (!pNext) 465 if (!pNext)
485 pNext = GetSiblingRadioButton(pFirst, TRUE); 466 pNext = GetSiblingRadioButton(pFirst, TRUE);
486 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); 467 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0));
487 } 468 }
488 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { 469 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) {
489 if ((pParent->GetClassID() == FWL_Type::PushButton) && 470 if ((pParent->GetClassID() == FWL_Type::PushButton) &&
490 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 471 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
491 return pParent; 472 return pParent;
492 } 473 }
493 IFWL_Widget* child = 474 IFWL_Widget* child =
494 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); 475 CFWL_WidgetMgr::GetInstance()->GetFirstChildWidget(pParent);
495 while (child) { 476 while (child) {
496 if ((child->GetClassID() == FWL_Type::PushButton) && 477 if ((child->GetClassID() == FWL_Type::PushButton) &&
497 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 478 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
498 return child; 479 return child;
499 } 480 }
500 IFWL_Widget* find = GetDefaultButton(child); 481 IFWL_Widget* find = GetDefaultButton(child);
501 if (find) { 482 if (find) {
502 return find; 483 return find;
503 } 484 }
504 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 485 child = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(child);
505 } 486 }
506 return NULL; 487 return NULL;
507 } 488 }
508 void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) { 489 void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) {
509 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 490 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
510 (pItem->iRedrawCounter)++; 491 (pItem->iRedrawCounter)++;
511 } 492 }
512 void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) { 493 void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) {
513 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 494 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
514 pItem->iRedrawCounter = 0; 495 pItem->iRedrawCounter = 0;
(...skipping 28 matching lines...) Expand all
543 } 524 }
544 pChild = pChild->pNext; 525 pChild = pChild->pNext;
545 } 526 }
546 if (pIndex) { 527 if (pIndex) {
547 return 0; 528 return 0;
548 } else if (pItem) { 529 } else if (pItem) {
549 return -1; 530 return -1;
550 } 531 }
551 return iCount - 1; 532 return iCount - 1;
552 } 533 }
553 FX_BOOL CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) { 534
535 FX_BOOL CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) const {
554 if (!pWidget) 536 if (!pWidget)
555 return FALSE; 537 return FALSE;
556 if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) { 538 if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) {
557 return FALSE; 539 return FALSE;
558 } 540 }
559 uint32_t dwStyles = pWidget->GetStyles(); 541 uint32_t dwStyles = pWidget->GetStyles();
560 return ((dwStyles & FWL_WGTSTYLE_WindowTypeMask) == 542 return ((dwStyles & FWL_WGTSTYLE_WindowTypeMask) ==
561 FWL_WGTSTYLE_OverLapper) || 543 FWL_WGTSTYLE_OverLapper) ||
562 (dwStyles & FWL_WGTSTYLE_Popup); 544 (dwStyles & FWL_WGTSTYLE_Popup);
563 } 545 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 652 }
671 653
672 void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, 654 void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent,
673 const CFX_RectF& rtClip, 655 const CFX_RectF& rtClip,
674 CFX_Graphics* pGraphics, 656 CFX_Graphics* pGraphics,
675 const CFX_Matrix* pMatrix) { 657 const CFX_Matrix* pMatrix) {
676 if (!parent) 658 if (!parent)
677 return; 659 return;
678 660
679 FX_BOOL bFormDisable = m_pWidgetMgr->IsFormDisabled(); 661 FX_BOOL bFormDisable = m_pWidgetMgr->IsFormDisabled();
680 IFWL_Widget* pNextChild = 662 IFWL_Widget* pNextChild = m_pWidgetMgr->GetFirstChildWidget(parent);
681 m_pWidgetMgr->GetWidget(parent, FWL_WGTRELATION_FirstChild);
682 while (pNextChild) { 663 while (pNextChild) {
683 IFWL_Widget* child = pNextChild; 664 IFWL_Widget* child = pNextChild;
684 pNextChild = m_pWidgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); 665 pNextChild = m_pWidgetMgr->GetNextSiblingWidget(child);
685 if (child->GetStates() & FWL_WGTSTATE_Invisible) 666 if (child->GetStates() & FWL_WGTSTATE_Invisible)
686 continue; 667 continue;
687 668
688 CFX_RectF rtWidget; 669 CFX_RectF rtWidget;
689 child->GetWidgetRect(rtWidget); 670 child->GetWidgetRect(rtWidget);
690 if (rtWidget.IsEmpty()) 671 if (rtWidget.IsEmpty())
691 continue; 672 continue;
692 673
693 CFX_Matrix widgetMatrix; 674 CFX_Matrix widgetMatrix;
694 CFX_RectF clipBounds(rtWidget); 675 CFX_RectF clipBounds(rtWidget);
(...skipping 17 matching lines...) Expand all
712 if (m_pWidgetMgr->IsFormDisabled() || 693 if (m_pWidgetMgr->IsFormDisabled() ||
713 IsNeedRepaint(child, &widgetMatrix, rtClip)) { 694 IsNeedRepaint(child, &widgetMatrix, rtClip)) {
714 pDelegate->OnDrawWidget(pGraphics, &widgetMatrix); 695 pDelegate->OnDrawWidget(pGraphics, &widgetMatrix);
715 } 696 }
716 } 697 }
717 if (!bFormDisable) 698 if (!bFormDisable)
718 pGraphics->RestoreGraphState(); 699 pGraphics->RestoreGraphState();
719 700
720 DrawChild(child, clipBounds, pGraphics, 701 DrawChild(child, clipBounds, pGraphics,
721 bFormDisable ? &widgetMatrix : pMatrix); 702 bFormDisable ? &widgetMatrix : pMatrix);
722 child = m_pWidgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); 703 child = m_pWidgetMgr->GetNextSiblingWidget(child);
723 } 704 }
724 } 705 }
725 706
726 CFX_Graphics* CFWL_WidgetMgrDelegate::DrawWidgetBefore( 707 CFX_Graphics* CFWL_WidgetMgrDelegate::DrawWidgetBefore(
727 IFWL_Widget* pWidget, 708 IFWL_Widget* pWidget,
728 CFX_Graphics* pGraphics, 709 CFX_Graphics* pGraphics,
729 const CFX_Matrix* pMatrix) { 710 const CFX_Matrix* pMatrix) {
730 if (!FWL_UseOffscreen(pWidget)) 711 if (!FWL_UseOffscreen(pWidget))
731 return pGraphics; 712 return pGraphics;
732 713
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 return TRUE; 750 return TRUE;
770 } 751 }
771 CFX_RectF rtWidget; 752 CFX_RectF rtWidget;
772 pWidget->GetWidgetRect(rtWidget); 753 pWidget->GetWidgetRect(rtWidget);
773 rtWidget.left = rtWidget.top = 0; 754 rtWidget.left = rtWidget.top = 0;
774 pMatrix->TransformRect(rtWidget); 755 pMatrix->TransformRect(rtWidget);
775 if (!rtWidget.IntersectWith(rtDirty)) 756 if (!rtWidget.IntersectWith(rtDirty))
776 return FALSE; 757 return FALSE;
777 758
778 IFWL_Widget* pChild = 759 IFWL_Widget* pChild =
779 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); 760 CFWL_WidgetMgr::GetInstance()->GetFirstChildWidget(pWidget);
780 if (!pChild) 761 if (!pChild)
781 return TRUE; 762 return TRUE;
782 763
783 CFX_RectF rtChilds; 764 CFX_RectF rtChilds;
784 rtChilds.Empty(); 765 rtChilds.Empty();
785 FX_BOOL bChildIntersectWithDirty = FALSE; 766 FX_BOOL bChildIntersectWithDirty = FALSE;
786 FX_BOOL bOrginPtIntersectWidthChild = FALSE; 767 FX_BOOL bOrginPtIntersectWidthChild = FALSE;
787 FX_BOOL bOrginPtIntersectWidthDirty = 768 FX_BOOL bOrginPtIntersectWidthDirty =
788 rtDirty.Contains(rtWidget.left, rtWidget.top); 769 rtDirty.Contains(rtWidget.left, rtWidget.top);
789 static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; 770 static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) { 809 for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) {
829 if (hitPoint[i].bNotContainByDirty || hitPoint[i].bNotNeedRepaint) 810 if (hitPoint[i].bNotContainByDirty || hitPoint[i].bNotNeedRepaint)
830 continue; 811 continue;
831 if (!rtDirty.Contains(hitPoint[i].hitPoint)) { 812 if (!rtDirty.Contains(hitPoint[i].hitPoint)) {
832 hitPoint[i].bNotContainByDirty = true; 813 hitPoint[i].bNotContainByDirty = true;
833 continue; 814 continue;
834 } 815 }
835 if (r.Contains(hitPoint[i].hitPoint)) 816 if (r.Contains(hitPoint[i].hitPoint))
836 hitPoint[i].bNotNeedRepaint = true; 817 hitPoint[i].bNotNeedRepaint = true;
837 } 818 }
838 } while ((pChild = FWL_GetWidgetMgr()->GetWidget( 819 } while (
839 pChild, FWL_WGTRELATION_NextSibling)) != NULL); 820 (pChild = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(pChild)));
840 821
841 if (!bChildIntersectWithDirty) 822 if (!bChildIntersectWithDirty)
842 return TRUE; 823 return TRUE;
843 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) 824 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild)
844 return TRUE; 825 return TRUE;
845 if (rtChilds.IsEmpty()) 826 if (rtChilds.IsEmpty())
846 return TRUE; 827 return TRUE;
847 828
848 int32_t repaintPoint = kNeedRepaintHitPoints; 829 int32_t repaintPoint = kNeedRepaintHitPoints;
849 for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) { 830 for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) {
(...skipping 22 matching lines...) Expand all
872 temp.Deflate(50, 50); 853 temp.Deflate(50, 50);
873 if (!temp.Contains(r)) 854 if (!temp.Contains(r))
874 return FALSE; 855 return FALSE;
875 856
876 pItem->bOutsideChanged = FALSE; 857 pItem->bOutsideChanged = FALSE;
877 } 858 }
878 #endif 859 #endif
879 860
880 return pItem->iRedrawCounter == 0; 861 return pItem->iRedrawCounter == 0;
881 } 862 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_widgetmgrimp.h ('k') | xfa/fwl/core/ifwl_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698