summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget
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/basewidget
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/basewidget')
-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
11 files changed, 59 insertions, 78 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;