Nest FWL_MouseCommand in CFWL_MessageMouse
Use kEnumValue style naming for constants.
Change-Id: I3ade540752003b5b5070afa39c8d81270888a922
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83850
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index d048ab9..bcf2478 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -192,16 +192,16 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown();
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMsg);
break;
- case FWL_MouseCommand::Leave:
+ case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave();
break;
default:
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 8154d75..d1e3835 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -392,10 +392,10 @@
backDefault = false;
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg);
break;
default:
diff --git a/xfa/fwl/cfwl_comboedit.cpp b/xfa/fwl/cfwl_comboedit.cpp
index 8e5c34b..16524d9 100644
--- a/xfa/fwl/cfwl_comboedit.cpp
+++ b/xfa/fwl/cfwl_comboedit.cpp
@@ -42,7 +42,7 @@
}
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
+ if ((pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown) &&
((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0)) {
SetSelected();
}
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 98dfc01..4191646 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -84,21 +84,18 @@
}
}
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::Move: {
+ case CFWL_MessageMouse::MouseCommand::kMove:
backDefault = false;
OnDropListMouseMove(pMsg);
break;
- }
- case FWL_MouseCommand::LeftButtonDown: {
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
backDefault = false;
OnDropListLButtonDown(pMsg);
break;
- }
- case FWL_MouseCommand::LeftButtonUp: {
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
backDefault = false;
OnDropListLButtonUp(pMsg);
break;
- }
default:
break;
}
diff --git a/xfa/fwl/cfwl_datetimeedit.cpp b/xfa/fwl/cfwl_datetimeedit.cpp
index b8ccfff..e95c733 100644
--- a/xfa/fwl/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/cfwl_datetimeedit.cpp
@@ -24,8 +24,8 @@
}
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
- if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown ||
- pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) {
+ if (pMouse->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown ||
+ pMouse->m_dwCmd == CFWL_MessageMouse::MouseCommand::kRightButtonDown) {
if ((m_Properties.m_dwStates & FWL_STATE_WGT_Focused) == 0)
m_Properties.m_dwStates |= FWL_STATE_WGT_Focused;
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 93ea745..20aca78 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -313,16 +313,16 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMouse->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMouse);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMouse);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMouse);
break;
- case FWL_MouseCommand::Leave:
+ case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave(pMouse);
break;
default:
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index e157cb3..ecb84d1 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -795,19 +795,19 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg);
break;
- case FWL_MouseCommand::LeftButtonDblClk:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDblClk:
OnButtonDoubleClick(pMsg);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMsg);
break;
- case FWL_MouseCommand::RightButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kRightButtonDown:
DoRButtonDown(pMsg);
break;
default:
diff --git a/xfa/fwl/cfwl_eventmouse.cpp b/xfa/fwl/cfwl_eventmouse.cpp
index 75f543d..e3aadc7 100644
--- a/xfa/fwl/cfwl_eventmouse.cpp
+++ b/xfa/fwl/cfwl_eventmouse.cpp
@@ -8,7 +8,7 @@
CFWL_EventMouse::CFWL_EventMouse(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget,
- FWL_MouseCommand cmd)
+ CFWL_MessageMouse::MouseCommand cmd)
: CFWL_Event(CFWL_Event::Type::Mouse, pSrcTarget, pDstTarget),
m_dwCmd(cmd) {}
diff --git a/xfa/fwl/cfwl_eventmouse.h b/xfa/fwl/cfwl_eventmouse.h
index 180f565..2c10002 100644
--- a/xfa/fwl/cfwl_eventmouse.h
+++ b/xfa/fwl/cfwl_eventmouse.h
@@ -14,13 +14,13 @@
public:
CFWL_EventMouse(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget,
- FWL_MouseCommand cmd);
+ CFWL_MessageMouse::MouseCommand cmd);
~CFWL_EventMouse() override;
- FWL_MouseCommand GetCommand() const { return m_dwCmd; }
+ CFWL_MessageMouse::MouseCommand GetCommand() const { return m_dwCmd; }
private:
- const FWL_MouseCommand m_dwCmd;
+ const CFWL_MessageMouse::MouseCommand m_dwCmd;
};
#endif // XFA_FWL_CFWL_EVENTMOUSE_H_
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index f07a409..6308113 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -606,10 +606,10 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg);
break;
default:
diff --git a/xfa/fwl/cfwl_messagemouse.cpp b/xfa/fwl/cfwl_messagemouse.cpp
index 93aa07b..2c01c69 100644
--- a/xfa/fwl/cfwl_messagemouse.cpp
+++ b/xfa/fwl/cfwl_messagemouse.cpp
@@ -7,12 +7,7 @@
#include "xfa/fwl/cfwl_messagemouse.h"
CFWL_MessageMouse::CFWL_MessageMouse(CFWL_Widget* pDstTarget,
- FWL_MouseCommand cmd)
- : CFWL_Message(CFWL_Message::Type::kMouse, nullptr, pDstTarget),
- m_dwCmd(cmd) {}
-
-CFWL_MessageMouse::CFWL_MessageMouse(CFWL_Widget* pDstTarget,
- FWL_MouseCommand cmd,
+ MouseCommand cmd,
FWL_KeyFlagMask flags,
CFX_PointF pos)
: CFWL_Message(CFWL_Message::Type::kMouse, nullptr, pDstTarget),
diff --git a/xfa/fwl/cfwl_messagemouse.h b/xfa/fwl/cfwl_messagemouse.h
index 89fa511..cfeb5b4 100644
--- a/xfa/fwl/cfwl_messagemouse.h
+++ b/xfa/fwl/cfwl_messagemouse.h
@@ -10,29 +10,28 @@
#include "core/fxcrt/fx_coordinates.h"
#include "xfa/fwl/cfwl_message.h"
-enum class FWL_MouseCommand : uint8_t {
- LeftButtonDown,
- LeftButtonUp,
- LeftButtonDblClk,
- RightButtonDown,
- RightButtonUp,
- RightButtonDblClk,
- Move,
- Enter,
- Leave,
- Hover
-};
-
class CFWL_MessageMouse final : public CFWL_Message {
public:
- CFWL_MessageMouse(CFWL_Widget* pDstTarget, FWL_MouseCommand cmd);
+ enum class MouseCommand : uint8_t {
+ kLeftButtonDown,
+ kLeftButtonUp,
+ kLeftButtonDblClk,
+ kRightButtonDown,
+ kRightButtonUp,
+ kRightButtonDblClk,
+ kMove,
+ kEnter,
+ kLeave,
+ kHover
+ };
+
CFWL_MessageMouse(CFWL_Widget* pDstTarget,
- FWL_MouseCommand cmd,
+ MouseCommand cmd,
FWL_KeyFlagMask flags,
CFX_PointF pos);
~CFWL_MessageMouse() override;
- const FWL_MouseCommand m_dwCmd;
+ const MouseCommand m_dwCmd;
FWL_KeyFlagMask m_dwFlags = 0;
CFX_PointF m_pos;
};
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 7ef4a17..ee5e37e 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -608,16 +608,16 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMouse = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMouse->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMouse);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMouse);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMouse);
break;
- case FWL_MouseCommand::Leave:
+ case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave(pMouse);
break;
default:
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index c61ecd4..3d22c31 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -182,9 +182,9 @@
bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- if (pMsg->m_dwCmd == FWL_MouseCommand::Leave ||
- pMsg->m_dwCmd == FWL_MouseCommand::Hover ||
- pMsg->m_dwCmd == FWL_MouseCommand::Enter) {
+ if (pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kLeave ||
+ pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kHover ||
+ pMsg->m_dwCmd == CFWL_MessageMouse::MouseCommand::kEnter) {
return !!pMsg->GetDstTarget();
}
if (pMsg->GetDstTarget() != pMessageForm)
@@ -234,7 +234,7 @@
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
if (m_pHover) {
CFWL_MessageMouse msLeave(
- m_pHover.Get(), FWL_MouseCommand::Leave, 0,
+ m_pHover.Get(), CFWL_MessageMouse::MouseCommand::kLeave, 0,
pTarget->TransformTo(m_pHover.Get(), pMsg->m_pos));
DispatchMessage(&msLeave, nullptr);
}
@@ -244,7 +244,8 @@
}
m_pHover = pTarget;
- CFWL_MessageMouse msHover(pTarget, FWL_MouseCommand::Hover, 0, pMsg->m_pos);
+ CFWL_MessageMouse msHover(pTarget, CFWL_MessageMouse::MouseCommand::kHover, 0,
+ pMsg->m_pos);
DispatchMessage(&msHover, nullptr);
}
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 62080e7..67b9cad 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -92,16 +92,16 @@
case CFWL_Message::Type::kMouse: {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMsg);
break;
- case FWL_MouseCommand::Leave:
+ case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave(pMsg);
break;
default:
@@ -206,7 +206,8 @@
if (pMsg->m_dwKeyCode != XFA_FWL_VKEY_Return)
return;
- CFWL_EventMouse wmMouse(this, nullptr, FWL_MouseCommand::LeftButtonUp);
+ CFWL_EventMouse wmMouse(this, nullptr,
+ CFWL_MessageMouse::MouseCommand::kLeftButtonUp);
DispatchEvent(&wmMouse);
if (!wmMouse.GetSrcTarget())
return;
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 657805e..ddcbab5 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -291,16 +291,16 @@
if (type == CFWL_Message::Type::kMouse) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonDown:
OnLButtonDown(pMsg->m_pos);
break;
- case FWL_MouseCommand::LeftButtonUp:
+ case CFWL_MessageMouse::MouseCommand::kLeftButtonUp:
OnLButtonUp(pMsg->m_pos);
break;
- case FWL_MouseCommand::Move:
+ case CFWL_MessageMouse::MouseCommand::kMove:
OnMouseMove(pMsg->m_pos);
break;
- case FWL_MouseCommand::Leave:
+ case CFWL_MessageMouse::MouseCommand::kLeave:
OnMouseLeave();
break;
default:
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index ac38104..f11be2d 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -254,14 +254,16 @@
}
}
-bool CXFA_FFBarcode::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
+bool CXFA_FFBarcode::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(GetNormalWidget());
if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
return false;
- if (command == FWL_MouseCommand::LeftButtonDown && !m_pNode->IsOpenAccess())
+ if (command == CFWL_MessageMouse::MouseCommand::kLeftButtonDown &&
+ !m_pNode->IsOpenAccess()) {
return false;
-
+ }
return CXFA_FFTextEdit::AcceptsFocusOnButtonDown(dwFlags, point, command);
}
diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h
index 518db68..596806b 100644
--- a/xfa/fxfa/cxfa_ffbarcode.h
+++ b/xfa/fxfa/cxfa_ffbarcode.h
@@ -104,9 +104,10 @@
const CFX_Matrix& matrix,
HighlightOption highlight) override;
void UpdateWidgetProperty() override;
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) override;
private:
CXFA_FFBarcode(CXFA_Node* pNode, CXFA_Barcode* barcode);
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index c9c5419..bf39938 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -258,8 +258,9 @@
return false;
SetButtonDown(false);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonUp,
- dwFlags, FWLToClient(point));
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonUp, dwFlags,
+ FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
}
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index df2ef7d..ad96f2e 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -370,7 +370,9 @@
if (!GetNormalWidget())
return false;
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::Enter);
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kEnter, 0,
+ CFX_PointF());
SendMessageToFWLWidget(&msg);
return true;
}
@@ -379,7 +381,9 @@
if (!GetNormalWidget())
return false;
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::Leave);
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeave, 0,
+ CFX_PointF());
SendMessageToFWLWidget(&msg);
return true;
}
@@ -390,9 +394,10 @@
: point;
}
-bool CXFA_FFField::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
+bool CXFA_FFField::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
if (!GetNormalWidget())
return false;
if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive())
@@ -405,7 +410,8 @@
bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
SetButtonDown(true);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonDown,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonDown,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -419,8 +425,9 @@
SetButtonDown(false);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonUp,
- dwFlags, FWLToClient(point));
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonUp, dwFlags,
+ FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
}
@@ -429,7 +436,8 @@
if (!GetNormalWidget())
return false;
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonDblClk,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonDblClk,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -439,7 +447,8 @@
if (!GetNormalWidget())
return false;
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::Move, dwFlags,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kMove, dwFlags,
FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -459,7 +468,8 @@
bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
SetButtonDown(true);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::RightButtonDown,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kRightButtonDown,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -472,7 +482,8 @@
return false;
SetButtonDown(false);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::RightButtonUp,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kRightButtonUp,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -482,7 +493,8 @@
if (!GetNormalWidget())
return false;
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::RightButtonDblClk,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kRightButtonDblClk,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -712,26 +724,26 @@
switch (pEvent->GetType()) {
case CFWL_Event::Type::Mouse: {
CFWL_EventMouse* event = static_cast<CFWL_EventMouse*>(pEvent);
- FWL_MouseCommand cmd = event->GetCommand();
- if (cmd == FWL_MouseCommand::Enter) {
+ CFWL_MessageMouse::MouseCommand cmd = event->GetCommand();
+ if (cmd == CFWL_MessageMouse::MouseCommand::kEnter) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseEnter;
eParam.m_pTarget = m_pNode.Get();
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseEnter,
&eParam);
- } else if (cmd == FWL_MouseCommand::Leave) {
+ } else if (cmd == CFWL_MessageMouse::MouseCommand::kLeave) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseExit;
eParam.m_pTarget = m_pNode.Get();
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseExit,
&eParam);
- } else if (cmd == FWL_MouseCommand::LeftButtonDown) {
+ } else if (cmd == CFWL_MessageMouse::MouseCommand::kLeftButtonDown) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseDown;
eParam.m_pTarget = m_pNode.Get();
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeValue::MouseDown,
&eParam);
- } else if (cmd == FWL_MouseCommand::LeftButtonUp) {
+ } else if (cmd == CFWL_MessageMouse::MouseCommand::kLeftButtonUp) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseUp;
eParam.m_pTarget = m_pNode.Get();
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h
index 57ce008..1ccbaf5 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -34,9 +34,10 @@
bool IsLoaded() override;
bool LoadWidget() override;
bool PerformLayout() override;
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) override;
bool OnMouseEnter() override;
bool OnMouseExit() override;
bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp
index c6f4faf..66d15b3 100644
--- a/xfa/fxfa/cxfa_ffimageedit.cpp
+++ b/xfa/fxfa/cxfa_ffimageedit.cpp
@@ -94,10 +94,11 @@
m_pNode->GetImageEditDpi(), iHorzAlign, iVertAlign);
}
-bool CXFA_FFImageEdit::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
- if (command != FWL_MouseCommand::LeftButtonDown)
+bool CXFA_FFImageEdit::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
+ if (command != CFWL_MessageMouse::MouseCommand::kLeftButtonDown)
return CXFA_FFField::AcceptsFocusOnButtonDown(dwFlags, point, command);
if (!m_pNode->IsOpenAccess())
@@ -111,7 +112,8 @@
bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
const CFX_PointF& point) {
SetButtonDown(true);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonDown,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonDown,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h
index 5fe867c..54d112b 100644
--- a/xfa/fxfa/cxfa_ffimageedit.h
+++ b/xfa/fxfa/cxfa_ffimageedit.h
@@ -22,9 +22,10 @@
const CFX_Matrix& matrix,
HighlightOption highlight) override;
bool LoadWidget() override;
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) override;
bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp
index 6b4c3c0..201911b 100644
--- a/xfa/fxfa/cxfa_ffsignature.cpp
+++ b/xfa/fxfa/cxfa_ffsignature.cpp
@@ -46,9 +46,10 @@
return false;
}
-bool CXFA_FFSignature::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
+bool CXFA_FFSignature::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
return false;
}
diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h
index 32d2294..a3ee515 100644
--- a/xfa/fxfa/cxfa_ffsignature.h
+++ b/xfa/fxfa/cxfa_ffsignature.h
@@ -19,9 +19,10 @@
const CFX_Matrix& matrix,
HighlightOption highlight) override;
bool LoadWidget() override;
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) override;
bool OnMouseEnter() override;
bool OnMouseExit() override;
bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp
index 6d58680..2b4a856 100644
--- a/xfa/fxfa/cxfa_fftext.cpp
+++ b/xfa/fxfa/cxfa_fftext.cpp
@@ -97,10 +97,11 @@
return true;
}
-bool CXFA_FFText::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
- return command == FWL_MouseCommand::LeftButtonDown &&
+bool CXFA_FFText::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
+ return command == CFWL_MessageMouse::MouseCommand::kLeftButtonDown &&
GetRectWithoutRotate().Contains(point) &&
!GetLinkURLAtPoint(point).IsEmpty();
}
diff --git a/xfa/fxfa/cxfa_fftext.h b/xfa/fxfa/cxfa_fftext.h
index 354dc72..373e3b8 100644
--- a/xfa/fxfa/cxfa_fftext.h
+++ b/xfa/fxfa/cxfa_fftext.h
@@ -15,9 +15,10 @@
~CXFA_FFText() override;
// CXFA_FFWidget
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) 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;
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 319136c..879e4b9 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -118,11 +118,14 @@
GetNormalWidget()->ModifyStyleExts(dwExtendedStyle, 0xFFFFFFFF);
}
-bool CXFA_FFTextEdit::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
- if (command == FWL_MouseCommand::RightButtonDown && !m_pNode->IsOpenAccess())
+bool CXFA_FFTextEdit::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
+ if (command == CFWL_MessageMouse::MouseCommand::kRightButtonDown &&
+ !m_pNode->IsOpenAccess()) {
return false;
+ }
if (!PtInActiveRect(point))
return false;
@@ -136,7 +139,8 @@
InvalidateRect();
}
SetButtonDown(true);
- CFWL_MessageMouse msg(GetNormalWidget(), FWL_MouseCommand::LeftButtonDown,
+ CFWL_MessageMouse msg(GetNormalWidget(),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonDown,
dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
@@ -149,8 +153,9 @@
InvalidateRect();
}
SetButtonDown(true);
- CFWL_MessageMouse msg(nullptr, FWL_MouseCommand::RightButtonDown, dwFlags,
- FWLToClient(point));
+ CFWL_MessageMouse msg(nullptr,
+ CFWL_MessageMouse::MouseCommand::kRightButtonDown,
+ dwFlags, FWLToClient(point));
SendMessageToFWLWidget(&msg);
return true;
}
diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h
index 642ec6d..69cdea9 100644
--- a/xfa/fxfa/cxfa_fftextedit.h
+++ b/xfa/fxfa/cxfa_fftextedit.h
@@ -29,9 +29,10 @@
// CXFA_FFField
bool LoadWidget() override;
void UpdateWidgetProperty() override;
- bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) override;
+ bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) 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;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 961921c..b93476f 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -385,9 +385,10 @@
return false;
}
-bool CXFA_FFWidget::AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command) {
+bool CXFA_FFWidget::AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command) {
return false;
}
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index d8dd895..aa5b55e 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -105,9 +105,10 @@
virtual bool UpdateFWLData();
virtual void UpdateWidgetProperty();
// |command| must be LeftButtonDown or RightButtonDown.
- virtual bool AcceptsFocusOnButtonDown(uint32_t dwFlags,
- const CFX_PointF& point,
- FWL_MouseCommand command);
+ virtual bool AcceptsFocusOnButtonDown(
+ uint32_t dwFlags,
+ const CFX_PointF& point,
+ CFWL_MessageMouse::MouseCommand command);
// Caution: Returning false from an On* method may mean |this| is destroyed.
virtual bool OnMouseEnter() WARN_UNUSED_RESULT;
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index f1afca3..c4af7cd 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -50,7 +50,8 @@
const CFX_PointF& point) {
m_pDocView->LockUpdate();
bool bRet = hWidget->AcceptsFocusOnButtonDown(
- dwFlags, hWidget->Rotate2Normal(point), FWL_MouseCommand::LeftButtonDown);
+ dwFlags, hWidget->Rotate2Normal(point),
+ CFWL_MessageMouse::MouseCommand::kLeftButtonDown);
if (bRet) {
// May re-enter JS.
if (m_pDocView->SetFocus(hWidget))
@@ -96,8 +97,9 @@
bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
const CFX_PointF& point) {
- if (!hWidget->AcceptsFocusOnButtonDown(dwFlags, hWidget->Rotate2Normal(point),
- FWL_MouseCommand::RightButtonDown)) {
+ if (!hWidget->AcceptsFocusOnButtonDown(
+ dwFlags, hWidget->Rotate2Normal(point),
+ CFWL_MessageMouse::MouseCommand::kRightButtonDown)) {
return false;
}
// May re-enter JS.