summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-03 13:00:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-03 13:00:25 -0700
commit89fcde88f0c03da77d7fd83dece7726d66fd190e (patch)
tree509e8ee5c74480d1c60892c5868f0b888808f6b9 /xfa/fwl
parent5fc4f31285c3a88fc157fd2d9b9cf2eb5c7cabed (diff)
downloadpdfium-89fcde88f0c03da77d7fd83dece7726d66fd190e.tar.xz
Remove FWL_WGTHITTEST_* defines in favour of enum class.
This Cl updates the FWL_WGTHITTEST_ defines to an enum class and fixes up any code issues. Review-Url: https://codereview.chromium.org/1948583002
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.cpp21
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.h4
-rw-r--r--xfa/fwl/basewidget/fwl_datetimepickerimp.cpp40
-rw-r--r--xfa/fwl/basewidget/fwl_datetimepickerimp.h4
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp10
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.cpp19
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.h2
-rw-r--r--xfa/fwl/basewidget/fwl_spinbuttonimp.cpp31
-rw-r--r--xfa/fwl/basewidget/fwl_spinbuttonimp.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_spinbutton.h2
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp68
-rw-r--r--xfa/fwl/core/fwl_formimp.h2
-rw-r--r--xfa/fwl/core/fwl_widgetdef.h23
-rw-r--r--xfa/fwl/core/fwl_widgetimp.cpp21
-rw-r--r--xfa/fwl/core/fwl_widgetimp.h3
-rw-r--r--xfa/fwl/core/ifwl_widget.h2
-rw-r--r--xfa/fwl/core/include/fwl_widgethit.h35
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp4
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.h2
20 files changed, 139 insertions, 158 deletions
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp
index 55f0910c4a..fd7c6d6266 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp
@@ -593,7 +593,7 @@ FWL_ERR CFWL_ComboBoxImp::Update() {
&part, CFWL_WidgetCapacity::ComboFormHandler));
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_HitTest(fx, fy);
}
@@ -1254,23 +1254,20 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_Update() {
Layout();
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rect;
rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width,
m_pProperties->m_rtWidget.height);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Edit;
- }
- if (m_rtBtn.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Edit;
+ if (m_rtBtn.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
if (DisForm_IsDropListShowed()) {
m_pListBox->GetWidgetRect(rect);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
}
- return FWL_WGTHITTEST_Unknown;
+ return FWL_WidgetHit::Unknown;
}
FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h
index 262db35082..a4138b27a8 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.h
+++ b/xfa/fwl/basewidget/fwl_comboboximp.h
@@ -93,7 +93,7 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
uint32_t dwStylesExRemoved);
virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
virtual FWL_ERR Update();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
@@ -153,7 +153,7 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
FWL_ERR DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
FWL_ERR DisForm_Update();
- uint32_t DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
FWL_ERR DisForm_GetBBox(CFX_RectF& rect);
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
index 941b222789..84a4437fff 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
@@ -537,21 +537,18 @@ FWL_ERR CFWL_DateTimePickerImp::Update() {
m_pMonthCal->Update();
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (m_pWidgetMgr->IsFormDisabled()) {
+FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+ if (m_pWidgetMgr->IsFormDisabled())
return DisForm_HitTest(fx, fy);
- }
- if (m_rtClient.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (m_rtClient.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
if (IsMonthCalendarShowed()) {
CFX_RectF rect;
m_pMonthCal->GetWidgetRect(rect);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
}
- return FWL_WGTHITTEST_Unknown;
+ return FWL_WidgetHit::Unknown;
}
FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
@@ -907,26 +904,23 @@ void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
rtInvalidate.Inflate(2, 2);
Repaint(&rtInvalidate);
}
-uint32_t CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx,
+ FX_FLOAT fy) {
CFX_RectF rect;
rect.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Edit;
- }
- if (DisForm_IsNeedShowButton()) {
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Edit;
+ if (DisForm_IsNeedShowButton())
rect.width += m_fBtn;
- }
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
if (IsMonthCalendarShowed()) {
m_pMonthCal->GetWidgetRect(rect);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
}
- return FWL_WGTHITTEST_Unknown;
+ return FWL_WidgetHit::Unknown;
}
FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() {
FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused ||
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h
index 68e85050e4..7276928332 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h
+++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h
@@ -113,7 +113,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
virtual FWL_ERR Finalize();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pTP);
@@ -166,7 +166,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
void DisForm_InitDateTimeEdit();
FX_BOOL DisForm_IsMonthCalendarShowed();
void DisForm_ShowMonthCalendar(FX_BOOL bActivate);
- uint32_t DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
FX_BOOL DisForm_IsNeedShowButton();
FWL_ERR DisForm_Update();
FWL_ERR DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index 29fab8b9b3..8b4dd39321 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -322,24 +322,24 @@ FWL_ERR CFWL_EditImp::Update() {
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowScrollBar(TRUE)) {
CFX_RectF rect;
m_pVertScrollBar->GetWidgetRect(rect);
if (rect.Contains(fx, fy))
- return FWL_WGTHITTEST_VScrollBar;
+ return FWL_WidgetHit::VScrollBar;
}
if (IsShowScrollBar(FALSE)) {
CFX_RectF rect;
m_pHorzScrollBar->GetWidgetRect(rect);
if (rect.Contains(fx, fy))
- return FWL_WGTHITTEST_HScrollBar;
+ return FWL_WidgetHit::HScrollBar;
}
}
if (m_rtClient.Contains(fx, fy))
- return FWL_WGTHITTEST_Edit;
- return FWL_WGTHITTEST_Unknown;
+ return FWL_WidgetHit::Edit;
+ return FWL_WidgetHit::Unknown;
}
void CFWL_EditImp::AddSpellCheckObj(CFX_Path& PathData,
diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h
index 226a0e8b41..3732b48f1f 100644
--- a/xfa/fwl/basewidget/fwl_editimp.h
+++ b/xfa/fwl/basewidget/fwl_editimp.h
@@ -37,7 +37,7 @@ class CFWL_EditImp : public CFWL_WidgetImp {
FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
FWL_ERR SetWidgetRect(const CFX_RectF& rect) override;
FWL_ERR Update() override;
- uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override;
FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL) override;
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp
index 9b5d2fc424..dd017e215f 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_listboximp.cpp
@@ -142,25 +142,22 @@ FWL_ERR CFWL_ListBoxImp::Update() {
CalcSize();
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (IsShowScrollBar(FALSE)) {
CFX_RectF rect;
m_pHorzScrollBar->GetWidgetRect(rect);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_HScrollBar;
- }
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::HScrollBar;
}
if (IsShowScrollBar(TRUE)) {
CFX_RectF rect;
m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(fx, fy)) {
- return FWL_WGTHITTEST_VScrollBar;
- }
- }
- if (m_rtClient.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
+ if (rect.Contains(fx, fy))
+ return FWL_WidgetHit::VScrollBar;
}
- return FWL_WGTHITTEST_Unknown;
+ if (m_rtClient.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
+ return FWL_WidgetHit::Unknown;
}
FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h
index 1dd0db1b4c..65fbf6a45a 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.h
+++ b/xfa/fwl/basewidget/fwl_listboximp.h
@@ -31,7 +31,7 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp {
virtual FWL_ERR Finalize();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
index 434f6ddacf..5692087762 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
@@ -100,27 +100,22 @@ FWL_ERR CFWL_SpinButtonImp::Update() {
}
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- if (m_rtClient.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
- if (HasBorder() && (m_rtClient.Contains(fx, fy))) {
- return FWL_WGTHITTEST_Border;
- }
+FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+ if (m_rtClient.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
+ if (HasBorder() && (m_rtClient.Contains(fx, fy)))
+ return FWL_WidgetHit::Border;
if (HasEdge()) {
CFX_RectF rtEdge;
GetEdgeRect(rtEdge);
- if (rtEdge.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Left;
- }
- }
- if (m_rtUpButton.Contains(fx, fy)) {
- return FWL_WGTHITTEST_SPB_UpButton;
- }
- if (m_rtDnButton.Contains(fx, fy)) {
- return FWL_WGTHITTEST_SPB_DownButton;
- }
- return FWL_WGTHITTEST_Unknown;
+ if (rtEdge.Contains(fx, fy))
+ return FWL_WidgetHit::Left;
+ }
+ if (m_rtUpButton.Contains(fx, fy))
+ return FWL_WidgetHit::UpButton;
+ if (m_rtDnButton.Contains(fx, fy))
+ return FWL_WidgetHit::DownButton;
+ return FWL_WidgetHit::Unknown;
}
FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h
index 71e2a6dd61..3f9dc77c4e 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h
+++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h
@@ -26,7 +26,7 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
virtual FWL_ERR Finalize();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual int32_t Run(FWL_HTIMER hTimer);
diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h
index b98e2255ff..2894d08197 100644
--- a/xfa/fwl/basewidget/ifwl_spinbutton.h
+++ b/xfa/fwl/basewidget/ifwl_spinbutton.h
@@ -12,8 +12,6 @@
#define FWL_CLASS_SpinButton L"FWL_SPINBUTTON"
#define FWL_CLASSHASH_SpinButton 3793043646
#define FWL_STYLEEXE_SPB_Vert (1L << 0)
-#define FWL_WGTHITTEST_SPB_UpButton (FWL_WGTHITTEST_MAX + 1)
-#define FWL_WGTHITTEST_SPB_DownButton (FWL_WGTHITTEST_MAX + 2)
BEGIN_FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click)
FX_BOOL m_bUp;
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index bbec673ed6..9b91deb140 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -197,69 +197,57 @@ FWL_ERR CFWL_FormImp::Update() {
Layout();
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- (void)GetAvailableTheme();
- if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) {
- return FWL_WGTHITTEST_CloseBox;
- }
- if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) {
- return FWL_WGTHITTEST_MaxBox;
- }
- if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) {
- return FWL_WGTHITTEST_MinBox;
- }
+FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+ GetAvailableTheme();
+ if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy))
+ return FWL_WidgetHit::CloseBox;
+ if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy))
+ return FWL_WidgetHit::MaxBox;
+ if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy))
+ return FWL_WidgetHit::MinBox;
CFX_RectF rtCap;
rtCap.Set(m_rtCaption.left + m_fCYBorder, m_rtCaption.top + m_fCXBorder,
m_rtCaption.width - FWL_SYSBTNSIZE * m_iSysBox - 2 * m_fCYBorder,
m_rtCaption.height - m_fCXBorder);
- if (rtCap.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Titlebar;
- }
+ if (rtCap.Contains(fx, fy))
+ return FWL_WidgetHit::Titlebar;
if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) &&
(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize)) {
FX_FLOAT fWidth = m_rtRelative.width - 2 * (m_fCYBorder + kCornerEnlarge);
FX_FLOAT fHeight = m_rtRelative.height - 2 * (m_fCXBorder + kCornerEnlarge);
CFX_RectF rt;
rt.Set(0, m_fCXBorder + kCornerEnlarge, m_fCYBorder, fHeight);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Left;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::Left;
rt.Set(m_rtRelative.width - m_fCYBorder, m_fCXBorder + kCornerEnlarge,
m_fCYBorder, fHeight);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Right;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::Right;
rt.Set(m_fCYBorder + kCornerEnlarge, 0, fWidth, m_fCXBorder);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Top;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::Top;
rt.Set(m_fCYBorder + kCornerEnlarge, m_rtRelative.height - m_fCXBorder,
fWidth, m_fCXBorder);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Bottom;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::Bottom;
rt.Set(0, 0, m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_LeftTop;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::LeftTop;
rt.Set(0, m_rtRelative.height - m_fCXBorder - kCornerEnlarge,
m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_LeftBottom;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::LeftBottom;
rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, 0,
m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_RightTop;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::RightTop;
rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge,
m_rtRelative.height - m_fCXBorder - kCornerEnlarge,
m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
- if (rt.Contains(fx, fy)) {
- return FWL_WGTHITTEST_RightBottom;
- }
+ if (rt.Contains(fx, fy))
+ return FWL_WidgetHit::RightBottom;
}
- return FWL_WGTHITTEST_Client;
+ return FWL_WidgetHit::Client;
}
FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
@@ -1140,7 +1128,7 @@ void CFWL_FormImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
}
void CFWL_FormImpDelegate::OnLButtonDblClk(CFWL_MsgMouse* pMsg) {
if ((m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize) &&
- m_pOwner->HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WGTHITTEST_Titlebar) {
+ m_pOwner->HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) {
if (m_pOwner->m_bMaximized) {
m_pOwner->SetWidgetRect(m_pOwner->m_rtRestore);
} else {
diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h
index dccdf7f2af..4ee3e0ddae 100644
--- a/xfa/fwl/core/fwl_formimp.h
+++ b/xfa/fwl/core/fwl_formimp.h
@@ -78,7 +78,7 @@ class CFWL_FormImp : public CFWL_WidgetImp {
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR GetClientRect(CFX_RectF& rect);
virtual FWL_ERR Update();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_FORMSIZE GetFormSize();
diff --git a/xfa/fwl/core/fwl_widgetdef.h b/xfa/fwl/core/fwl_widgetdef.h
index 3b858951e5..f0ef5f5d18 100644
--- a/xfa/fwl/core/fwl_widgetdef.h
+++ b/xfa/fwl/core/fwl_widgetdef.h
@@ -50,28 +50,7 @@
#define FWL_WGTSTATE_Focused (1L << 4)
#define FWL_WGTSTATE_Invisible (1L << 5)
#define FWL_WGTSTATE_MAX (6)
-#define FWL_WGTHITTEST_Unknown 0
-#define FWL_WGTHITTEST_Client 1
-#define FWL_WGTHITTEST_Left 2
-#define FWL_WGTHITTEST_Top 3
-#define FWL_WGTHITTEST_Right 4
-#define FWL_WGTHITTEST_Bottom 5
-#define FWL_WGTHITTEST_LeftTop 6
-#define FWL_WGTHITTEST_RightTop 7
-#define FWL_WGTHITTEST_LeftBottom 8
-#define FWL_WGTHITTEST_RightBottom 9
-#define FWL_WGTHITTEST_Icon 10
-#define FWL_WGTHITTEST_Titlebar 11
-#define FWL_WGTHITTEST_MinBox 12
-#define FWL_WGTHITTEST_MaxBox 13
-#define FWL_WGTHITTEST_CloseBox 14
-#define FWL_WGTHITTEST_HScrollBar 15
-#define FWL_WGTHITTEST_VScrollBar 16
-#define FWL_WGTHITTEST_Border 17
-#define FWL_WGTHITTEST_Edge 18
-#define FWL_WGTHITTEST_Edit 19
-#define FWL_WGTHITTEST_HyperLink 20
-#define FWL_WGTHITTEST_MAX 21
+
#define FWL_VKEY_LButton 0x01
#define FWL_VKEY_RButton 0x02
#define FWL_VKEY_MButton 0x04
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp
index 38516c6557..b9db4f984e 100644
--- a/xfa/fwl/core/fwl_widgetimp.cpp
+++ b/xfa/fwl/core/fwl_widgetimp.cpp
@@ -118,7 +118,7 @@ FWL_ERR IFWL_Widget::LockUpdate() {
FWL_ERR IFWL_Widget::UnlockUpdate() {
return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate();
}
-uint32_t IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy);
}
FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget,
@@ -365,27 +365,24 @@ FWL_ERR CFWL_WidgetImp::UnlockUpdate() {
}
return FWL_ERR_Succeeded;
}
-uint32_t CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtClient;
GetClientRect(rtClient);
- if (rtClient.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Client;
- }
+ if (rtClient.Contains(fx, fy))
+ return FWL_WidgetHit::Client;
if (HasEdge()) {
CFX_RectF rtEdge;
GetEdgeRect(rtEdge);
- if (rtEdge.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Edge;
- }
+ if (rtEdge.Contains(fx, fy))
+ return FWL_WidgetHit::Edge;
}
if (HasBorder()) {
CFX_RectF rtRelative;
GetRelativeRect(rtRelative);
- if (rtRelative.Contains(fx, fy)) {
- return FWL_WGTHITTEST_Border;
- }
+ if (rtRelative.Contains(fx, fy))
+ return FWL_WidgetHit::Border;
}
- return FWL_WGTHITTEST_Unknown;
+ return FWL_WidgetHit::Unknown;
}
FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
FX_FLOAT& fx,
diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h
index 9381a4203d..3eddfa51c2 100644
--- a/xfa/fwl/core/fwl_widgetimp.h
+++ b/xfa/fwl/core/fwl_widgetimp.h
@@ -12,6 +12,7 @@
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/ifwl_widgetdelegate.h"
+#include "xfa/fwl/core/include/fwl_widgethit.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
class CFWL_AppImp;
@@ -57,7 +58,7 @@ class CFWL_WidgetImp {
virtual FWL_ERR Update();
virtual FWL_ERR LockUpdate();
virtual FWL_ERR UnlockUpdate();
- virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
virtual FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index ea57c4e3fa..62f7155c5d 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -61,7 +61,7 @@ class IFWL_Widget {
FWL_ERR Update();
FWL_ERR LockUpdate();
FWL_ERR UnlockUpdate();
- uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
diff --git a/xfa/fwl/core/include/fwl_widgethit.h b/xfa/fwl/core/include/fwl_widgethit.h
new file mode 100644
index 0000000000..102024a510
--- /dev/null
+++ b/xfa/fwl/core/include/fwl_widgethit.h
@@ -0,0 +1,35 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_INCLUDE_FWL_WIDGETHIT_H_
+#define XFA_FWL_CORE_INCLUDE_FWL_WIDGETHIT_H_
+
+enum class FWL_WidgetHit {
+ Unknown = 0,
+ Client,
+ Left,
+ Top,
+ Right,
+ Bottom,
+ LeftTop,
+ RightTop,
+ LeftBottom,
+ RightBottom,
+ Titlebar,
+ MinBox,
+ MaxBox,
+ CloseBox,
+ HScrollBar,
+ VScrollBar,
+ Border,
+ Edge,
+ Edit,
+ HyperLink,
+ UpButton,
+ DownButton
+};
+
+#endif // XFA_FWL_CORE_INCLUDE_FWL_WIDGETHIT_H_
diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index 98a5a22f43..ff28b37646 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -164,9 +164,9 @@ FWL_ERR CFWL_Widget::UnlockUpdate() {
return m_pIface->UnlockUpdate();
}
-uint32_t CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pIface)
- return 0;
+ return FWL_WidgetHit::Unknown;
return m_pIface->HitTest(fx, fy);
}
diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h
index f1b6715811..19b22c6f29 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.h
+++ b/xfa/fwl/lightwidget/cfwl_widget.h
@@ -46,7 +46,7 @@ class CFWL_Widget {
FWL_ERR Update();
FWL_ERR LockUpdate();
FWL_ERR UnlockUpdate();
- uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
FWL_ERR TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
FWL_ERR TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt);
FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);