summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-21 14:27:59 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-21 20:44:29 +0000
commitb45ea1fce52d93615470bab8b671cba5907fb01e (patch)
tree15153c437a253f73b3f5bb154a294ace77fe2c6d /xfa
parent37a35df8c878d6e21a62ce0dfd2d480997d9e86c (diff)
downloadpdfium-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')
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp14
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp6
-rw-r--r--xfa/fwl/cfwl_combobox.cpp22
-rw-r--r--xfa/fwl/cfwl_combobox.h4
-rw-r--r--xfa/fwl/cfwl_comboboxproxy.cpp6
-rw-r--r--xfa/fwl/cfwl_combolist.cpp25
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp24
-rw-r--r--xfa/fwl/cfwl_datetimepicker.h4
-rw-r--r--xfa/fwl/cfwl_edit.cpp26
-rw-r--r--xfa/fwl/cfwl_edit.h4
-rw-r--r--xfa/fwl/cfwl_form.cpp6
-rw-r--r--xfa/fwl/cfwl_form.h2
-rw-r--r--xfa/fwl/cfwl_listbox.cpp16
-rw-r--r--xfa/fwl/cfwl_listbox.h4
-rw-r--r--xfa/fwl/cfwl_messagemouse.cpp2
-rw-r--r--xfa/fwl/cfwl_messagemouse.h5
-rw-r--r--xfa/fwl/cfwl_messagemousewheel.cpp3
-rw-r--r--xfa/fwl/cfwl_messagemousewheel.h8
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp32
-rw-r--r--xfa/fwl/cfwl_monthcalendar.h2
-rw-r--r--xfa/fwl/cfwl_notedriver.cpp40
-rw-r--r--xfa/fwl/cfwl_pushbutton.cpp8
-rw-r--r--xfa/fwl/cfwl_scrollbar.cpp102
-rw-r--r--xfa/fwl/cfwl_scrollbar.h26
-rw-r--r--xfa/fwl/cfwl_spinbutton.cpp20
-rw-r--r--xfa/fwl/cfwl_spinbutton.h2
-rw-r--r--xfa/fwl/cfwl_widget.cpp6
-rw-r--r--xfa/fwl/cfwl_widget.h3
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp14
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h3
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp18
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.h4
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.h2
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp17
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.h4
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp134
-rw-r--r--xfa/fxfa/app/xfa_fffield.h25
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp10
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.h2
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.cpp49
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.h21
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp32
-rw-r--r--xfa/fxfa/app/xfa_fftext.h10
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp41
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.h8
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp57
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp62
-rw-r--r--xfa/fxfa/xfa_ffwidget.h23
-rw-r--r--xfa/fxfa/xfa_ffwidgethandler.h28
50 files changed, 451 insertions, 542 deletions
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index cfb7f83b2c..56e1a04a55 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -478,17 +478,15 @@ int32_t CFDE_TxtEdtPage::GetWidth(const FDE_TEXTEDITPIECE* pIdentity,
void CFDE_TxtEdtPage::NormalizePt2Rect(CFX_PointF& ptF,
const CFX_RectF& rtF,
FX_FLOAT fTolerance) const {
- if (rtF.Contains(ptF.x, ptF.y)) {
+ if (rtF.Contains(ptF))
return;
- }
- if (ptF.x < rtF.left) {
+ if (ptF.x < rtF.left)
ptF.x = rtF.left;
- } else if (ptF.x >= rtF.right()) {
+ else if (ptF.x >= rtF.right())
ptF.x = rtF.right() - fTolerance;
- }
- if (ptF.y < rtF.top) {
+
+ if (ptF.y < rtF.top)
ptF.y = rtF.top;
- } else if (ptF.y >= rtF.bottom()) {
+ else if (ptF.y >= rtF.bottom())
ptF.y = rtF.bottom() - fTolerance;
- }
}
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 2dc0808831..0102bc7cc4 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -297,7 +297,7 @@ void CFWL_CheckBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
return;
m_bBtnDown = false;
- if (!m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!m_rtClient.Contains(pMsg->m_pos))
return;
m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered;
@@ -311,7 +311,7 @@ void CFWL_CheckBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
bool bRepaint = false;
if (m_bBtnDown) {
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtClient.Contains(pMsg->m_pos)) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Pressed) == 0) {
bRepaint = true;
m_pProperties->m_dwStates |= FWL_STATE_CKB_Pressed;
@@ -331,7 +331,7 @@ void CFWL_CheckBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
}
}
} else {
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtClient.Contains(pMsg->m_pos)) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Hovered) == 0) {
bRepaint = true;
m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered;
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index a0a4cc0a79..6083943f94 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -118,10 +118,10 @@ void CFWL_ComboBox::Update() {
Layout();
}
-FWL_WidgetHit CFWL_ComboBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ComboBox::HitTest(const CFX_PointF& point) {
if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_HitTest(fx, fy);
- return CFWL_Widget::HitTest(fx, fy);
+ return DisForm_HitTest(point);
+ return CFWL_Widget::HitTest(point);
}
void CFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics,
@@ -599,16 +599,16 @@ void CFWL_ComboBox::DisForm_Update() {
Layout();
}
-FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(const CFX_PointF& point) {
CFX_RectF rect(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width,
m_pProperties->m_rtWidget.height);
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::Edit;
- if (m_rtBtn.Contains(fx, fy))
+ if (m_rtBtn.Contains(point))
return FWL_WidgetHit::Client;
if (DisForm_IsDropListVisible()) {
rect = m_pListBox->GetWidgetRect();
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::Client;
}
return FWL_WidgetHit::Unknown;
@@ -791,7 +791,7 @@ void CFWL_ComboBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
return;
CFX_RectF& rtBtn = IsDropDownStyle() ? m_rtBtn : m_rtClient;
- if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!rtBtn.Contains(pMsg->m_pos))
return;
if (IsDropDownStyle() && m_pEdit)
@@ -808,7 +808,7 @@ void CFWL_ComboBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
m_bLButtonDown = false;
- if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (m_rtBtn.Contains(pMsg->m_pos))
m_iBtnState = CFWL_PartState_Hovered;
else
m_iBtnState = CFWL_PartState_Normal;
@@ -818,7 +818,7 @@ void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
void CFWL_ComboBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
int32_t iOldState = m_iBtnState;
- if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtBtn.Contains(pMsg->m_pos)) {
m_iBtnState =
m_bLButtonDown ? CFWL_PartState_Pressed : CFWL_PartState_Hovered;
} else {
@@ -950,7 +950,7 @@ void CFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) {
void CFWL_ComboBox::DisForm_OnLButtonDown(CFWL_MessageMouse* pMsg) {
bool bDropDown = DisForm_IsDropListVisible();
CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient;
- if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!rtBtn.Contains(pMsg->m_pos))
return;
if (DisForm_IsDropListVisible()) {
diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h
index d8db10dd2c..168e203162 100644
--- a/xfa/fwl/cfwl_combobox.h
+++ b/xfa/fwl/cfwl_combobox.h
@@ -51,7 +51,7 @@ class CFWL_ComboBox : public CFWL_Widget {
void SetStates(uint32_t dwStates) override;
void RemoveStates(uint32_t dwStates) override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -135,7 +135,7 @@ class CFWL_ComboBox : public CFWL_Widget {
void DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
void DisForm_Update();
- FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit DisForm_HitTest(const CFX_PointF& point);
void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
CFX_RectF DisForm_GetBBox() const;
void DisForm_Layout();
diff --git a/xfa/fwl/cfwl_comboboxproxy.cpp b/xfa/fwl/cfwl_comboboxproxy.cpp
index 35ff3ef6e0..0e2779b5c9 100644
--- a/xfa/fwl/cfwl_comboboxproxy.cpp
+++ b/xfa/fwl/cfwl_comboboxproxy.cpp
@@ -71,8 +71,7 @@ void CFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) {
CFWL_NoteDriver* pDriver =
static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (CFX_RectF(0, 0, GetWidgetRect().Size())
- .Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (CFX_RectF(0, 0, GetWidgetRect().Size()).Contains(pMsg->m_pos)) {
m_bLButtonDown = true;
pDriver->SetGrab(this, true);
} else {
@@ -97,8 +96,7 @@ void CFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) {
}
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (!CFX_RectF(0, 0, GetWidgetRect().Size())
- .Contains(pMsg->m_fx, pMsg->m_fy) &&
+ if (!CFX_RectF(0, 0, GetWidgetRect().Size()).Contains(pMsg->m_pos) &&
m_pComboBox->IsDropListVisible()) {
m_pComboBox->ShowDropList(false);
}
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 171b54121c..5b700a90de 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -84,9 +84,8 @@ void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) {
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- pMsg->m_fx -= rect.left;
- pMsg->m_fy -= rect.top;
+ if (rect.Contains(pMsg->m_pos)) {
+ pMsg->m_pos -= rect.TopLeft();
vertSB->GetDelegate()->OnProcessMessage(pMsg);
return;
}
@@ -130,26 +129,24 @@ void CFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet) {
}
void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) {
- if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (GetRTClient().Contains(pMsg->m_pos)) {
if (m_bNotifyOwner)
m_bNotifyOwner = false;
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (rect.Contains(pMsg->m_pos))
return;
}
- CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_pos);
if (!hItem)
return;
ChangeSelected(GetItemIndex(this, hItem));
} else if (m_bNotifyOwner) {
- CFX_PointF point = ClientToOuter(CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
+ pMsg->m_pos = ClientToOuter(pMsg->m_pos);
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter);
pOuter->GetDelegate()->OnProcessMessage(pMsg);
@@ -157,7 +154,7 @@ void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) {
}
void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) {
- if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy))
+ if (GetRTClient().Contains(pMsg->m_pos))
return;
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter);
@@ -167,9 +164,7 @@ void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) {
void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) {
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter);
if (m_bNotifyOwner) {
- CFX_PointF point = ClientToOuter(CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
+ pMsg->m_pos = ClientToOuter(pMsg->m_pos);
pOuter->GetDelegate()->OnProcessMessage(pMsg);
return;
}
@@ -177,12 +172,12 @@ void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) {
CFWL_ScrollBar* vertSB = GetVertScrollBar();
if (IsShowScrollBar(true) && vertSB) {
CFX_RectF rect = vertSB->GetWidgetRect();
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (rect.Contains(pMsg->m_pos))
return;
}
pOuter->ShowDropList(false);
- CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_pos);
if (hItem)
pOuter->ProcessSelChanged(true);
}
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 1a76727dac..a6ba65a3b2 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -101,14 +101,14 @@ void CFWL_DateTimePicker::Update() {
return;
}
-FWL_WidgetHit CFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_DateTimePicker::HitTest(const CFX_PointF& point) {
if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_HitTest(fx, fy);
- if (m_rtClient.Contains(fx, fy))
+ return DisForm_HitTest(point);
+ if (m_rtClient.Contains(point))
return FWL_WidgetHit::Client;
if (IsMonthCalendarVisible()) {
CFX_RectF rect = m_pMonthCal->GetWidgetRect();
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::Client;
}
return FWL_WidgetHit::Unknown;
@@ -380,18 +380,18 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) {
RepaintRect(rtInvalidate);
}
-FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx,
- FX_FLOAT fy) const {
+FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(
+ const CFX_PointF& point) const {
CFX_RectF rect(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::Edit;
if (DisForm_IsNeedShowButton())
rect.width += m_fBtn;
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::Client;
if (IsMonthCalendarVisible()) {
- if (m_pMonthCal->GetWidgetRect().Contains(fx, fy))
+ if (m_pMonthCal->GetWidgetRect().Contains(point))
return FWL_WidgetHit::Client;
}
return FWL_WidgetHit::Unknown;
@@ -539,7 +539,7 @@ void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
return;
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)
SetFocus(true);
- if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!m_rtBtn.Contains(pMsg->m_pos))
return;
if (IsMonthCalendarVisible()) {
@@ -557,7 +557,7 @@ void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) {
return;
m_bLBtnDown = false;
- if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (m_rtBtn.Contains(pMsg->m_pos))
m_iBtnState = CFWL_PartState_Hovered;
else
m_iBtnState = CFWL_PartState_Normal;
@@ -565,7 +565,7 @@ void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) {
}
void CFWL_DateTimePicker::OnMouseMove(CFWL_MessageMouse* pMsg) {
- if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!m_rtBtn.Contains(pMsg->m_pos))
m_iBtnState = CFWL_PartState_Normal;
RepaintRect(m_rtBtn);
}
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index 47d1c70fc3..2935ee8b1c 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -38,7 +38,7 @@ class CFWL_DateTimePicker : public CFWL_Widget {
// CFWL_Widget
FWL_Type GetClassID() const override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void SetThemeProvider(IFWL_ThemeProvider* pTP) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -84,7 +84,7 @@ class CFWL_DateTimePicker : public CFWL_Widget {
bool DisForm_IsMonthCalendarVisible() const;
void DisForm_ShowMonthCalendar(bool bActivate);
- FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const;
+ FWL_WidgetHit DisForm_HitTest(const CFX_PointF& point) const;
bool DisForm_IsNeedShowButton() const;
void DisForm_Update();
CFX_RectF DisForm_GetBBox() const;
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index a227176ed0..35a83f9da5 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -142,18 +142,18 @@ void CFWL_Edit::Update() {
InitCaret();
}
-FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowScrollBar(true)) {
- if (m_pVertScrollBar->GetWidgetRect().Contains(fx, fy))
+ if (m_pVertScrollBar->GetWidgetRect().Contains(point))
return FWL_WidgetHit::VScrollBar;
}
if (IsShowScrollBar(false)) {
- if (m_pHorzScrollBar->GetWidgetRect().Contains(fx, fy))
+ if (m_pHorzScrollBar->GetWidgetRect().Contains(point))
return FWL_WidgetHit::HScrollBar;
}
}
- if (m_rtClient.Contains(fx, fy))
+ if (m_rtClient.Contains(point))
return FWL_WidgetHit::Edit;
return FWL_WidgetHit::Unknown;
}
@@ -1057,9 +1057,9 @@ void CFWL_Edit::LayoutScrollBar() {
UpdateScroll();
}
-void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) {
- pt.x += m_fScrollOffsetX - m_rtEngine.left;
- pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset;
+CFX_PointF CFWL_Edit::DeviceToEngine(const CFX_PointF& pt) {
+ return pt + CFX_PointF(m_fScrollOffsetX - m_rtEngine.left,
+ m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset);
}
void CFWL_Edit::InitVerticalScrollBar() {
@@ -1268,10 +1268,8 @@ void CFWL_Edit::DoButtonDown(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
bool bBefore = true;
- int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
+ int32_t nIndex = pPage->GetCharIndex(DeviceToEngine(pMsg->m_pos), bBefore);
if (nIndex < 0)
nIndex = 0;
@@ -1346,10 +1344,8 @@ void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
int32_t nCount = 0;
- int32_t nIndex = pPage->SelectWord(pt, nCount);
+ int32_t nIndex = pPage->SelectWord(DeviceToEngine(pMsg->m_pos), nCount);
if (nIndex < 0)
return;
@@ -1366,10 +1362,8 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
if (!pPage)
return;
- CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
- DeviceToEngine(pt);
bool bBefore = true;
- int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
+ int32_t nIndex = pPage->GetCharIndex(DeviceToEngine(pMsg->m_pos), bBefore);
m_EdtEngine.SetCaretPos(nIndex, bBefore);
nIndex = m_EdtEngine.GetCaretPos();
m_EdtEngine.ClearSelection();
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index 4193e735f9..154e286331 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -59,7 +59,7 @@ class CFWL_Edit : public CFWL_Widget {
CFX_RectF GetAutosizedWidgetRect() override;
CFX_RectF GetWidgetRect() override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void SetStates(uint32_t dwStates) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
@@ -127,7 +127,7 @@ class CFWL_Edit : public CFWL_Widget {
CFWL_ScrollBar* UpdateScroll();
void Layout();
void LayoutScrollBar();
- void DeviceToEngine(CFX_PointF& pt);
+ CFX_PointF DeviceToEngine(const CFX_PointF& pt);
void InitVerticalScrollBar();
void InitHorizontalScrollBar();
void InitEngine();
diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp
index 54a77dc65f..5e956ade2d 100644
--- a/xfa/fwl/cfwl_form.cpp
+++ b/xfa/fwl/cfwl_form.cpp
@@ -67,12 +67,12 @@ void CFWL_Form::Update() {
Layout();
}
-FWL_WidgetHit CFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_Form::HitTest(const CFX_PointF& point) {
GetAvailableTheme();
CFX_RectF rtCap(m_fCYBorder, m_fCXBorder, -2 * m_fCYBorder, 0 - m_fCXBorder);
- return rtCap.Contains(fx, fy) ? FWL_WidgetHit::Titlebar
- : FWL_WidgetHit::Client;
+ return rtCap.Contains(point) ? FWL_WidgetHit::Titlebar
+ : FWL_WidgetHit::Client;
}
void CFWL_Form::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h
index 4297fde86e..7202cb279b 100644
--- a/xfa/fwl/cfwl_form.h
+++ b/xfa/fwl/cfwl_form.h
@@ -37,7 +37,7 @@ class CFWL_Form : public CFWL_Widget {
bool IsInstance(const CFX_WideStringC& wsClass) const override;
CFX_RectF GetClientRect() override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index aed2a9a733..0b82709972 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -75,18 +75,18 @@ void CFWL_ListBox::Update() {
CalcSize(false);
}
-FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ListBox::HitTest(const CFX_PointF& point) {
if (IsShowScrollBar(false)) {
CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect();
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::HScrollBar;
}
if (IsShowScrollBar(true)) {
CFX_RectF rect = m_pVertScrollBar->GetWidgetRect();
- if (rect.Contains(fx, fy))
+ if (rect.Contains(point))
return FWL_WidgetHit::VScrollBar;
}
- if (m_rtClient.Contains(fx, fy))
+ if (m_rtClient.Contains(point))
return FWL_WidgetHit::Client;
return FWL_WidgetHit::Unknown;
}
@@ -304,8 +304,8 @@ void CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
}
}
-CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
- fx -= m_rtConent.left, fy -= m_rtConent.top;
+CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) {
+ CFX_PointF pos = point - m_rtConent.TopLeft();
FX_FLOAT fPosX = 0.0f;
if (m_pHorzScrollBar)
fPosX = m_pHorzScrollBar->GetPos();
@@ -322,7 +322,7 @@ CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtItem = pItem->GetRect();
rtItem.Offset(-fPosX, -fPosY);
- if (rtItem.Contains(fx, fy))
+ if (rtItem.Contains(pos))
return pItem;
}
return nullptr;
@@ -748,7 +748,7 @@ void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)
SetFocus(true);
- CFWL_ListItem* pItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ CFWL_ListItem* pItem = GetItemAtPoint(pMsg->m_pos);
if (!pItem)
return;
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 95d8ad9900..caa4f509f8 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -41,7 +41,7 @@ class CFWL_ListBox : public CFWL_Widget {
// CFWL_Widget
FWL_Type GetClassID() const override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -69,7 +69,7 @@ class CFWL_ListBox : public CFWL_Widget {
protected:
CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
- CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ CFWL_ListItem* GetItemAtPoint(const CFX_PointF& point);
bool ScrollToVisible(CFWL_ListItem* hItem);
void InitVerticalScrollBar();
void InitHorizontalScrollBar();
diff --git a/xfa/fwl/cfwl_messagemouse.cpp b/xfa/fwl/cfwl_messagemouse.cpp
index 110292a1de..1d56b0f17b 100644
--- a/xfa/fwl/cfwl_messagemouse.cpp
+++ b/xfa/fwl/cfwl_messagemouse.cpp
@@ -14,6 +14,8 @@ CFWL_MessageMouse::CFWL_MessageMouse(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget)
: CFWL_Message(CFWL_Message::Type::Mouse, pSrcTarget, pDstTarget) {}
+CFWL_MessageMouse::CFWL_MessageMouse(const CFWL_MessageMouse& other) = default;
+
CFWL_MessageMouse::~CFWL_MessageMouse() {}
std::unique_ptr<CFWL_Message> CFWL_MessageMouse::Clone() {
diff --git a/xfa/fwl/cfwl_messagemouse.h b/xfa/fwl/cfwl_messagemouse.h
index ac45745df1..a2b0d39ae0 100644
--- a/xfa/fwl/cfwl_messagemouse.h
+++ b/xfa/fwl/cfwl_messagemouse.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "core/fxcrt/fx_coordinates.h"
#include "xfa/fwl/cfwl_message.h"
enum class FWL_MouseCommand {
@@ -27,13 +28,13 @@ enum class FWL_MouseCommand {
class CFWL_MessageMouse : public CFWL_Message {
public:
CFWL_MessageMouse(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget);
+ CFWL_MessageMouse(const CFWL_MessageMouse& other);
~CFWL_MessageMouse() override;
// CFWL_Message
std::unique_ptr<CFWL_Message> Clone() override;
- FX_FLOAT m_fx;
- FX_FLOAT m_fy;
+ CFX_PointF m_pos;
uint32_t m_dwFlags;
FWL_MouseCommand m_dwCmd;
};
diff --git a/xfa/fwl/cfwl_messagemousewheel.cpp b/xfa/fwl/cfwl_messagemousewheel.cpp
index 3646b6c30d..8996f650bf 100644
--- a/xfa/fwl/cfwl_messagemousewheel.cpp
+++ b/xfa/fwl/cfwl_messagemousewheel.cpp
@@ -14,6 +14,9 @@ CFWL_MessageMouseWheel::CFWL_MessageMouseWheel(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget)
: CFWL_Message(CFWL_Message::Type::MouseWheel, pSrcTarget, pDstTarget) {}
+CFWL_MessageMouseWheel::CFWL_MessageMouseWheel(const CFWL_MessageMouseWheel&) =
+ default;
+
CFWL_MessageMouseWheel::~CFWL_MessageMouseWheel() {}
std::unique_ptr<CFWL_Message> CFWL_MessageMouseWheel::Clone() {
diff --git a/xfa/fwl/cfwl_messagemousewheel.h b/xfa/fwl/cfwl_messagemousewheel.h
index 4d568c8e45..f969b9a8f3 100644
--- a/xfa/fwl/cfwl_messagemousewheel.h
+++ b/xfa/fwl/cfwl_messagemousewheel.h
@@ -9,20 +9,20 @@
#include <memory>
+#include "core/fxcrt/fx_coordinates.h"
#include "xfa/fwl/cfwl_message.h"
class CFWL_MessageMouseWheel : public CFWL_Message {
public:
CFWL_MessageMouseWheel(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget);
+ CFWL_MessageMouseWheel(const CFWL_MessageMouseWheel&);
~CFWL_MessageMouseWheel() override;
// CFWL_Message
std::unique_ptr<CFWL_Message> Clone() override;
- FX_FLOAT m_fx;
- FX_FLOAT m_fy;
- FX_FLOAT m_fDeltaX;
- FX_FLOAT m_fDeltaY;
+ CFX_PointF m_pos;
+ CFX_PointF m_delta;
uint32_t m_dwFlags;
};
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)
diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h
index 245663cf5e..a110ee8297 100644
--- a/xfa/fwl/cfwl_monthcalendar.h
+++ b/xfa/fwl/cfwl_monthcalendar.h
@@ -143,7 +143,7 @@ class CFWL_MonthCalendar : public CFWL_Widget {
void JumpToToday();
CFX_WideString GetHeadText(int32_t iYear, int32_t iMonth);
CFX_WideString GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay);
- int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y);
+ int32_t GetDayAtPoint(const CFX_PointF& point) const;
CFX_RectF GetDayRect(int32_t iDay);
void OnLButtonDown(CFWL_MessageMouse* pMsg);
void OnLButtonUp(CFWL_MessageMouse* pMsg);
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 6904759e59..8feb0fb4e5 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -341,12 +341,8 @@ bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage,
pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
return !!pMsg->m_pDstTarget;
}
- if (pMsg->m_pDstTarget != pMessageForm) {
- CFX_PointF point = pMsg->m_pDstTarget->TransformTo(
- pMessageForm, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
- }
+ if (pMsg->m_pDstTarget != pMessageForm)
+ pMsg->m_pos = pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_pos);
if (!DoMouseEx(pMsg, pMessageForm))
pMsg->m_pDstTarget = pMessageForm;
return true;
@@ -359,15 +355,11 @@ bool CFWL_NoteDriver::DoWheel(CFWL_Message* pMessage,
return false;
CFWL_MessageMouseWheel* pMsg = static_cast<CFWL_MessageMouseWheel*>(pMessage);
- CFWL_Widget* pDst =
- pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
+ CFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos);
if (!pDst)
return false;
- CFX_PointF point =
- pMessageForm->TransformTo(pDst, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
+ pMsg->m_pos = pMessageForm->TransformTo(pDst, pMsg->m_pos);
pMsg->m_pDstTarget = pDst;
return true;
}
@@ -382,20 +374,12 @@ bool CFWL_NoteDriver::DoMouseEx(CFWL_Message* pMessage,
pTarget = m_pGrab;
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (!pTarget) {
- pTarget =
- pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
- }
- if (pTarget) {
- if (pMessageForm != pTarget) {
- CFX_PointF point = pMessageForm->TransformTo(
- pTarget, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- pMsg->m_fx = point.x;
- pMsg->m_fy = point.y;
- }
- }
+ if (!pTarget)
+ pTarget = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos);
if (!pTarget)
return false;
+ if (pTarget && pMessageForm != pTarget)
+ pMsg->m_pos = pMessageForm->TransformTo(pTarget, pMsg->m_pos);
pMsg->m_pDstTarget = pTarget;
return true;
@@ -409,10 +393,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
if (m_pHover) {
CFWL_MessageMouse msLeave(nullptr, m_pHover);
- CFX_PointF point =
- pTarget->TransformTo(m_pHover, CFX_PointF(pMsg->m_fx, pMsg->m_fy));
- msLeave.m_fx = point.x;
- msLeave.m_fy = point.y;
+ msLeave.m_pos = pTarget->TransformTo(m_pHover, pMsg->m_pos);
msLeave.m_dwFlags = 0;
msLeave.m_dwCmd = FWL_MouseCommand::Leave;
DispatchMessage(&msLeave, nullptr);
@@ -424,8 +405,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) {
m_pHover = pTarget;
CFWL_MessageMouse msHover(nullptr, pTarget);
- msHover.m_fx = pMsg->m_fx;
- msHover.m_fy = pMsg->m_fy;
+ msHover.m_pos = pMsg->m_pos;
msHover.m_dwFlags = 0;
msHover.m_dwCmd = FWL_MouseCommand::Hover;
DispatchMessage(&msHover, nullptr);
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index d36d1d8ca7..fe4c3f621a 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -170,14 +170,14 @@ void CFWL_PushButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
void CFWL_PushButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
m_bBtnDown = false;
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtClient.Contains(pMsg->m_pos)) {
m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed;
m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered;
} else {
m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Hovered;
m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed;
}
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtClient.Contains(pMsg->m_pos)) {
CFWL_Event wmClick(CFWL_Event::Type::Click, this);
DispatchEvent(&wmClick);
}
@@ -187,7 +187,7 @@ void CFWL_PushButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
void CFWL_PushButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
bool bRepaint = false;
if (m_bBtnDown) {
- if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtClient.Contains(pMsg->m_pos)) {
if ((m_pProperties->m_dwStates & FWL_STATE_PSB_Pressed) == 0) {
m_pProperties->m_dwStates |= FWL_STATE_PSB_Pressed;
bRepaint = true;
@@ -207,7 +207,7 @@ void CFWL_PushButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
}
}
} else {
- if (!m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy))
+ if (!m_rtClient.Contains(pMsg->m_pos))
return;
if ((m_pProperties->m_dwStates & FWL_STATE_PSB_Hovered) == 0) {
m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered;
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index b928d4c5b3..1da2674550 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -45,8 +45,6 @@ CFWL_ScrollBar::CFWL_ScrollBar(
m_iMinTrackState(CFWL_PartState_Normal),
m_iMaxTrackState(CFWL_PartState_Normal),
m_fLastTrackPos(0),
- m_cpTrackPointX(0),
- m_cpTrackPointY(0),
m_iMouseWheel(0),
m_bMouseDown(false),
m_fButtonLen(0),
@@ -276,17 +274,16 @@ CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) {
m_rtClient.height);
}
-FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) {
- FX_FLOAT fDiffX = fx - m_cpTrackPointX;
- FX_FLOAT fDiffY = fy - m_cpTrackPointY;
+FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
+ CFX_PointF diff = point - m_cpTrackPoint;
FX_FLOAT fRange = m_fRangeMax - m_fRangeMin;
FX_FLOAT fPos;
if (IsVertical()) {
- fPos = fRange * fDiffY /
+ fPos = fRange * diff.y /
(m_rtMaxBtn.top - m_rtMinBtn.bottom() - m_rtThumb.height);
} else {
- fPos = fRange * fDiffX /
+ fPos = fRange * diff.x /
(m_rtMaxBtn.left - m_rtMinBtn.right() - m_rtThumb.width);
}
@@ -305,11 +302,11 @@ bool CFWL_ScrollBar::SendEvent() {
}
if (m_iMinTrackState == CFWL_PartState_Pressed) {
DoScroll(CFWL_EventScroll::Code::PageBackward, m_fTrackPos);
- return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY);
+ return m_rtThumb.Contains(m_cpTrackPoint);
}
if (m_iMaxTrackState == CFWL_PartState_Pressed) {
DoScroll(CFWL_EventScroll::Code::PageForward, m_fTrackPos);
- return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY);
+ return m_rtThumb.Contains(m_cpTrackPoint);
}
if (m_iMouseWheel) {
CFWL_EventScroll::Code dwCode = m_iMouseWheel < 0
@@ -337,13 +334,13 @@ void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
case FWL_MouseCommand::LeftButtonDown:
- OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
+ OnLButtonDown(pMsg->m_pos);
break;
case FWL_MouseCommand::LeftButtonUp:
- OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
+ OnLButtonUp(pMsg->m_pos);
break;
case FWL_MouseCommand::Move:
- OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
+ OnMouseMove(pMsg->m_pos);
break;
case FWL_MouseCommand::Leave:
OnMouseLeave();
@@ -354,8 +351,7 @@ void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) {
} else if (type == CFWL_Message::Type::MouseWheel) {
CFWL_MessageMouseWheel* pMsg =
static_cast<CFWL_MessageMouseWheel*>(pMessage);
- OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX,
- pMsg->m_fDeltaY);
+ OnMouseWheel(pMsg->m_delta);
}
}
@@ -364,47 +360,47 @@ void CFWL_ScrollBar::OnDrawWidget(CFX_Graphics* pGraphics,
DrawWidget(pGraphics, pMatrix);
}
-void CFWL_ScrollBar::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+void CFWL_ScrollBar::OnLButtonDown(const CFX_PointF& point) {
if (!IsEnabled())
return;
m_bMouseDown = true;
SetGrab(true);
- m_cpTrackPointX = fx;
- m_cpTrackPointY = fy;
+
+ m_cpTrackPoint = point;
m_fLastTrackPos = m_fTrackPos;
- if (m_rtMinBtn.Contains(fx, fy))
- DoMouseDown(0, m_rtMinBtn, m_iMinButtonState, fx, fy);
- else if (m_rtThumb.Contains(fx, fy))
- DoMouseDown(1, m_rtThumb, m_iThumbButtonState, fx, fy);
- else if (m_rtMaxBtn.Contains(fx, fy))
- DoMouseDown(2, m_rtMaxBtn, m_iMaxButtonState, fx, fy);
- else if (m_rtMinTrack.Contains(fx, fy))
- DoMouseDown(3, m_rtMinTrack, m_iMinTrackState, fx, fy);
+ if (m_rtMinBtn.Contains(point))
+ DoMouseDown(0, m_rtMinBtn, m_iMinButtonState, point);
+ else if (m_rtThumb.Contains(point))
+ DoMouseDown(1, m_rtThumb, m_iThumbButtonState, point);
+ else if (m_rtMaxBtn.Contains(point))
+ DoMouseDown(2, m_rtMaxBtn, m_iMaxButtonState, point);
+ else if (m_rtMinTrack.Contains(point))
+ DoMouseDown(3, m_rtMinTrack, m_iMinTrackState, point);
else
- DoMouseDown(4, m_rtMaxTrack, m_iMaxTrackState, fx, fy);
+ DoMouseDown(4, m_rtMaxTrack, m_iMaxTrackState, point);
if (!SendEvent())
m_pTimerInfo = m_Timer.StartTimer(FWL_SCROLLBAR_Elapse, true);
}
-void CFWL_ScrollBar::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+void CFWL_ScrollBar::OnLButtonUp(const CFX_PointF& point) {
m_pTimerInfo->StopTimer();
m_bMouseDown = false;
- DoMouseUp(0, m_rtMinBtn, m_iMinButtonState, fx, fy);
- DoMouseUp(1, m_rtThumb, m_iThumbButtonState, fx, fy);
- DoMouseUp(2, m_rtMaxBtn, m_iMaxButtonState, fx, fy);
- DoMouseUp(3, m_rtMinTrack, m_iMinTrackState, fx, fy);
- DoMouseUp(4, m_rtMaxTrack, m_iMaxTrackState, fx, fy);
+ DoMouseUp(0, m_rtMinBtn, m_iMinButtonState, point);
+ DoMouseUp(1, m_rtThumb, m_iThumbButtonState, point);
+ DoMouseUp(2, m_rtMaxBtn, m_iMaxButtonState, point);
+ DoMouseUp(3, m_rtMinTrack, m_iMinTrackState, point);
+ DoMouseUp(4, m_rtMaxTrack, m_iMaxTrackState, point);
SetGrab(false);
}
-void CFWL_ScrollBar::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- DoMouseMove(0, m_rtMinBtn, m_iMinButtonState, fx, fy);
- DoMouseMove(1, m_rtThumb, m_iThumbButtonState, fx, fy);
- DoMouseMove(2, m_rtMaxBtn, m_iMaxButtonState, fx, fy);
- DoMouseMove(3, m_rtMinTrack, m_iMinTrackState, fx, fy);
- DoMouseMove(4, m_rtMaxTrack, m_iMaxTrackState, fx, fy);
+void CFWL_ScrollBar::OnMouseMove(const CFX_PointF& point) {
+ DoMouseMove(0, m_rtMinBtn, m_iMinButtonState, point);
+ DoMouseMove(1, m_rtThumb, m_iThumbButtonState, point);
+ DoMouseMove(2, m_rtMaxBtn, m_iMaxButtonState, point);
+ DoMouseMove(3, m_rtMinTrack, m_iMinTrackState, point);
+ DoMouseMove(4, m_rtMaxTrack, m_iMaxTrackState, point);
}
void CFWL_ScrollBar::OnMouseLeave() {
@@ -415,12 +411,8 @@ void CFWL_ScrollBar::OnMouseLeave() {
DoMouseLeave(4, m_rtMaxTrack, m_iMaxTrackState);
}
-void CFWL_ScrollBar::OnMouseWheel(FX_FLOAT fx,
- FX_FLOAT fy,
- uint32_t dwFlags,
- FX_FLOAT fDeltaX,
- FX_FLOAT fDeltaY) {
- m_iMouseWheel = (int32_t)fDeltaX;
+void CFWL_ScrollBar::OnMouseWheel(const CFX_PointF& delta) {
+ m_iMouseWheel = static_cast<int32_t>(delta.x);
SendEvent();
m_iMouseWheel = 0;
}
@@ -428,9 +420,8 @@ void CFWL_ScrollBar::OnMouseWheel(FX_FLOAT fx,
void CFWL_ScrollBar::DoMouseDown(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- if (!rtItem.Contains(fx, fy))
+ const CFX_PointF& point) {
+ if (!rtItem.Contains(point))
return;
if (iState == CFWL_PartState_Pressed)
return;
@@ -442,10 +433,9 @@ void CFWL_ScrollBar::DoMouseDown(int32_t iItem,
void CFWL_ScrollBar::DoMouseUp(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
int32_t iNewState =
- rtItem.Contains(fx, fy) ? CFWL_PartState_Hovered : CFWL_PartState_Normal;
+ rtItem.Contains(point) ? CFWL_PartState_Hovered : CFWL_PartState_Normal;
if (iState == iNewState)
return;
@@ -457,20 +447,18 @@ void CFWL_ScrollBar::DoMouseUp(int32_t iItem,
void CFWL_ScrollBar::DoMouseMove(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
if (!m_bMouseDown) {
- int32_t iNewState = rtItem.Contains(fx, fy) ? CFWL_PartState_Hovered
- : CFWL_PartState_Normal;
+ int32_t iNewState =
+ rtItem.Contains(point) ? CFWL_PartState_Hovered : CFWL_PartState_Normal;
if (iState == iNewState)
return;
iState = iNewState;
RepaintRect(rtItem);
} else if ((2 == iItem) && (m_iThumbButtonState == CFWL_PartState_Pressed)) {
- FX_FLOAT fPos = GetTrackPointPos(fx, fy);
- m_fTrackPos = fPos;
- OnScroll(CFWL_EventScroll::Code::TrackPos, fPos);
+ m_fTrackPos = GetTrackPointPos(point);
+ OnScroll(CFWL_EventScroll::Code::TrackPos, m_fTrackPos);
}
}
diff --git a/xfa/fwl/cfwl_scrollbar.h b/xfa/fwl/cfwl_scrollbar.h
index 62ce523646..6a67fa8687 100644
--- a/xfa/fwl/cfwl_scrollbar.h
+++ b/xfa/fwl/cfwl_scrollbar.h
@@ -84,35 +84,28 @@ class CFWL_ScrollBar : public CFWL_Widget {
CFX_RectF CalcThumbButtonRect(const CFX_RectF& rtThumbRect);
CFX_RectF CalcMinTrackRect(const CFX_RectF& rtMinRect);
CFX_RectF CalcMaxTrackRect(const CFX_RectF& rtMaxRect);
- FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy);
+ FX_FLOAT GetTrackPointPos(const CFX_PointF& point);
bool SendEvent();
bool OnScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos);
- void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ void OnLButtonDown(const CFX_PointF& point);
+ void OnLButtonUp(const CFX_PointF& point);
+ void OnMouseMove(const CFX_PointF& point);
void OnMouseLeave();
- void OnMouseWheel(FX_FLOAT fx,
- FX_FLOAT fy,
- uint32_t dwFlags,
- FX_FLOAT fDeltaX,
- FX_FLOAT fDeltaY);
+ void OnMouseWheel(const CFX_PointF& delta);
bool DoScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos);
void DoMouseDown(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
void DoMouseUp(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
void DoMouseMove(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
@@ -129,8 +122,7 @@ class CFWL_ScrollBar : public CFWL_Widget {
int32_t m_iMinTrackState;
int32_t m_iMaxTrackState;
FX_FLOAT m_fLastTrackPos;
- FX_FLOAT m_cpTrackPointX;
- FX_FLOAT m_cpTrackPointY;
+ CFX_PointF m_cpTrackPoint;
int32_t m_iMouseWheel;
bool m_bMouseDown;
FX_FLOAT m_fButtonLen;
diff --git a/xfa/fwl/cfwl_spinbutton.cpp b/xfa/fwl/cfwl_spinbutton.cpp
index 140cdd50be..6e58b69baf 100644
--- a/xfa/fwl/cfwl_spinbutton.cpp
+++ b/xfa/fwl/cfwl_spinbutton.cpp
@@ -66,14 +66,14 @@ void CFWL_SpinButton::Update() {
}
}
-FWL_WidgetHit CFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (m_rtClient.Contains(fx, fy))
+FWL_WidgetHit CFWL_SpinButton::HitTest(const CFX_PointF& point) {
+ if (m_rtClient.Contains(point))
return FWL_WidgetHit::Client;
- if (HasBorder() && (m_rtClient.Contains(fx, fy)))
+ if (HasBorder() && (m_rtClient.Contains(point)))
return FWL_WidgetHit::Border;
- if (m_rtUpButton.Contains(fx, fy))
+ if (m_rtUpButton.Contains(point))
return FWL_WidgetHit::UpButton;
- if (m_rtDnButton.Contains(fx, fy))
+ if (m_rtDnButton.Contains(point))
return FWL_WidgetHit::DownButton;
return FWL_WidgetHit::Unknown;
}
@@ -201,10 +201,8 @@ void CFWL_SpinButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
SetGrab(true);
SetFocus(true);
- bool bUpPress =
- (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsUpButtonEnabled());
- bool bDnPress =
- (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsDownButtonEnabled());
+ bool bUpPress = m_rtUpButton.Contains(pMsg->m_pos) && IsUpButtonEnabled();
+ bool bDnPress = m_rtDnButton.Contains(pMsg->m_pos) && IsDownButtonEnabled();
if (!bUpPress && !bDnPress)
return;
if (bUpPress) {
@@ -255,7 +253,7 @@ void CFWL_SpinButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
bool bRepaint = false;
CFX_RectF rtInvlidate;
- if (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_rtUpButton.Contains(pMsg->m_pos)) {
if (IsUpButtonEnabled()) {
if (m_dwUpState == CFWL_PartState_Hovered) {
m_dwUpState = CFWL_PartState_Hovered;
@@ -275,7 +273,7 @@ void CFWL_SpinButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
if (!IsDownButtonEnabled())
DisableButton();
- } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ } else if (m_rtDnButton.Contains(pMsg->m_pos)) {
if (IsDownButtonEnabled()) {
if (m_dwDnState != CFWL_PartState_Hovered) {
m_dwDnState = CFWL_PartState_Hovered;
diff --git a/xfa/fwl/cfwl_spinbutton.h b/xfa/fwl/cfwl_spinbutton.h
index 4794461fb2..3cda761f91 100644
--- a/xfa/fwl/cfwl_spinbutton.h
+++ b/xfa/fwl/cfwl_spinbutton.h
@@ -27,7 +27,7 @@ class CFWL_SpinButton : public CFWL_Widget {
// CFWL_Widget
FWL_Type GetClassID() const override;
void Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(const CFX_PointF& point) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 3462ea792a..b5b8bf4c7d 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -151,10 +151,10 @@ void CFWL_Widget::RemoveStates(uint32_t dwStates) {
m_pProperties->m_dwStates &= ~dwStates;
}
-FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (GetClientRect().Contains(fx, fy))
+FWL_WidgetHit CFWL_Widget::HitTest(const CFX_PointF& point) {
+ if (GetClientRect().Contains(point))
return FWL_WidgetHit::Client;
- if (HasBorder() && GetRelativeRect().Contains(fx, fy))
+ if (HasBorder() && GetRelativeRect().Contains(point))
return FWL_WidgetHit::Border;
return FWL_WidgetHit::Unknown;
}
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index a375005970..2387b753e5 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -60,7 +60,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
virtual void SetStates(uint32_t dwStates);
virtual void RemoveStates(uint32_t dwStates);
virtual void Update() = 0;
- virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(const CFX_PointF& point);
virtual void DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) = 0;
virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
@@ -173,7 +173,6 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
FX_FLOAT fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
- bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy);
void DrawBackground(CFX_Graphics* pGraphics,
CFWL_Part iPartBk,
IFWL_ThemeProvider* pTheme,
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index ea4cbde230..7c0fddd419 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -258,8 +258,7 @@ void CFWL_WidgetMgr::SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild) {
}
CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
- FX_FLOAT x,
- FX_FLOAT y) {
+ const CFX_PointF& point) const {
if (!parent)
return nullptr;
@@ -272,12 +271,12 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
CFX_Matrix matrixOnParent;
m.SetReverse(matrixOnParent);
- pos = m.Transform(CFX_PointF(x, y));
+ pos = m.Transform(point);
CFX_RectF bounds = child->GetWidgetRect();
- if (bounds.Contains(pos.x, pos.y)) {
+ if (bounds.Contains(pos)) {
pos -= bounds.TopLeft();
- return GetWidgetAtPoint(child, pos.x, pos.y);
+ return GetWidgetAtPoint(child, pos);
}
}
child = GetPriorSiblingWidget(child);
@@ -531,8 +530,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
CFX_RectF rtChilds;
bool bChildIntersectWithDirty = false;
bool bOrginPtIntersectWidthChild = false;
- bool bOrginPtIntersectWidthDirty =
- rtDirty.Contains(rtWidget.left, rtWidget.top);
+ bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.TopLeft());
static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints];
FXSYS_memset(hitPoint, 0, sizeof(hitPoint));
FX_FLOAT fxPiece = rtWidget.width / kNeedRepaintHitPiece;
@@ -562,7 +560,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
if (!bChildIntersectWithDirty && r.IntersectWith(rtDirty))
bChildIntersectWithDirty = true;
if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild)
- bOrginPtIntersectWidthChild = rect.Contains(0, 0);
+ bOrginPtIntersectWidthChild = rect.Contains(CFX_PointF(0, 0));
if (rtChilds.IsEmpty())
rtChilds = rect;
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index baa2d1a628..02dbf46473 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -50,7 +50,8 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate {
void SetOwner(CFWL_Widget* pOwner, CFWL_Widget* pOwned);
void SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild);
- CFWL_Widget* GetWidgetAtPoint(CFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy);
+ CFWL_Widget* GetWidgetAtPoint(CFWL_Widget* pParent,
+ const CFX_PointF& point) const;
CFWL_Widget* NextTab(CFWL_Widget* parent, CFWL_Widget* focus, bool& bFind);
std::vector<CFWL_Widget*> GetSameGroupRadioButton(
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 0207318e95..b136b8da5a 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -221,20 +221,18 @@ void CXFA_FFBarcode::UpdateWidgetProperty() {
}
}
-bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget;
- if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) {
+ if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
return false;
- }
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) {
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
return false;
- }
- return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy);
+ return CXFA_FFTextEdit::OnLButtonDown(dwFlags, point);
}
-bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget;
- if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) {
+ if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
return false;
- }
- return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy);
+ return CXFA_FFTextEdit::OnRButtonDown(dwFlags, point);
}
diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h
index 28d7486bcd..c20feb5167 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.h
+++ b/xfa/fxfa/app/xfa_ffbarcode.h
@@ -22,8 +22,8 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit {
CFX_Matrix* pMatrix,
uint32_t dwStatus) override;
void UpdateWidgetProperty() override;
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
};
enum XFA_BARCODETYPEENUM {
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 8a20c1a879..f088b5d4dd 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -232,8 +232,7 @@ void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS,
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
if (!m_pNormalWidget || !IsButtonDown())
return false;
@@ -241,9 +240,7 @@ bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
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;
}
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h
index 4cb7d2113c..2c0acd6e3e 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.h
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.h
@@ -24,7 +24,7 @@ class CXFA_FFCheckButton : public CXFA_FFField {
bool PerformLayout() override;
bool UpdateFWLData() override;
void UpdateWidgetProperty() override;
- bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index efe8b0c8c2..3aabde870a 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -226,12 +226,9 @@ CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
return CXFA_FFWidget::GetBBox(dwStatus);
}
-bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget)
- return false;
- return static_cast<CFWL_ComboBox*>(m_pNormalWidget)
- ->GetBBox()
- .Contains(fx, fy);
+bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) {
+ auto pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
+ return pComboBox && pComboBox->GetBBox().Contains(point);
}
bool CXFA_FFComboBox::LoadWidget() {
@@ -292,13 +289,15 @@ void CXFA_FFComboBox::UpdateWidgetProperty() {
}
pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF);
}
-bool CXFA_FFComboBox::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy))
+
+bool CXFA_FFComboBox::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_FFComboBox::OnKillFocus(CXFA_FFWidget* pNewWidget) {
bool flag = ProcessCommittedData();
if (!flag) {
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h
index 9eb42e593b..e89366ad13 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/xfa/fxfa/app/xfa_ffchoicelist.h
@@ -48,7 +48,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
- bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
bool CanUndo() override;
bool CanRedo() override;
@@ -84,7 +84,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
protected:
// CXFA_FFField
- bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override;
+ bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 932754c09c..0c8d8c1b5f 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -98,6 +98,7 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
FX_FLOAT DashPattern[2] = {1, 1};
pGS->SetLineDash(0.0f, DashPattern, 2);
pGS->SetLineWidth(0, false);
+
CFX_Path path;
path.Create();
path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height);
@@ -350,145 +351,126 @@ bool CXFA_FFField::OnMouseExit() {
return true;
}
-void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
- if (!m_pNormalWidget)
- return;
-
- CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
- fx -= rtWidget.left;
- fy -= rtWidget.top;
+CFX_PointF CXFA_FFField::FWLToClient(const CFX_PointF& point) {
+ return m_pNormalWidget ? point - m_pNormalWidget->GetWidgetRect().TopLeft()
+ : point;
}
-bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
- if (!PtInActiveRect(fx, fy)) {
+ if (!PtInActiveRect(point))
return false;
- }
+
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_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
- if (!IsButtonDown()) {
+ if (!IsButtonDown())
return false;
- }
+
SetButtonDown(false);
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
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_FFField::OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
+
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk;
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_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
+
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::Move;
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_FFField::OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+ const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
+
CFWL_MessageMouseWheel ms(nullptr, m_pNormalWidget);
ms.m_dwFlags = dwFlags;
- ms.m_fx = fx;
- ms.m_fy = fy;
- FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_fDeltaX = zDelta;
- ms.m_fDeltaY = 0;
+ ms.m_pos = FWLToClient(point);
+ ms.m_delta = CFX_PointF(zDelta, 0);
TranslateFWLMessage(&ms);
return true;
}
-bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
- if (!PtInActiveRect(fx, fy)) {
+ if (!PtInActiveRect(point))
return false;
- }
+
SetButtonDown(true);
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
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_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
- if (!IsButtonDown()) {
+ if (!IsButtonDown())
return false;
- }
+
SetButtonDown(false);
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::RightButtonUp;
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_FFField::OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!m_pNormalWidget) {
+
+bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!m_pNormalWidget)
return false;
- }
+
CFWL_MessageMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk;
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;
}
@@ -557,27 +539,25 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) {
TranslateFWLMessage(&ms);
return true;
}
-FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (m_pNormalWidget) {
- FX_FLOAT ffx = fx, ffy = fy;
- FWLToClient(ffx, ffy);
- if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
- return FWL_WidgetHit::Client;
+FWL_WidgetHit CXFA_FFField::OnHitTest(const CFX_PointF& point) {
+ if (m_pNormalWidget &&
+ m_pNormalWidget->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown) {
+ return FWL_WidgetHit::Client;
}
- if (!GetRectWithoutRotate().Contains(fx, fy))
+ if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (m_rtCaption.Contains(fx, fy))
+ if (m_rtCaption.Contains(point))
return FWL_WidgetHit::Titlebar;
return FWL_WidgetHit::Border;
}
-bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
+bool CXFA_FFField::OnSetCursor(const CFX_PointF& point) {
return true;
}
-bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
- return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(fx, fy);
+bool CXFA_FFField::PtInActiveRect(const CFX_PointF& point) {
+ return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(point);
}
void CXFA_FFField::LayoutCaption() {
diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h
index 1ccd57f30e..f10ce61738 100644
--- a/xfa/fxfa/app/xfa_fffield.h
+++ b/xfa/fxfa/app/xfa_fffield.h
@@ -31,25 +31,24 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate {
bool PerformLayout() override;
bool OnMouseEnter() override;
bool OnMouseExit() override;
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) override;
- bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ const CFX_PointF& point) override;
+ bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnSetFocus(CXFA_FFWidget* pOldWidget) override;
bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override;
bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override;
bool OnChar(uint32_t dwChar, uint32_t dwFlags) override;
- FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit OnHitTest(const CFX_PointF& point) override;
+ bool OnSetCursor(const CFX_PointF& point) override;
// IFWL_WidgetDelegate
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -61,12 +60,12 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate {
uint32_t UpdateUIProperty();
protected:
- bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override;
+ bool PtInActiveRect(const CFX_PointF& point) override;
virtual void SetFWLRect();
void SetFWLThemeProvider();
CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; }
- void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy);
+ CFX_PointF FWLToClient(const CFX_PointF& point);
void LayoutCaption();
void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr);
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 93e9481ddf..01d29eed41 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -86,12 +86,10 @@ void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS,
}
bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
return false;
-
- if (!PtInActiveRect(fx, fy))
+ if (!PtInActiveRect(point))
return false;
SetButtonDown(true);
@@ -99,9 +97,7 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
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;
}
diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/xfa_ffimageedit.h
index 9a2d19b8a8..73032b9815 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.h
+++ b/xfa/fxfa/app/xfa_ffimageedit.h
@@ -20,7 +20,7 @@ class CXFA_FFImageEdit : public CXFA_FFField {
uint32_t dwStatus) override;
bool LoadWidget() override;
void UnloadWidget() override;
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp
index 53f693d1ba..bf2bba3adf 100644
--- a/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/xfa/fxfa/app/xfa_ffsignature.cpp
@@ -41,69 +41,74 @@ void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS,
bool CXFA_FFSignature::OnMouseEnter() {
return false;
}
+
bool CXFA_FFSignature::OnMouseExit() {
return false;
}
+
bool CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
-bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
-bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
-bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
return false;
}
+
bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
return false;
}
+
bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
return false;
}
-FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (m_pNormalWidget) {
- FX_FLOAT ffx = fx, ffy = fy;
- FWLToClient(ffx, ffy);
- if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
- return FWL_WidgetHit::Client;
+FWL_WidgetHit CXFA_FFSignature::OnHitTest(const CFX_PointF& point) {
+ if (m_pNormalWidget &&
+ m_pNormalWidget->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown) {
+ return FWL_WidgetHit::Client;
}
- if (!GetRectWithoutRotate().Contains(fx, fy))
+ if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (m_rtCaption.Contains(fx, fy))
+ if (m_rtCaption.Contains(point))
return FWL_WidgetHit::Titlebar;
return FWL_WidgetHit::Client;
}
-bool CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
+bool CXFA_FFSignature::OnSetCursor(const CFX_PointF& point) {
return false;
}
diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/xfa_ffsignature.h
index 29c27360a9..934323f436 100644
--- a/xfa/fxfa/app/xfa_ffsignature.h
+++ b/xfa/fxfa/app/xfa_ffsignature.h
@@ -21,23 +21,22 @@ class CXFA_FFSignature final : public CXFA_FFField {
bool LoadWidget() override;
bool OnMouseEnter() override;
bool OnMouseExit() override;
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) override;
- bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ const CFX_PointF& pointy) override;
+ bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override;
bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override;
bool OnChar(uint32_t dwChar, uint32_t dwFlags) override;
- FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit OnHitTest(const CFX_PointF& point) override;
+ bool OnSetCursor(const CFX_PointF& point) override;
};
#endif // XFA_FXFA_APP_XFA_FFSIGNATURE_H_
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index d8231bfda8..e8d7aa32d0 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -107,11 +107,11 @@ bool CXFA_FFText::PerformLayout() {
return true;
}
-bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!GetRectWithoutRotate().Contains(fx, fy))
+bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!GetRectWithoutRotate().Contains(point))
return false;
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
+ const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -119,33 +119,33 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return true;
}
-bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- return GetRectWithoutRotate().Contains(fx, fy) && !!GetLinkURLAtPoint(fx, fy);
+bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
+ return GetRectWithoutRotate().Contains(point) && !!GetLinkURLAtPoint(point);
}
-bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- if (!IsButtonDown()) {
+bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ if (!IsButtonDown())
return false;
- }
+
SetButtonDown(false);
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
+ const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ if (!wsURLContent)
return false;
- }
+
CXFA_FFDoc* pDoc = GetDoc();
pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent);
return true;
}
-FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (!GetRectWithoutRotate().Contains(fx, fy))
+FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) {
+ if (!GetRectWithoutRotate().Contains(point))
return FWL_WidgetHit::Unknown;
- if (!GetLinkURLAtPoint(fx, fy))
+ if (!GetLinkURLAtPoint(point))
return FWL_WidgetHit::Unknown;
return FWL_WidgetHit::HyperLink;
}
-const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
+const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
@@ -154,7 +154,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
for (const auto& pPieceLine : *pTextLayout->GetPieceLines()) {
for (const auto& pPiece : pPieceLine->m_textPieces) {
if (pPiece->pLinkData &&
- pPiece->rtPiece.Contains(fx - rect.left, fy - rect.top)) {
+ pPiece->rtPiece.Contains(point - rect.TopLeft())) {
return pPiece->pLinkData->GetLinkURL();
}
}
diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h
index 2c01a6f349..c553821791 100644
--- a/xfa/fxfa/app/xfa_fftext.h
+++ b/xfa/fxfa/app/xfa_fftext.h
@@ -15,10 +15,10 @@ class CXFA_FFText : public CXFA_FFDraw {
~CXFA_FFText() override;
// CXFA_FFWidget
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override;
+ FWL_WidgetHit OnHitTest(const CFX_PointF& point) override;
void RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) override;
@@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw {
bool PerformLayout() override;
private:
- const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point);
};
#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
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() {
diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h
index 91c30ba8c9..1e0562a75b 100644
--- a/xfa/fxfa/app/xfa_fftextedit.h
+++ b/xfa/fxfa/app/xfa_fftextedit.h
@@ -19,9 +19,9 @@ class CXFA_FFTextEdit : public CXFA_FFField {
// CXFA_FFField
bool LoadWidget() override;
void UpdateWidgetProperty() override;
- bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
- bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
+ bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+ bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnSetFocus(CXFA_FFWidget* pOldWidget) override;
bool OnKillFocus(CXFA_FFWidget* pNewWidget) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -95,7 +95,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
int32_t iDay);
protected:
- bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override;
+ bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 7a8cc646dd..c917697948 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -189,38 +189,42 @@ bool CXFA_FFWidget::IsFocused() {
bool CXFA_FFWidget::OnMouseEnter() {
return false;
}
+
bool CXFA_FFWidget::OnMouseExit() {
return false;
}
-bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
-bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
return false;
}
@@ -236,6 +240,7 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam);
return true;
}
+
bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) {
m_dwStatus &= ~XFA_WidgetStatus_Focused;
EventKillFocus();
@@ -247,57 +252,75 @@ bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) {
}
return true;
}
+
bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
return false;
}
+
bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
return false;
}
+
bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
return false;
}
-FWL_WidgetHit CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit CXFA_FFWidget::OnHitTest(const CFX_PointF& point) {
return FWL_WidgetHit::Unknown;
}
-bool CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
+
+bool CXFA_FFWidget::OnSetCursor(const CFX_PointF& point) {
return false;
}
+
bool CXFA_FFWidget::CanUndo() {
return false;
}
+
bool CXFA_FFWidget::CanRedo() {
return false;
}
+
bool CXFA_FFWidget::Undo() {
return false;
}
+
bool CXFA_FFWidget::Redo() {
return false;
}
+
bool CXFA_FFWidget::CanCopy() {
return false;
}
+
bool CXFA_FFWidget::CanCut() {
return false;
}
+
bool CXFA_FFWidget::CanPaste() {
return false;
}
+
bool CXFA_FFWidget::CanSelectAll() {
return false;
}
+
bool CXFA_FFWidget::CanDelete() {
return CanCut();
}
+
bool CXFA_FFWidget::CanDeSelect() {
return CanCopy();
}
+
bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) {
return false;
}
+
bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) {
return false;
}
+
bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) {
return false;
}
@@ -429,8 +452,8 @@ bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
return false;
}
-bool CXFA_FFWidget::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
- return GetWidgetRect().Contains(fx, fy);
+bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) {
+ return GetWidgetRect().Contains(point);
}
CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index bbca0409d3..2fddfb6156 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -40,11 +40,9 @@ bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) {
bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
m_pDocView->LockUpdate();
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnLButtonDown(dwFlags, pos.x, pos.y);
+ bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point));
if (bRet && m_pDocView->SetFocus(hWidget)) {
m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
m_pDocView->GetDoc(), hWidget);
@@ -56,12 +54,10 @@ bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
m_pDocView->LockUpdate();
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
m_pDocView->m_bLayoutEvent = true;
- bool bRet = hWidget->OnLButtonUp(dwFlags, pos.x, pos.y);
+ bool bRet = hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point));
m_pDocView->UnlockUpdate();
m_pDocView->UpdateDocView();
return bRet;
@@ -69,20 +65,16 @@ bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnLButtonDblClk(dwFlags, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnLButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
m_pDocView->RunInvalidate();
return bRet;
}
bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnMouseMove(dwFlags, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnMouseMove(dwFlags, hWidget->Rotate2Normal(point));
m_pDocView->RunInvalidate();
return bRet;
}
@@ -90,20 +82,17 @@ bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet =
+ hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point));
m_pDocView->RunInvalidate();
return bRet;
}
bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnRButtonDown(dwFlags, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point));
if (bRet && m_pDocView->SetFocus(hWidget)) {
m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
m_pDocView->GetDoc(), hWidget);
@@ -114,20 +103,16 @@ bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnRButtonUp(dwFlags, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonUp(dwFlags, hWidget->Rotate2Normal(point));
m_pDocView->RunInvalidate();
return bRet;
}
bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- bool bRet = hWidget->OnRButtonDblClk(dwFlags, pos.x, pos.y);
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
m_pDocView->RunInvalidate();
return bRet;
}
@@ -158,20 +143,15 @@ bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
}
FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) {
+ const CFX_PointF& point) {
if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible))
return FWL_WidgetHit::Unknown;
-
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- return hWidget->OnHitTest(pos.x, pos.y);
+ return hWidget->OnHitTest(hWidget->Rotate2Normal(point));
}
bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) {
- CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
- return hWidget->OnSetCursor(pos.x, pos.y);
+ const CFX_PointF& point) {
+ return hWidget->OnSetCursor(hWidget->Rotate2Normal(point));
}
void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h
index 57dfc639da..5972b8ad70 100644
--- a/xfa/fxfa/xfa_ffwidget.h
+++ b/xfa/fxfa/xfa_ffwidget.h
@@ -60,25 +60,24 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
virtual void UpdateWidgetProperty();
virtual bool OnMouseEnter();
virtual bool OnMouseExit();
- virtual bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point);
virtual bool OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy);
- virtual bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ const CFX_PointF& point);
+ virtual bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
virtual bool OnSetFocus(CXFA_FFWidget* pOldWidget);
virtual bool OnKillFocus(CXFA_FFWidget* pNewWidget);
virtual bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags);
virtual bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags);
virtual bool OnChar(uint32_t dwChar, uint32_t dwFlags);
- virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy);
- virtual bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit OnHitTest(const CFX_PointF& point);
+ virtual bool OnSetCursor(const CFX_PointF& point);
virtual bool CanUndo();
virtual bool CanRedo();
virtual bool Undo();
@@ -127,7 +126,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
const CFWL_App* GetFWLApp();
protected:
- virtual bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy);
+ virtual bool PtInActiveRect(const CFX_PointF& point);
void DrawBorder(CFX_Graphics* pGS,
CXFA_Box box,
diff --git a/xfa/fxfa/xfa_ffwidgethandler.h b/xfa/fxfa/xfa_ffwidgethandler.h
index 7335f9d1b6..66bda3e02a 100644
--- a/xfa/fxfa/xfa_ffwidgethandler.h
+++ b/xfa/fxfa/xfa_ffwidgethandler.h
@@ -29,43 +29,35 @@ class CXFA_FFWidgetHandler {
bool OnMouseExit(CXFA_FFWidget* hWidget);
bool OnLButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnLButtonUp(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnLButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnMouseMove(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnMouseWheel(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnRButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnRButtonUp(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnRButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy);
+ const CFX_PointF& point);
bool OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
bool OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
- FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
- bool OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, const CFX_PointF& point);
+ bool OnSetCursor(CXFA_FFWidget* hWidget, const CFX_PointF& point);
void RenderWidget(CXFA_FFWidget* hWidget,
CFX_Graphics* pGS,
CFX_Matrix* pMatrix,