From 4614b45a6592530c4cd930f139c366ce20d359f4 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 7 Dec 2016 17:01:58 -0800 Subject: 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 --- xfa/fwl/core/cfwl_listbox.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'xfa/fwl/core/cfwl_listbox.cpp') diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index dff981f283..be9e8b9395 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -772,15 +772,14 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { if (!IsEnabled()) return; - CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - switch (dwMsgCode) { - case CFWL_MessageType::SetFocus: + switch (pMessage->GetType()) { + case CFWL_Message::Type::SetFocus: OnFocusChanged(pMessage, true); break; - case CFWL_MessageType::KillFocus: + case CFWL_Message::Type::KillFocus: OnFocusChanged(pMessage, false); break; - case CFWL_MessageType::Mouse: { + case CFWL_Message::Type::Mouse: { CFWL_MsgMouse* pMsg = static_cast(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -794,10 +793,10 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { } break; } - case CFWL_MessageType::MouseWheel: + case CFWL_Message::Type::MouseWheel: OnMouseWheel(static_cast(pMessage)); break; - case CFWL_MessageType::Key: { + case CFWL_Message::Type::Key: { CFWL_MsgKey* pMsg = static_cast(pMessage); if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown) OnKeyDown(pMsg); @@ -812,7 +811,7 @@ void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { void CFWL_ListBox::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) return; - if (pEvent->GetClassID() != CFWL_EventType::Scroll) + if (pEvent->GetType() != CFWL_Event::Type::Scroll) return; CFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; @@ -949,50 +948,50 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) { } bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar, - FWL_SCBCODE dwCode, + CFWL_EvtScroll::Code dwCode, FX_FLOAT fPos) { CFX_SizeF fs; pScrollBar->GetRange(&fs.x, &fs.y); FX_FLOAT iCurPos = pScrollBar->GetPos(); FX_FLOAT fStep = pScrollBar->GetStepSize(); switch (dwCode) { - case FWL_SCBCODE::Min: { + case CFWL_EvtScroll::Code::Min: { fPos = fs.x; break; } - case FWL_SCBCODE::Max: { + case CFWL_EvtScroll::Code::Max: { fPos = fs.y; break; } - case FWL_SCBCODE::StepBackward: { + case CFWL_EvtScroll::Code::StepBackward: { fPos -= fStep; if (fPos < fs.x + fStep / 2) fPos = fs.x; break; } - case FWL_SCBCODE::StepForward: { + case CFWL_EvtScroll::Code::StepForward: { fPos += fStep; if (fPos > fs.y - fStep / 2) fPos = fs.y; break; } - case FWL_SCBCODE::PageBackward: { + case CFWL_EvtScroll::Code::PageBackward: { fPos -= pScrollBar->GetPageSize(); if (fPos < fs.x) fPos = fs.x; break; } - case FWL_SCBCODE::PageForward: { + case CFWL_EvtScroll::Code::PageForward: { fPos += pScrollBar->GetPageSize(); if (fPos > fs.y) fPos = fs.y; break; } - case FWL_SCBCODE::Pos: - case FWL_SCBCODE::TrackPos: - case FWL_SCBCODE::None: + case CFWL_EvtScroll::Code::Pos: + case CFWL_EvtScroll::Code::TrackPos: + case CFWL_EvtScroll::Code::None: break; - case FWL_SCBCODE::EndScroll: + case CFWL_EvtScroll::Code::EndScroll: return false; } if (iCurPos != fPos) { -- cgit v1.2.3