From 603f57b85c0643f0598f03b97c4525501f3e1221 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 14 Dec 2016 06:25:02 -0800 Subject: Update CFWL_ListBox to return instead of using out params. This CL updates the CFWL_ListBox code to work with return values instead of out params. This also extracts the CFWL_ListItem code out of CFWL_ListBox and puts into the correct class. Review-Url: https://codereview.chromium.org/2572783002 --- xfa/fxfa/app/xfa_ffchoicelist.cpp | 6 +++--- xfa/fxfa/app/xfa_fftextedit.cpp | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index d19fd6876b..2764d725af 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -104,7 +104,7 @@ bool CXFA_FFListBox::IsDataChanged() { for (int32_t i = 0; i < iSels; ++i) { CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]); - if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected)) + if (!(hlistItem->GetStates() & FWL_ITEMSTATE_LTB_Selected)) return true; } return false; @@ -163,8 +163,8 @@ void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget, CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; int32_t iSels = pListBox->CountSelItems(); if (iSels > 0) { - eParam.m_wsNewText = - pListBox->GetItemText(nullptr, pListBox->GetSelItem(0)); + CFWL_ListItem* item = pListBox->GetSelItem(0); + eParam.m_wsNewText = item ? item->GetText() : L""; } m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 50b087315d..74bd99a55d 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -505,16 +505,12 @@ bool CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox, } bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { - return false; - } - CFX_RectF rtWidget; - ((CFWL_DateTimePicker*)m_pNormalWidget)->GetBBox(rtWidget); - if (rtWidget.Contains(fx, fy)) { - return true; - } - return false; + return m_pNormalWidget && + static_cast(m_pNormalWidget) + ->GetBBox() + .Contains(fx, fy); } + bool CXFA_FFDateTimeEdit::LoadWidget() { CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); m_pNormalWidget = pWidget; -- cgit v1.2.3