From 6f4f2335cfd22d26db154fbd51ab553fb9902918 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 6 Jun 2016 13:23:55 -0700 Subject: Remove FWL_HTIMER in favor of IWFL_TimerInfo Review-Url: https://codereview.chromium.org/2037573003 --- xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'xfa/fwl/basewidget/fwl_spinbuttonimp.cpp') diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 25c8a35983..4eddce7439 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -52,7 +52,7 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp( m_dwDnState(CFWL_PartState_Normal), m_iButtonIndex(0), m_bLButtonDwn(FALSE), - m_hTimer(NULL) { + m_pTimerInfo(nullptr) { m_rtClient.Reset(); m_rtUpButton.Reset(); m_rtDnButton.Reset(); @@ -133,7 +133,7 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, if (!pGraphics) return FWL_Error::Indefinite; CFX_RectF rtClip(m_rtClient); - if (pMatrix != NULL) { + if (pMatrix) { pMatrix->TransformRect(rtClip); } IFWL_ThemeProvider* pTheme = GetAvailableTheme(); @@ -147,15 +147,17 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, DrawDownButton(pGraphics, pTheme, pMatrix); return FWL_Error::Succeeded; } -int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { - if (m_hTimer) { - CFWL_EvtSpbClick wmPosChanged; - wmPosChanged.m_pSrcTarget = m_pInterface; - wmPosChanged.m_bUp = m_iButtonIndex == 0; - DispatchEvent(&wmPosChanged); - } - return 1; + +void CFWL_SpinButtonImp::Run(IFWL_TimerInfo* pTimerInfo) { + if (!m_pTimerInfo) + return; + + CFWL_EvtSpbClick wmPosChanged; + wmPosChanged.m_pSrcTarget = m_pInterface; + wmPosChanged.m_bUp = m_iButtonIndex == 0; + DispatchEvent(&wmPosChanged); } + FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { if (bUp) { if (bEnable) { @@ -305,8 +307,9 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->DispatchEvent(&wmPosChanged); m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton : &m_pOwner->m_rtDnButton); - m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, kElapseTime); + m_pOwner->m_pTimerInfo = m_pOwner->StartTimer(kElapseTime, true); } + void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) { return; @@ -314,9 +317,9 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { m_pOwner->m_bLButtonDwn = FALSE; m_pOwner->SetGrab(FALSE); m_pOwner->SetFocus(FALSE); - if (m_pOwner->m_hTimer) { - FWL_StopTimer(m_pOwner->m_hTimer); - m_pOwner->m_hTimer = NULL; + if (m_pOwner->m_pTimerInfo) { + m_pOwner->m_pTimerInfo->StopTimer(); + m_pOwner->m_pTimerInfo = nullptr; } FX_BOOL bRepaint = FALSE; CFX_RectF rtInvalidate; -- cgit v1.2.3