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/fxfa/app/xfa_fftextedit.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/fxfa/app/xfa_fftextedit.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index ad5ab434c6..094839f486 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -103,58 +103,53 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); } -bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - if (!PtInActiveRect(fx, fy)) { + +bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (!PtInActiveRect(point)) return false; - } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { + +bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) return false; - } - if (!PtInActiveRect(fx, fy)) { + if (!PtInActiveRect(point)) return false; - } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, nullptr); ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) + +bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!CXFA_FFField::OnRButtonUp(dwFlags, point)) return false; - GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); + GetDoc()->GetDocEnvironment()->PopupMenu(this, point); return true; } + bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; if (!IsFocused()) { @@ -499,11 +494,11 @@ CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return CXFA_FFWidget::GetBBox(dwStatus); } -bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFDateTimeEdit::PtInActiveRect(const CFX_PointF& point) { return m_pNormalWidget && static_cast<CFWL_DateTimePicker*>(m_pNormalWidget) ->GetBBox() - .Contains(fx, fy); + .Contains(point); } bool CXFA_FFDateTimeEdit::LoadWidget() { |