diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-31 07:29:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-31 07:29:34 -0700 |
commit | 20855384b8149a631c3c1d229551523c12eb767b (patch) | |
tree | e3cef278e322742bea6c4b48f40ed580754ebd80 /xfa/fwl/core/ifwl_scrollbar.cpp | |
parent | 747dcf775c5cb661e96a639f73322cc489d8590f (diff) | |
download | pdfium-20855384b8149a631c3c1d229551523c12eb767b.tar.xz |
Remove FWL globals.
This CL removes the FWL_GetApp, FWL_SetApp and FWL_GetWidgetAdapter methods.
In the process it changes the various Initialize methods to return void.
Review-Url: https://codereview.chromium.org/2436103002
Diffstat (limited to 'xfa/fwl/core/ifwl_scrollbar.cpp')
-rw-r--r-- | xfa/fwl/core/ifwl_scrollbar.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index a8e277324f..27a131f45d 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -16,9 +16,10 @@ #define FWL_SCROLLBAR_Elapse 500 #define FWL_SCROLLBAR_MinThumb 5 -IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, +IFWL_ScrollBar::IFWL_ScrollBar(const IFWL_App* app, + const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) - : IFWL_Widget(properties, pOuter), + : IFWL_Widget(app, properties, pOuter), m_pTimerInfo(nullptr), m_fRangeMin(0), m_fRangeMax(-1), @@ -42,7 +43,8 @@ IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, m_fButtonLen(0), m_bMinSize(FALSE), m_bCustomLayout(false), - m_fMinThumb(FWL_SCROLLBAR_MinThumb) { + m_fMinThumb(FWL_SCROLLBAR_MinThumb), + m_Timer(this) { m_rtClient.Reset(); m_rtThumb.Reset(); m_rtMinBtn.Reset(); @@ -53,16 +55,9 @@ IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, IFWL_ScrollBar::~IFWL_ScrollBar() {} -FWL_Type IFWL_ScrollBar::GetClassID() const { - return FWL_Type::ScrollBar; -} - -FWL_Error IFWL_ScrollBar::Initialize() { - if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) - return FWL_Error::Indefinite; - +void IFWL_ScrollBar::Initialize() { + IFWL_Widget::Initialize(); m_pDelegate = new CFWL_ScrollBarImpDelegate(this); - return FWL_Error::Succeeded; } void IFWL_ScrollBar::Finalize() { @@ -71,6 +66,10 @@ void IFWL_ScrollBar::Finalize() { IFWL_Widget::Finalize(); } +FWL_Type IFWL_ScrollBar::GetClassID() const { + return FWL_Type::ScrollBar; +} + FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); @@ -196,14 +195,6 @@ FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { return OnScroll(dwCode, fPos); } -void IFWL_ScrollBar::Run(IFWL_TimerInfo* pTimerInfo) { - if (m_pTimerInfo) - m_pTimerInfo->StopTimer(); - - if (!SendEvent()) - m_pTimerInfo = StartTimer(0, true); -} - FWL_Error IFWL_ScrollBar::SetOuter(IFWL_Widget* pOuter) { m_pOuter = pOuter; return FWL_Error::Succeeded; @@ -660,7 +651,8 @@ void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, } } if (!m_pOwner->SendEvent()) - m_pOwner->m_pTimerInfo = m_pOwner->StartTimer(FWL_SCROLLBAR_Elapse, true); + m_pOwner->m_pTimerInfo = + m_pOwner->m_Timer.StartTimer(FWL_SCROLLBAR_Elapse, true); } void CFWL_ScrollBarImpDelegate::OnLButtonUp(uint32_t dwFlags, @@ -774,3 +766,15 @@ void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, iState = CFWL_PartState_Hovered; m_pOwner->Repaint(&rtItem); } + +IFWL_ScrollBar::Timer::Timer(IFWL_ScrollBar* pToolTip) : IFWL_Timer(pToolTip) {} + +void IFWL_ScrollBar::Timer::Run(IFWL_TimerInfo* pTimerInfo) { + IFWL_ScrollBar* pButton = static_cast<IFWL_ScrollBar*>(m_pWidget); + + if (pButton->m_pTimerInfo) + pButton->m_pTimerInfo->StopTimer(); + + if (!pButton->SendEvent()) + pButton->m_pTimerInfo = StartTimer(0, true); +} |