From d15ba4e29607665db35bc6fb610cc566981b324a Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 29 Apr 2016 09:45:46 -0700 Subject: Replace CFX_PtryArray with typesafe CFX_ArrayTemplate, Part 7 Remaining uses are all in fxbarcode/. Review-Url: https://codereview.chromium.org/1937453002 --- xfa/fwl/core/fwl_formimp.cpp | 36 ++++++++++++++++++------------------ xfa/fwl/core/fwl_widgetimp.cpp | 4 ++-- xfa/fwl/core/fwl_widgetmgrimp.cpp | 5 +++-- xfa/fwl/core/fwl_widgetmgrimp.h | 3 ++- 4 files changed, 25 insertions(+), 23 deletions(-) (limited to 'xfa/fwl/core') diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 2fd85a8d0e..bbec673ed6 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -526,32 +526,32 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { return NULL; } CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { - if (nIndex < 0) { - return NULL; - } - CFX_PtrArray arrBtn; - if (m_pMinBox) { + if (nIndex < 0) + return nullptr; + + CFX_ArrayTemplate arrBtn; + if (m_pMinBox) arrBtn.Add(m_pMinBox); - } - if (m_pMaxBox) { + + if (m_pMaxBox) arrBtn.Add(m_pMaxBox); - } - if (m_pCloseBox) { + + if (m_pCloseBox) arrBtn.Add(m_pCloseBox); - } - return static_cast(arrBtn[nIndex]); + + return arrBtn[nIndex]; } int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) { - CFX_PtrArray arrBtn; - if (m_pMinBox) { + CFX_ArrayTemplate arrBtn; + if (m_pMinBox) arrBtn.Add(m_pMinBox); - } - if (m_pMaxBox) { + + if (m_pMaxBox) arrBtn.Add(m_pMaxBox); - } - if (m_pCloseBox) { + + if (m_pCloseBox) arrBtn.Add(m_pCloseBox); - } + return arrBtn.Find(pBtn); } FX_FLOAT CFWL_FormImp::GetCaptionHeight() { diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index c9d91c41f2..38516c6557 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -473,7 +473,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { return FWL_ERR_Indefinite; if (bGlobal) { IFWL_Widget* parent = GetParent(); - CFX_PtrArray parents; + CFX_ArrayTemplate parents; while (parent) { parents.Add(parent); parent = parent->GetParent(); @@ -483,7 +483,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { CFX_RectF rect; int32_t count = parents.GetSize(); for (int32_t i = count - 2; i >= 0; i--) { - parent = static_cast(parents.GetAt(i)); + parent = parents.GetAt(i); parent->GetMatrix(ctmOnParent, FALSE); parent->GetWidgetRect(rect); matrix.Concat(ctmOnParent, TRUE); diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index 0ce452edb0..02b63862e5 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -564,8 +564,9 @@ IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( } return GetSiblingRadioButton(pNext, TRUE); } -void CFWL_WidgetMgr::GetSameGroupRadioButton(IFWL_Widget* pRadioButton, - CFX_PtrArray& group) { +void CFWL_WidgetMgr::GetSameGroupRadioButton( + IFWL_Widget* pRadioButton, + CFX_ArrayTemplate& group) { IFWL_Widget* pFirst = GetWidget(pRadioButton, FWL_WGTRELATION_FirstSibling); if (!pFirst) { pFirst = pRadioButton; diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h index 528ecdb792..0b4e2bf79d 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.h +++ b/xfa/fwl/core/fwl_widgetmgrimp.h @@ -112,7 +112,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { int32_t CountRadioButtonGroup(IFWL_Widget* pFirst); IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext); IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton); - void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, CFX_PtrArray& group); + void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, + CFX_ArrayTemplate& group); IFWL_Widget* GetDefaultButton(IFWL_Widget* pParent); void AddRedrawCounts(IFWL_Widget* pWidget); void ResetRedrawCounts(IFWL_Widget* pWidget); -- cgit v1.2.3