summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_scrollbar.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-10 11:01:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-10 11:01:16 -0800
commit3e577c2660c89646b56753839c1ec59c3ad187f4 (patch)
tree9b35b8cedcc885230ec521473ef2a3c9b5aaa6c6 /xfa/fwl/core/ifwl_scrollbar.cpp
parentf3480661a20c259581e7c100b0d5d06950a9559b (diff)
downloadpdfium-3e577c2660c89646b56753839c1ec59c3ad187f4.tar.xz
Convert FWL_SCBCODE to an enum class
This Cl changes the enum into an enum class and updates calling code to pass the enum instead of a uint32_t Review-Url: https://codereview.chromium.org/2482253004
Diffstat (limited to 'xfa/fwl/core/ifwl_scrollbar.cpp')
-rw-r--r--xfa/fwl/core/ifwl_scrollbar.cpp36
1 files changed, 12 insertions, 24 deletions
diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp
index 3dc38efa69..c651abecb1 100644
--- a/xfa/fwl/core/ifwl_scrollbar.cpp
+++ b/xfa/fwl/core/ifwl_scrollbar.cpp
@@ -113,21 +113,9 @@ void IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
CalcMaxTrackRect(m_rtMaxTrack);
}
-bool IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
- switch (dwCode) {
- case FWL_SCBCODE_Min:
- case FWL_SCBCODE_Max:
- case FWL_SCBCODE_PageBackward:
- case FWL_SCBCODE_PageForward:
- case FWL_SCBCODE_StepBackward:
- case FWL_SCBCODE_StepForward:
- case FWL_SCBCODE_Pos:
- case FWL_SCBCODE_TrackPos:
- case FWL_SCBCODE_EndScroll:
- break;
- default:
- return false;
- }
+bool IFWL_ScrollBar::DoScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) {
+ if (dwCode == FWL_SCBCODE::None)
+ return false;
return OnScroll(dwCode, fPos);
}
@@ -474,30 +462,30 @@ void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, bool bLower) {
bool IFWL_ScrollBar::SendEvent() {
if (m_iMinButtonState == CFWL_PartState_Pressed) {
- DoScroll(FWL_SCBCODE_StepBackward, m_fTrackPos);
+ DoScroll(FWL_SCBCODE::StepBackward, m_fTrackPos);
return false;
}
if (m_iMaxButtonState == CFWL_PartState_Pressed) {
- DoScroll(FWL_SCBCODE_StepForward, m_fTrackPos);
+ DoScroll(FWL_SCBCODE::StepForward, m_fTrackPos);
return false;
}
if (m_iMinTrackState == CFWL_PartState_Pressed) {
- DoScroll(FWL_SCBCODE_PageBackward, m_fTrackPos);
+ DoScroll(FWL_SCBCODE::PageBackward, m_fTrackPos);
return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY);
}
if (m_iMaxTrackState == CFWL_PartState_Pressed) {
- DoScroll(FWL_SCBCODE_PageForward, m_fTrackPos);
+ DoScroll(FWL_SCBCODE::PageForward, m_fTrackPos);
return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY);
}
if (m_iMouseWheel) {
- uint16_t dwCode =
- m_iMouseWheel < 0 ? FWL_SCBCODE_StepForward : FWL_SCBCODE_StepBackward;
+ FWL_SCBCODE dwCode = m_iMouseWheel < 0 ? FWL_SCBCODE::StepForward
+ : FWL_SCBCODE::StepBackward;
DoScroll(dwCode, m_fTrackPos);
}
return true;
}
-bool IFWL_ScrollBar::OnScroll(uint32_t dwCode, FX_FLOAT fPos) {
+bool IFWL_ScrollBar::OnScroll(FWL_SCBCODE dwCode, FX_FLOAT fPos) {
bool bRet = true;
CFWL_EvtScroll ev;
ev.m_iScrollCode = dwCode;
@@ -629,7 +617,7 @@ void IFWL_ScrollBar::DoMouseUp(int32_t iItem,
iState = iNewState;
Repaint(&rtItem);
- OnScroll(FWL_SCBCODE_EndScroll, m_fTrackPos);
+ OnScroll(FWL_SCBCODE::EndScroll, m_fTrackPos);
}
void IFWL_ScrollBar::DoMouseMove(int32_t iItem,
@@ -648,7 +636,7 @@ void IFWL_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(FWL_SCBCODE::TrackPos, fPos);
}
}