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

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

Issue 1946213003: Remove CLASSHASH defines in favour of an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (bRet) { 508 if (bRet) {
509 return bRet; 509 return bRet;
510 } 510 }
511 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 511 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling);
512 } 512 }
513 return NULL; 513 return NULL;
514 } 514 }
515 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { 515 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) {
516 int32_t iRet = 0; 516 int32_t iRet = 0;
517 IFWL_Widget* pChild = pFirst; 517 IFWL_Widget* pChild = pFirst;
518 while (pChild) { 518 while (pChild)
519 if ((pChild->GetStyles() & FWL_WGTSTYLE_Group) &&
520 pChild->GetClassID() == 3811304691) {
521 iRet++;
522 }
523 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); 519 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling);
524 }
525 return iRet; 520 return iRet;
526 } 521 }
527 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, 522 IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget,
528 FX_BOOL bNext) { 523 FX_BOOL bNext) {
529 while ((pWidget = GetWidget(pWidget, bNext ? FWL_WGTRELATION_NextSibling 524 return nullptr;
530 : FWL_WGTRELATION_PriorSibling)) !=
531 NULL) {
532 if (pWidget->GetClassID() == 3811304691) {
533 return pWidget;
534 }
535 }
536 return NULL;
537 } 525 }
538 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( 526 IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader(
539 IFWL_Widget* pRadioButton) { 527 IFWL_Widget* pRadioButton) {
540 if (pRadioButton->GetStyles() & FWL_WGTSTYLE_Group) { 528 if (pRadioButton->GetStyles() & FWL_WGTSTYLE_Group) {
541 return pRadioButton; 529 return pRadioButton;
542 } 530 }
543 IFWL_Widget* pNext = pRadioButton; 531 IFWL_Widget* pNext = pRadioButton;
544 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != NULL) { 532 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != NULL) {
545 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { 533 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) {
546 return pNext; 534 return pNext;
547 } 535 }
548 } 536 }
549 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling); 537 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_LastSibling);
550 if ((pNext->GetStyles() & FWL_WGTSTYLE_Group) &&
551 pNext->GetClassID() == 3811304691) {
552 return pNext;
553 }
554 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) && pNext && 538 while ((pNext = GetSiblingRadioButton(pNext, FALSE)) && pNext &&
555 pNext != pRadioButton) { 539 pNext != pRadioButton) {
556 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) { 540 if (pNext->GetStyles() & FWL_WGTSTYLE_Group) {
557 return pNext; 541 return pNext;
558 } 542 }
559 } 543 }
560 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); 544 pNext = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling);
561 if (pNext && (pNext->GetStyles() == FWL_WGTSTYLE_Group) &&
562 pNext->GetClassID() == 3811304691) {
563 return pNext;
564 }
565 return GetSiblingRadioButton(pNext, TRUE); 545 return GetSiblingRadioButton(pNext, TRUE);
566 } 546 }
567 void CFWL_WidgetMgr::GetSameGroupRadioButton( 547 void CFWL_WidgetMgr::GetSameGroupRadioButton(
568 IFWL_Widget* pRadioButton, 548 IFWL_Widget* pRadioButton,
569 CFX_ArrayTemplate<IFWL_Widget*>& group) { 549 CFX_ArrayTemplate<IFWL_Widget*>& group) {
570 IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); 550 IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling);
571 if (!pFirst) { 551 if (!pFirst) {
572 pFirst = pRadioButton; 552 pFirst = pRadioButton;
573 } 553 }
574 int32_t iGroup = CountRadioButtonGroup(pFirst); 554 int32_t iGroup = CountRadioButtonGroup(pFirst);
575 if (iGroup < 2) { 555 if (iGroup < 2) {
576 if (pFirst->GetClassID() == 3811304691) {
577 group.Add(pFirst);
578 }
579 IFWL_Widget* pNext = pFirst; 556 IFWL_Widget* pNext = pFirst;
580 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) { 557 while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != NULL) {
581 group.Add(pNext); 558 group.Add(pNext);
582 } 559 }
583 return; 560 return;
584 } 561 }
585 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton); 562 IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton);
586 do { 563 do {
587 group.Add(pNext); 564 group.Add(pNext);
588 pNext = GetSiblingRadioButton(pNext, TRUE); 565 pNext = GetSiblingRadioButton(pNext, TRUE);
589 if (!pNext) { 566 if (!pNext)
590 if (pFirst->GetClassID() == 3811304691) { 567 pNext = GetSiblingRadioButton(pFirst, TRUE);
591 pNext = pFirst;
592 } else {
593 pNext = GetSiblingRadioButton(pFirst, TRUE);
594 }
595 }
596 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); 568 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0));
597 } 569 }
598 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { 570 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) {
599 if ((pParent->GetClassID() == 3521614244) && 571 if ((pParent->GetClassID() == FWL_Type::PushButton) &&
600 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 572 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
601 return pParent; 573 return pParent;
602 } 574 }
603 IFWL_Widget* child = 575 IFWL_Widget* child =
604 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); 576 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild);
605 while (child) { 577 while (child) {
606 if ((child->GetClassID() == 3521614244) && 578 if ((child->GetClassID() == FWL_Type::PushButton) &&
607 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 579 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
608 return child; 580 return child;
609 } 581 }
610 IFWL_Widget* find = GetDefaultButton(child); 582 IFWL_Widget* find = GetDefaultButton(child);
611 if (find) { 583 if (find) {
612 return find; 584 return find;
613 } 585 }
614 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 586 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling);
615 } 587 }
616 return NULL; 588 return NULL;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 const CFX_RectF& rtDirty) { 848 const CFX_RectF& rtDirty) {
877 CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget); 849 CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget);
878 if (pItem && pItem->iRedrawCounter > 0) { 850 if (pItem && pItem->iRedrawCounter > 0) {
879 pItem->iRedrawCounter = 0; 851 pItem->iRedrawCounter = 0;
880 return TRUE; 852 return TRUE;
881 } 853 }
882 CFX_RectF rtWidget; 854 CFX_RectF rtWidget;
883 pWidget->GetWidgetRect(rtWidget); 855 pWidget->GetWidgetRect(rtWidget);
884 rtWidget.left = rtWidget.top = 0; 856 rtWidget.left = rtWidget.top = 0;
885 pMatrix->TransformRect(rtWidget); 857 pMatrix->TransformRect(rtWidget);
886 if (!rtWidget.IntersectWith(rtDirty)) { 858 if (!rtWidget.IntersectWith(rtDirty))
887 return FALSE; 859 return FALSE;
888 } 860
889 IFWL_Widget* pChild = 861 IFWL_Widget* pChild =
890 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); 862 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild);
891 if (!pChild) { 863 if (!pChild)
892 return TRUE; 864 return TRUE;
893 } 865
894 if (pChild->GetClassID() == 3150298670) {
895 CFX_RectF rtTemp;
896 pChild->GetWidgetRect(rtTemp);
897 if (rtTemp.width >= rtWidget.width && rtTemp.height >= rtWidget.height) {
898 pChild =
899 FWL_GetWidgetMgr()->GetWidget(pChild, FWL_WGTRELATION_FirstChild);
900 if (!pChild) {
901 return TRUE;
902 }
903 }
904 }
905 CFX_RectF rtChilds; 866 CFX_RectF rtChilds;
906 rtChilds.Empty(); 867 rtChilds.Empty();
907 FX_BOOL bChildIntersectWithDirty = FALSE; 868 FX_BOOL bChildIntersectWithDirty = FALSE;
908 FX_BOOL bOrginPtIntersectWidthChild = FALSE; 869 FX_BOOL bOrginPtIntersectWidthChild = FALSE;
909 FX_BOOL bOrginPtIntersectWidthDirty = 870 FX_BOOL bOrginPtIntersectWidthDirty =
910 rtDirty.Contains(rtWidget.left, rtWidget.top); 871 rtDirty.Contains(rtWidget.left, rtWidget.top);
911 static FWL_NEEDREPAINTHITDATA hitPoint[FWL_NEEDREPAINTHIT_Point]; 872 static FWL_NEEDREPAINTHITDATA hitPoint[FWL_NEEDREPAINTHIT_Point];
912 int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA); 873 int32_t iSize = sizeof(FWL_NEEDREPAINTHITDATA);
913 FXSYS_memset(hitPoint, 0, iSize); 874 FXSYS_memset(hitPoint, 0, iSize);
914 FX_FLOAT fxPiece = rtWidget.width / FWL_NEEDREPAINTHIT_Piece; 875 FX_FLOAT fxPiece = rtWidget.width / FWL_NEEDREPAINTHIT_Piece;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 CFX_RectF temp(m_pWidgetMgr->m_rtScreen); 961 CFX_RectF temp(m_pWidgetMgr->m_rtScreen);
1001 temp.Deflate(50, 50); 962 temp.Deflate(50, 50);
1002 if (!temp.Contains(r)) { 963 if (!temp.Contains(r)) {
1003 return FALSE; 964 return FALSE;
1004 } 965 }
1005 pItem->bOutsideChanged = FALSE; 966 pItem->bOutsideChanged = FALSE;
1006 } 967 }
1007 #endif 968 #endif
1008 return pItem->iRedrawCounter == 0; 969 return pItem->iRedrawCounter == 0;
1009 } 970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698