diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-21 14:27:59 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-21 20:44:29 +0000 |
commit | b45ea1fce52d93615470bab8b671cba5907fb01e (patch) | |
tree | 15153c437a253f73b3f5bb154a294ace77fe2c6d /xfa/fwl/cfwl_monthcalendar.cpp | |
parent | 37a35df8c878d6e21a62ce0dfd2d480997d9e86c (diff) | |
download | pdfium-b45ea1fce52d93615470bab8b671cba5907fb01e.tar.xz |
Convert CFWL messages to use CFX_PointF
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of
x,y values.
Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1
Reviewed-on: https://pdfium-review.googlesource.com/2811
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_monthcalendar.cpp')
-rw-r--r-- | xfa/fwl/cfwl_monthcalendar.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 32336913bf..6882d709bf 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -691,10 +691,10 @@ CFX_WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear, return wsToday; } -int32_t CFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { +int32_t CFWL_MonthCalendar::GetDayAtPoint(const CFX_PointF& point) const { int i = 1; // one-based day values. for (const auto& pDateInfo : m_arrDates) { - if (pDateInfo->rect.Contains(x, y)) + if (pDateInfo->rect.Contains(point)) return i; ++i; } @@ -752,15 +752,15 @@ void CFWL_MonthCalendar::OnDrawWidget(CFX_Graphics* pGraphics, } void CFWL_MonthCalendar::OnLButtonDown(CFWL_MessageMouse* pMsg) { - if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (m_rtLBtn.Contains(pMsg->m_pos)) { m_iLBtnPartStates = CFWL_PartState_Pressed; PrevMonth(); RepaintRect(m_rtClient); - } else if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + } else if (m_rtRBtn.Contains(pMsg->m_pos)) { m_iRBtnPartStates |= CFWL_PartState_Pressed; NextMonth(); RepaintRect(m_rtClient); - } else if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) { + } else if (m_rtToday.Contains(pMsg->m_pos)) { JumpToToday(); RepaintRect(m_rtClient); } else { @@ -774,24 +774,24 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) { if (m_pWidgetMgr->IsFormDisabled()) return DisForm_OnLButtonUp(pMsg); - if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (m_rtLBtn.Contains(pMsg->m_pos)) { m_iLBtnPartStates = 0; RepaintRect(m_rtLBtn); return; } - if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (m_rtRBtn.Contains(pMsg->m_pos)) { m_iRBtnPartStates = 0; RepaintRect(m_rtRBtn); return; } - if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) + if (m_rtToday.Contains(pMsg->m_pos)) return; int32_t iOldSel = 0; if (!m_arrSelDays.empty()) iOldSel = m_arrSelDays[0]; - int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); + int32_t iCurSel = GetDayAtPoint(pMsg->m_pos); CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter); if (iCurSel > 0) { DATEINFO* lpDatesInfo = m_arrDates[iCurSel - 1].get(); @@ -808,31 +808,31 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) { pIPicker->ShowMonthCalendar(false); } else if (m_bFlag && (!CFX_RectF(0, 0, pIPicker->GetFormProxy()->GetWidgetRect().Size()) - .Contains(pMsg->m_fx, pMsg->m_fy))) { + .Contains(pMsg->m_pos))) { pIPicker->ShowMonthCalendar(false); } m_bFlag = false; } void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MessageMouse* pMsg) { - if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (m_rtLBtn.Contains(pMsg->m_pos)) { m_iLBtnPartStates = 0; RepaintRect(m_rtLBtn); return; } - if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (m_rtRBtn.Contains(pMsg->m_pos)) { m_iRBtnPartStates = 0; RepaintRect(m_rtRBtn); return; } - if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) + if (m_rtToday.Contains(pMsg->m_pos)) return; int32_t iOldSel = 0; if (!m_arrSelDays.empty()) iOldSel = m_arrSelDays[0]; - int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); + int32_t iCurSel = GetDayAtPoint(pMsg->m_pos); if (iCurSel > 0) { DATEINFO* lpDatesInfo = m_arrDates[iCurSel - 1].get(); CFX_RectF rtInvalidate(lpDatesInfo->rect); @@ -851,8 +851,8 @@ void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MessageMouse* pMsg) { void CFWL_MonthCalendar::OnMouseMove(CFWL_MessageMouse* pMsg) { bool bRepaint = false; CFX_RectF rtInvalidate; - if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { - int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); + if (m_rtDates.Contains(pMsg->m_pos)) { + int32_t iHover = GetDayAtPoint(pMsg->m_pos); bRepaint = m_iHovered != iHover; if (bRepaint) { if (m_iHovered > 0) |