From 89fcde88f0c03da77d7fd83dece7726d66fd190e Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 3 May 2016 13:00:25 -0700 Subject: 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 --- BUILD.gn | 1 + fpdfsdk/DEPS | 1 + fpdfsdk/fsdk_annothandler.cpp | 13 ++---- xfa.gyp | 1 + xfa/fwl/basewidget/fwl_comboboximp.cpp | 21 ++++----- xfa/fwl/basewidget/fwl_comboboximp.h | 4 +- xfa/fwl/basewidget/fwl_datetimepickerimp.cpp | 40 +++++++--------- xfa/fwl/basewidget/fwl_datetimepickerimp.h | 4 +- xfa/fwl/basewidget/fwl_editimp.cpp | 10 ++-- xfa/fwl/basewidget/fwl_editimp.h | 2 +- xfa/fwl/basewidget/fwl_listboximp.cpp | 19 ++++---- xfa/fwl/basewidget/fwl_listboximp.h | 2 +- xfa/fwl/basewidget/fwl_spinbuttonimp.cpp | 31 ++++++------- xfa/fwl/basewidget/fwl_spinbuttonimp.h | 2 +- xfa/fwl/basewidget/ifwl_spinbutton.h | 2 - xfa/fwl/core/fwl_formimp.cpp | 68 ++++++++++++---------------- xfa/fwl/core/fwl_formimp.h | 2 +- xfa/fwl/core/fwl_widgetdef.h | 23 +--------- xfa/fwl/core/fwl_widgetimp.cpp | 21 ++++----- xfa/fwl/core/fwl_widgetimp.h | 3 +- xfa/fwl/core/ifwl_widget.h | 2 +- xfa/fwl/core/include/fwl_widgethit.h | 35 ++++++++++++++ xfa/fwl/lightwidget/cfwl_widget.cpp | 4 +- xfa/fwl/lightwidget/cfwl_widget.h | 2 +- xfa/fxfa/app/xfa_fffield.cpp | 20 ++++---- xfa/fxfa/app/xfa_fffield.h | 2 +- xfa/fxfa/app/xfa_ffsignature.cpp | 20 ++++---- xfa/fxfa/app/xfa_ffsignature.h | 2 +- xfa/fxfa/app/xfa_fftext.cpp | 14 +++--- xfa/fxfa/app/xfa_fftext.h | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 4 +- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 8 ++-- xfa/fxfa/include/xfa_ffwidget.h | 3 +- xfa/fxfa/include/xfa_ffwidgethandler.h | 3 +- 34 files changed, 180 insertions(+), 211 deletions(-) create mode 100644 xfa/fwl/core/include/fwl_widgethit.h diff --git a/BUILD.gn b/BUILD.gn index afedfd24aa..e67e17f34e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1046,6 +1046,7 @@ if (pdf_enable_xfa) { "xfa/fwl/core/ifwl_widget.h", "xfa/fwl/core/ifwl_widgetdelegate.h", "xfa/fwl/core/ifwl_widgetmgr.h", + "xfa/fwl/core/include/fwl_widgethit.h", "xfa/fwl/core/include/ifwl_adaptertimermgr.h", "xfa/fwl/lightwidget/cfwl_barcode.cpp", "xfa/fwl/lightwidget/cfwl_barcode.h", diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index 096b556fdb..463991d905 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -11,6 +11,7 @@ include_rules = [ '+core/fxge/include', '+public', '+v8', + '+xfa/fwl/core/include', '+xfa/fxfa/include', '+xfa/fxgraphics/include', ] diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index 24f3d60d47..73701cfb4c 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -19,6 +19,7 @@ #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "xfa/fwl/core/include/fwl_widgethit.h" #include "xfa/fxfa/include/xfa_ffwidget.h" #include "xfa/fxgraphics/include/cfx_graphics.h" #endif // PDF_ENABLE_XFA @@ -723,14 +724,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, } #ifdef PDF_ENABLE_XFA -#define FWL_WGTHITTEST_Unknown 0 -#define FWL_WGTHITTEST_Client 1 // arrow -#define FWL_WGTHITTEST_Titlebar 11 // caption -#define FWL_WGTHITTEST_HScrollBar 15 -#define FWL_WGTHITTEST_VScrollBar 16 -#define FWL_WGTHITTEST_Border 17 -#define FWL_WGTHITTEST_Edit 19 -#define FWL_WGTHITTEST_HyperLink 20 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) : m_pApp(pApp) {} @@ -825,9 +818,9 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, if (!pWidgetHandler) return FALSE; - uint32_t dwHitTest = + FWL_WidgetHit dwHitTest = pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); - return (dwHitTest != FWL_WGTHITTEST_Unknown); + return dwHitTest != FWL_WidgetHit::Unknown; } void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, diff --git a/xfa.gyp b/xfa.gyp index aeef051dd0..5158cafef7 100644 --- a/xfa.gyp +++ b/xfa.gyp @@ -203,6 +203,7 @@ "xfa/fwl/core/ifwl_widget.h", "xfa/fwl/core/ifwl_widgetdelegate.h", "xfa/fwl/core/ifwl_widgetmgr.h", + "xfa/fwl/core/include/fwl_widgethit.h", "xfa/fwl/core/include/ifwl_adaptertimermgr.h", "xfa/fwl/lightwidget/cfwl_barcode.cpp", "xfa/fwl/lightwidget/cfwl_barcode.h", 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(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(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); diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index d19bb4cf37..a0744def07 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -598,24 +598,20 @@ FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { TranslateFWLMessage(&ms); return TRUE; } -uint32_t CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pNormalWidget) { FX_FLOAT ffx = fx, ffy = fy; FWLToClient(ffx, ffy); - uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy); - if (dwWidgetHit != FWL_WGTHITTEST_Unknown) { - return FWL_WGTHITTEST_Client; - } + if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) + return FWL_WidgetHit::Client; } CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (m_rtCaption.Contains(fx, fy)) { - return FWL_WGTHITTEST_Titlebar; - } - return FWL_WGTHITTEST_Border; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (m_rtCaption.Contains(fx, fy)) + return FWL_WidgetHit::Titlebar; + return FWL_WidgetHit::Border; } FX_BOOL CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return TRUE; diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 70ba9fc661..576b0b105e 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -53,7 +53,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); protected: diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index ce1cee2033..4008abf808 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -96,24 +96,20 @@ FX_BOOL CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { FX_BOOL CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) { return FALSE; } -uint32_t CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pNormalWidget) { FX_FLOAT ffx = fx, ffy = fy; FWLToClient(ffx, ffy); - uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy); - if (dwWidgetHit != FWL_WGTHITTEST_Unknown) { - return FWL_WGTHITTEST_Client; - } + if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) + return FWL_WidgetHit::Client; } CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (m_rtCaption.Contains(fx, fy)) { - return FWL_WGTHITTEST_Titlebar; - } - return FWL_WGTHITTEST_Client; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (m_rtCaption.Contains(fx, fy)) + return FWL_WidgetHit::Titlebar; + return FWL_WidgetHit::Client; } FX_BOOL CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return FALSE; diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/xfa_ffsignature.h index 1b5f33ccc4..01ece76c4f 100644 --- a/xfa/fxfa/app/xfa_ffsignature.h +++ b/xfa/fxfa/app/xfa_ffsignature.h @@ -36,7 +36,7 @@ class CXFA_FFSignature final : public CXFA_FFField { virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); }; diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index b529f7e58a..c5e1cba2a8 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -139,16 +139,14 @@ FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { pDoc->GetDocProvider()->GotoURL(pDoc, CFX_WideStringC(wsURLContent), FALSE); return TRUE; } -uint32_t CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtBox; GetRectWithoutRotate(rtBox); - if (!rtBox.Contains(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - if (!GetLinkURLAtPoint(fx, fy)) { - return FWL_WGTHITTEST_Unknown; - } - return FWL_WGTHITTEST_HyperLink; + if (!rtBox.Contains(fx, fy)) + return FWL_WidgetHit::Unknown; + if (!GetLinkURLAtPoint(fx, fy)) + return FWL_WidgetHit::Unknown; + return FWL_WidgetHit::HyperLink; } const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index 847805b527..f505ddb30e 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -16,7 +16,7 @@ class CXFA_FFText : public CXFA_FFDraw { virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual void RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix = NULL, uint32_t dwStatus = 0, diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index c1af34c030..47be58e889 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -249,8 +249,8 @@ FX_BOOL CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { FX_BOOL CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) { return FALSE; } -uint32_t CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { - return FALSE; +FWL_WidgetHit CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { + return FWL_WidgetHit::Unknown; } FX_BOOL CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return FALSE; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index df8e424662..314b22731a 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -160,11 +160,11 @@ FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, return bRet; } -uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) { +FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, + FX_FLOAT fx, + FX_FLOAT fy) { if (!(hWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) - return FWL_WGTHITTEST_Unknown; + return FWL_WidgetHit::Unknown; hWidget->Rotate2Normal(fx, fy); return hWidget->OnHitTest(fx, fy); diff --git a/xfa/fxfa/include/xfa_ffwidget.h b/xfa/fxfa/include/xfa_ffwidget.h index a6ab999485..74e4c84c4d 100644 --- a/xfa/fxfa/include/xfa_ffwidget.h +++ b/xfa/fxfa/include/xfa_ffwidget.h @@ -18,6 +18,7 @@ class CXFA_FFPageView; class CXFA_FFDocView; class CXFA_FFDoc; class CXFA_FFApp; +enum class FWL_WidgetHit; inline FX_FLOAT XFA_UnitPx2Pt(FX_FLOAT fPx, FX_FLOAT fDpi) { return fPx * 72.0f / fDpi; @@ -84,7 +85,7 @@ class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem { virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy); + virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL CanUndo() { return FALSE; } virtual FX_BOOL CanRedo() { return FALSE; } diff --git a/xfa/fxfa/include/xfa_ffwidgethandler.h b/xfa/fxfa/include/xfa_ffwidgethandler.h index f6cd2170a5..8159d87cf0 100644 --- a/xfa/fxfa/include/xfa_ffwidgethandler.h +++ b/xfa/fxfa/include/xfa_ffwidgethandler.h @@ -13,6 +13,7 @@ #include "xfa/fxfa/parser/xfa_document.h" class CXFA_FFDocView; +enum class FWL_WidgetHit; class CXFA_FFWidgetHandler { public: @@ -64,7 +65,7 @@ class CXFA_FFWidgetHandler { uint32_t dwFlags); FX_BOOL OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags); FX_BOOL OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags); - uint32_t OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); + FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); FX_BOOL OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); void RenderWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, -- cgit v1.2.3