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_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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 if (bRet) { | 454 if (bRet) { |
455 return bRet; | 455 return bRet; |
456 } | 456 } |
457 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); | 457 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); |
458 } | 458 } |
459 return NULL; | 459 return NULL; |
460 } | 460 } |
461 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { | 461 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { |
462 int32_t iRet = 0; | 462 int32_t iRet = 0; |
463 IFWL_Widget* pChild = pFirst; | 463 IFWL_Widget* pChild = pFirst; |
464 while (pChild) { | 464 while (pChild) |
465 if ((pChild->GetStyles() & FWL_WGTSTYLE_Group) && | |
466 pChild->GetClassID() == 3811304691) { | |
467 iRet++; | |
468 } | |
469 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); | 465 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); |
470 } | |
471 return iRet; | 466 return iRet; |
472 } | 467 } |
473 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, | 468 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, |
474 FX_BOOL bNext) { | 469 FX_BOOL bNext) { |
475 while ((pWidget = GetWidget(pWidget, bNext ? FWL_WGTRELATION_NextSibling | 470 return nullptr; |
476 : FWL_WGTRELATION_PriorSibling)) != | |
477 NULL) { | |
478 if (pWidget->GetClassID() == 3811304691) { | |
479 return pWidget; | |
480 } | |
481 } | |
482 return NULL; | |
483 } | 471 } |
484 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( | 472 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( |
485 IFWL_Widget* pRadioButton) { | 473 IFWL_Widget* pRadioButton) { |
486 if (pRadioButton->GetStyles() & FWL_WGTSTYLE_Group) { | 474 if (pRadioButton->GetStyles() & FWL_WGTSTYLE_Group) { |
487 return pRadioButton; | 475 return pRadioButton; |
488 } | 476 } |
489 IFWL_Widget* pNext = pRadioButton; | 477 IFWL_Widget* pNext = pRadioButton; |
490 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != NULL) { | 478 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != NULL) { |
491 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { | 479 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { |
492 return pNext; | 480 return pNext; |
493 } | 481 } |
494 } | 482 } |
495 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling); | 483 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling); |
496 if ((pNext->GetStyles() & FWL_WGTSTYLE_Group) && | |
497 pNext->GetClassID() == 3811304691) { | |
498 return pNext; | |
499 } | |
500 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) && pNext && | 484 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) && pNext && |
501 pNext != pRadioButton) { | 485 pNext != pRadioButton) { |
502 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { | 486 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { |
503 return pNext; | 487 return pNext; |
504 } | 488 } |
505 } | 489 } |
506 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); | 490 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); |
507 if (pNext && (pNext->GetStyles() == FWL_WGTSTYLE_Group) && | |
508 pNext->GetClassID() == 3811304691) { | |
509 return pNext; | |
510 } | |
511 return GetSiblingRadioButton(pNext, TRUE); | 491 return GetSiblingRadioButton(pNext, TRUE); |
512 } | 492 } |
513 void CFWL_WidgetMgr::GetSameGroupRadioButton( | 493 void CFWL_WidgetMgr::GetSameGroupRadioButton( |
514 IFWL_Widget* pRadioButton, | 494 IFWL_Widget* pRadioButton, |
515 CFX_ArrayTemplate<IFWL_Widget*>& group) { | 495 CFX_ArrayTemplate<IFWL_Widget*>& group) { |
516 IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); | 496 IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); |
517 if (!pFirst) { | 497 if (!pFirst) { |
518 pFirst = pRadioButton; | 498 pFirst = pRadioButton; |
519 } | 499 } |
520 int32_t iGroup = CountRadioButtonGroup(pFirst); | 500 int32_t iGroup = CountRadioButtonGroup(pFirst); |
521 if (iGroup < 2) { | 501 if (iGroup < 2) { |
522 if (pFirst->GetClassID() == 3811304691) { | |
523 group.Add(pFirst); | |
524 } | |
525 IFWL_Widget* pNext = pFirst; | 502 IFWL_Widget* pNext = pFirst; |
526 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { | 503 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { |
527 group.Add(pNext); | 504 group.Add(pNext); |
528 } | 505 } |
529 return; | 506 return; |
530 } | 507 } |
531 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton); | 508 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton); |
532 do { | 509 do { |
533 group.Add(pNext); | 510 group.Add(pNext); |
534 pNext = GetSiblingRadioButton(pNext, TRUE); | 511 pNext = GetSiblingRadioButton(pNext, TRUE); |
535 if (!pNext) { | 512 if (!pNext) |
536 if (pFirst->GetClassID() == 3811304691) { | 513 pNext = GetSiblingRadioButton(pFirst, TRUE); |
537 pNext = pFirst; | |
538 } else { | |
539 pNext = GetSiblingRadioButton(pFirst, TRUE); | |
540 } | |
541 } | |
542 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); | 514 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); |
543 } | 515 } |
544 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { | 516 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { |
545 if ((pParent->GetClassID() == 3521614244) && | 517 if ((pParent->GetClassID() == FWL_Type::PushButton) && |
546 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { | 518 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { |
547 return pParent; | 519 return pParent; |
548 } | 520 } |
549 IFWL_Widget* child = | 521 IFWL_Widget* child = |
550 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); | 522 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); |
551 while (child) { | 523 while (child) { |
552 if ((child->GetClassID() == 3521614244) && | 524 if ((child->GetClassID() == FWL_Type::PushButton) && |
553 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { | 525 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { |
554 return child; | 526 return child; |
555 } | 527 } |
556 IFWL_Widget* find = GetDefaultButton(child); | 528 IFWL_Widget* find = GetDefaultButton(child); |
557 if (find) { | 529 if (find) { |
558 return find; | 530 return find; |
559 } | 531 } |
560 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); | 532 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); |
561 } | 533 } |
562 return NULL; | 534 return NULL; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 pWidget->GetWidgetRect(rtWidget); | 796 pWidget->GetWidgetRect(rtWidget); |
825 rtWidget.left = rtWidget.top = 0; | 797 rtWidget.left = rtWidget.top = 0; |
826 pMatrix->TransformRect(rtWidget); | 798 pMatrix->TransformRect(rtWidget); |
827 if (!rtWidget.IntersectWith(rtDirty)) | 799 if (!rtWidget.IntersectWith(rtDirty)) |
828 return FALSE; | 800 return FALSE; |
829 | 801 |
830 IFWL_Widget* pChild = | 802 IFWL_Widget* pChild = |
831 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); | 803 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); |
832 if (!pChild) | 804 if (!pChild) |
833 return TRUE; | 805 return TRUE; |
834 if (pChild->GetClassID() == 3150298670) { | 806 |
835 CFX_RectF rtTemp; | |
836 pChild->GetWidgetRect(rtTemp); | |
837 if (rtTemp.width >= rtWidget.width && rtTemp.height >= rtWidget.height) { | |
838 pChild = | |
839 FWL_GetWidgetMgr()->GetWidget(pChild, FWL_WGTRELATION_FirstChild); | |
840 if (!pChild) | |
841 return TRUE; | |
842 } | |
843 } | |
844 CFX_RectF rtChilds; | 807 CFX_RectF rtChilds; |
845 rtChilds.Empty(); | 808 rtChilds.Empty(); |
846 FX_BOOL bChildIntersectWithDirty = FALSE; | 809 FX_BOOL bChildIntersectWithDirty = FALSE; |
847 FX_BOOL bOrginPtIntersectWidthChild = FALSE; | 810 FX_BOOL bOrginPtIntersectWidthChild = FALSE; |
848 FX_BOOL bOrginPtIntersectWidthDirty = | 811 FX_BOOL bOrginPtIntersectWidthDirty = |
849 rtDirty.Contains(rtWidget.left, rtWidget.top); | 812 rtDirty.Contains(rtWidget.left, rtWidget.top); |
850 static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; | 813 static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; |
851 int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA); | 814 int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA); |
852 FXSYS_memset(hitPoint, 0, iSize); | 815 FXSYS_memset(hitPoint, 0, iSize); |
853 FX_FLOAT fxPiece = rtWidget.width / kNeedRepaintHitPiece; | 816 FX_FLOAT fxPiece = rtWidget.width / kNeedRepaintHitPiece; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 temp.Deflate(50, 50); | 896 temp.Deflate(50, 50); |
934 if (!temp.Contains(r)) | 897 if (!temp.Contains(r)) |
935 return FALSE; | 898 return FALSE; |
936 | 899 |
937 pItem->bOutsideChanged = FALSE; | 900 pItem->bOutsideChanged = FALSE; |
938 } | 901 } |
939 #endif | 902 #endif |
940 | 903 |
941 return pItem->iRedrawCounter == 0; | 904 return pItem->iRedrawCounter == 0; |
942 } | 905 } |
OLD | NEW |