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

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: 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 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 IFWL_WidgetMgr* IFWL_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();
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, 408 void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm,
410 FX_FLOAT fx, 409 FX_FLOAT fx,
411 FX_FLOAT fy) { 410 FX_FLOAT fy) {
412 if (FWL_UseOffscreen(pForm)) 411 if (FWL_UseOffscreen(pForm))
413 GetWidgetMgrItem(pForm)->pOffscreen.reset(); 412 GetWidgetMgrItem(pForm)->pOffscreen.reset();
414 } 413 }
415 414
416 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, 415 IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent,
417 IFWL_Widget* focus, 416 IFWL_Widget* focus,
418 FX_BOOL& bFind) { 417 FX_BOOL& bFind) {
419 IFWL_Widget* child = 418 IFWL_Widget* child = IFWL_WidgetMgr::GetInstance()->GetWidget(
420 FWL_GetWidgetMgr()->GetWidget(parent, FWL_WGTRELATION_FirstChild); 419 parent, FWL_WGTRELATION_FirstChild);
421 while (child) { 420 while (child) {
422 if (focus == child) { 421 if (focus == child) {
423 bFind = TRUE; 422 bFind = TRUE;
424 } 423 }
425 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && 424 if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) &&
426 (!focus || (focus != child && bFind))) { 425 (!focus || (focus != child && bFind))) {
427 return child; 426 return child;
428 } 427 }
429 IFWL_Widget* bRet = nextTab(child, focus, bFind); 428 IFWL_Widget* bRet = nextTab(child, focus, bFind);
430 if (bRet) { 429 if (bRet) {
431 return bRet; 430 return bRet;
432 } 431 }
433 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 432 child = IFWL_WidgetMgr::GetInstance()->GetWidget(
433 child, FWL_WGTRELATION_NextSibling);
434 } 434 }
435 return NULL; 435 return NULL;
436 } 436 }
437 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { 437 int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) {
438 int32_t iRet = 0; 438 int32_t iRet = 0;
439 IFWL_Widget* pChild = pFirst; 439 IFWL_Widget* pChild = pFirst;
440 while (pChild) 440 while (pChild)
441 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling); 441 pChild = GetWidget(pChild, FWL_WGTRELATION_NextSibling);
442 return iRet; 442 return iRet;
443 } 443 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 pNext = GetSiblingRadioButton(pNext, TRUE); 483 pNext = GetSiblingRadioButton(pNext, TRUE);
484 if (!pNext) 484 if (!pNext)
485 pNext = GetSiblingRadioButton(pFirst, TRUE); 485 pNext = GetSiblingRadioButton(pFirst, TRUE);
486 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); 486 } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0));
487 } 487 }
488 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { 488 IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) {
489 if ((pParent->GetClassID() == FWL_Type::PushButton) && 489 if ((pParent->GetClassID() == FWL_Type::PushButton) &&
490 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 490 (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
491 return pParent; 491 return pParent;
492 } 492 }
493 IFWL_Widget* child = 493 IFWL_Widget* child = IFWL_WidgetMgr::GetInstance()->GetWidget(
494 FWL_GetWidgetMgr()->GetWidget(pParent, FWL_WGTRELATION_FirstChild); 494 pParent, FWL_WGTRELATION_FirstChild);
495 while (child) { 495 while (child) {
496 if ((child->GetClassID() == FWL_Type::PushButton) && 496 if ((child->GetClassID() == FWL_Type::PushButton) &&
497 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { 497 (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) {
498 return child; 498 return child;
499 } 499 }
500 IFWL_Widget* find = GetDefaultButton(child); 500 IFWL_Widget* find = GetDefaultButton(child);
501 if (find) { 501 if (find) {
502 return find; 502 return find;
503 } 503 }
504 child = FWL_GetWidgetMgr()->GetWidget(child, FWL_WGTRELATION_NextSibling); 504 child = IFWL_WidgetMgr::GetInstance()->GetWidget(
505 child, FWL_WGTRELATION_NextSibling);
505 } 506 }
506 return NULL; 507 return NULL;
507 } 508 }
508 void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) { 509 void CFWL_WidgetMgr::AddRedrawCounts(IFWL_Widget* pWidget) {
509 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 510 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
510 (pItem->iRedrawCounter)++; 511 (pItem->iRedrawCounter)++;
511 } 512 }
512 void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) { 513 void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) {
513 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); 514 CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
514 pItem->iRedrawCounter = 0; 515 pItem->iRedrawCounter = 0;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 pItem->iRedrawCounter = 0; 769 pItem->iRedrawCounter = 0;
769 return TRUE; 770 return TRUE;
770 } 771 }
771 CFX_RectF rtWidget; 772 CFX_RectF rtWidget;
772 pWidget->GetWidgetRect(rtWidget); 773 pWidget->GetWidgetRect(rtWidget);
773 rtWidget.left = rtWidget.top = 0; 774 rtWidget.left = rtWidget.top = 0;
774 pMatrix->TransformRect(rtWidget); 775 pMatrix->TransformRect(rtWidget);
775 if (!rtWidget.IntersectWith(rtDirty)) 776 if (!rtWidget.IntersectWith(rtDirty))
776 return FALSE; 777 return FALSE;
777 778
778 IFWL_Widget* pChild = 779 IFWL_Widget* pChild = IFWL_WidgetMgr::GetInstance()->GetWidget(
779 FWL_GetWidgetMgr()->GetWidget(pWidget, FWL_WGTRELATION_FirstChild); 780 pWidget, FWL_WGTRELATION_FirstChild);
780 if (!pChild) 781 if (!pChild)
781 return TRUE; 782 return TRUE;
782 783
783 CFX_RectF rtChilds; 784 CFX_RectF rtChilds;
784 rtChilds.Empty(); 785 rtChilds.Empty();
785 FX_BOOL bChildIntersectWithDirty = FALSE; 786 FX_BOOL bChildIntersectWithDirty = FALSE;
786 FX_BOOL bOrginPtIntersectWidthChild = FALSE; 787 FX_BOOL bOrginPtIntersectWidthChild = FALSE;
787 FX_BOOL bOrginPtIntersectWidthDirty = 788 FX_BOOL bOrginPtIntersectWidthDirty =
788 rtDirty.Contains(rtWidget.left, rtWidget.top); 789 rtDirty.Contains(rtWidget.left, rtWidget.top);
789 static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; 790 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++) { 829 for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) {
829 if (hitPoint[i].bNotContainByDirty || hitPoint[i].bNotNeedRepaint) 830 if (hitPoint[i].bNotContainByDirty || hitPoint[i].bNotNeedRepaint)
830 continue; 831 continue;
831 if (!rtDirty.Contains(hitPoint[i].hitPoint)) { 832 if (!rtDirty.Contains(hitPoint[i].hitPoint)) {
832 hitPoint[i].bNotContainByDirty = true; 833 hitPoint[i].bNotContainByDirty = true;
833 continue; 834 continue;
834 } 835 }
835 if (r.Contains(hitPoint[i].hitPoint)) 836 if (r.Contains(hitPoint[i].hitPoint))
836 hitPoint[i].bNotNeedRepaint = true; 837 hitPoint[i].bNotNeedRepaint = true;
837 } 838 }
838 } while ((pChild = FWL_GetWidgetMgr()->GetWidget( 839 } while ((pChild = IFWL_WidgetMgr::GetInstance()->GetWidget(
839 pChild, FWL_WGTRELATION_NextSibling)) != NULL); 840 pChild, FWL_WGTRELATION_NextSibling)) != NULL);
840 841
841 if (!bChildIntersectWithDirty) 842 if (!bChildIntersectWithDirty)
842 return TRUE; 843 return TRUE;
843 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) 844 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild)
844 return TRUE; 845 return TRUE;
845 if (rtChilds.IsEmpty()) 846 if (rtChilds.IsEmpty())
846 return TRUE; 847 return TRUE;
847 848
848 int32_t repaintPoint = kNeedRepaintHitPoints; 849 int32_t repaintPoint = kNeedRepaintHitPoints;
(...skipping 23 matching lines...) Expand all
872 temp.Deflate(50, 50); 873 temp.Deflate(50, 50);
873 if (!temp.Contains(r)) 874 if (!temp.Contains(r))
874 return FALSE; 875 return FALSE;
875 876
876 pItem->bOutsideChanged = FALSE; 877 pItem->bOutsideChanged = FALSE;
877 } 878 }
878 #endif 879 #endif
879 880
880 return pItem->iRedrawCounter == 0; 881 return pItem->iRedrawCounter == 0;
881 } 882 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698