diff options
author | dsinclair <dsinclair@chromium.org> | 2016-12-07 17:01:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-07 17:01:58 -0800 |
commit | 4614b45a6592530c4cd930f139c366ce20d359f4 (patch) | |
tree | 72a6098a19945cfbdf0877e6e2ba02323ebde33f /xfa/fwl/core/cfwl_scrollbar.cpp | |
parent | 248cb27e64b3a25230f53fc2f4ab9d483facc5f9 (diff) | |
download | pdfium-4614b45a6592530c4cd930f139c366ce20d359f4.tar.xz |
Cleanup FWL Event and Message code.
This CL removes any CFWL_Evt classes for which nothing was listening to the
events. For events with no parameters the override class was removed and
the event type passed into CFWL_Event which is used instead. Any event or
message parameters which are un-read have been removed.
Review-Url: https://codereview.chromium.org/2530993002
Diffstat (limited to 'xfa/fwl/core/cfwl_scrollbar.cpp')
-rw-r--r-- | xfa/fwl/core/cfwl_scrollbar.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/xfa/fwl/core/cfwl_scrollbar.cpp b/xfa/fwl/core/cfwl_scrollbar.cpp index 6647350ef2..490940491c 100644 --- a/xfa/fwl/core/cfwl_scrollbar.cpp +++ b/xfa/fwl/core/cfwl_scrollbar.cpp @@ -115,8 +115,8 @@ void CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { CalcMaxTrackRect(m_rtMaxTrack); } -bool CFWL_ScrollBar::DoScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) { - if (dwCode == FWL_SCBCODE::None) +bool CFWL_ScrollBar::DoScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { + if (dwCode == CFWL_EvtScroll::Code::None) return false; return OnScroll(dwCode, fPos); } @@ -351,46 +351,44 @@ void CFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, bool bLower) { bool CFWL_ScrollBar::SendEvent() { if (m_iMinButtonState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::StepBackward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::StepBackward, m_fTrackPos); return false; } if (m_iMaxButtonState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::StepForward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::StepForward, m_fTrackPos); return false; } if (m_iMinTrackState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::PageBackward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::PageBackward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMaxTrackState == CFWL_PartState_Pressed) { - DoScroll(FWL_SCBCODE::PageForward, m_fTrackPos); + DoScroll(CFWL_EvtScroll::Code::PageForward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMouseWheel) { - FWL_SCBCODE dwCode = m_iMouseWheel < 0 ? FWL_SCBCODE::StepForward - : FWL_SCBCODE::StepBackward; + CFWL_EvtScroll::Code dwCode = m_iMouseWheel < 0 + ? CFWL_EvtScroll::Code::StepForward + : CFWL_EvtScroll::Code::StepBackward; DoScroll(dwCode, m_fTrackPos); } return true; } -bool CFWL_ScrollBar::OnScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) { - bool bRet = true; - CFWL_EvtScroll ev; +bool CFWL_ScrollBar::OnScroll(CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { + CFWL_EvtScroll ev(this); ev.m_iScrollCode = dwCode; - ev.m_pSrcTarget = this; ev.m_fPos = fPos; - ev.m_pRet = &bRet; DispatchEvent(&ev); - return bRet; + return true; } void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - if (dwMsgCode == CFWL_MessageType::Mouse) { + CFWL_Message::Type type = pMessage->GetType(); + if (type == CFWL_Message::Type::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -408,7 +406,7 @@ void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - } else if (dwMsgCode == CFWL_MessageType::MouseWheel) { + } else if (type == CFWL_Message::Type::MouseWheel) { CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage); OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, pMsg->m_fDeltaY); @@ -507,7 +505,7 @@ void CFWL_ScrollBar::DoMouseUp(int32_t iItem, iState = iNewState; Repaint(&rtItem); - OnScroll(FWL_SCBCODE::EndScroll, m_fTrackPos); + OnScroll(CFWL_EvtScroll::Code::EndScroll, m_fTrackPos); } void CFWL_ScrollBar::DoMouseMove(int32_t iItem, @@ -526,7 +524,7 @@ void CFWL_ScrollBar::DoMouseMove(int32_t iItem, } else if ((2 == iItem) && (m_iThumbButtonState == CFWL_PartState_Pressed)) { FX_FLOAT fPos = GetTrackPointPos(fx, fy); m_fTrackPos = fPos; - OnScroll(FWL_SCBCODE::TrackPos, fPos); + OnScroll(CFWL_EvtScroll::Code::TrackPos, fPos); } } |