From 09c95aba4a5208a23eaeca9f4408ff5d87c898b9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 18 Jul 2014 09:36:48 +0200 Subject: [PATCH] convert HITTEST #define to enum Change-Id: I2a4066c66894e0bd9c349a7c5b8db3a8398451d2 --- include/vcl/floatwin.hxx | 13 ++++++++----- vcl/source/window/floatwin.cxx | 8 ++++---- vcl/source/window/winproc.cxx | 10 +++++----- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 62d0086b6275..45aefab68c5e 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -61,8 +61,14 @@ class ToolBox; #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008) -// - FloatingWindow - +enum HitTest +{ + HITTEST_OUTSIDE, + HITTEST_WINDOW, + HITTEST_RECT +}; +// - FloatingWindow - class VCL_DLLPUBLIC FloatingWindow : public SystemWindow { @@ -100,10 +106,7 @@ protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); public: -#define IMPL_FLOATWIN_HITTEST_OUTSIDE ((sal_uInt16)0x0001) -#define IMPL_FLOATWIN_HITTEST_WINDOW ((sal_uInt16)0x0002) -#define IMPL_FLOATWIN_HITTEST_RECT ((sal_uInt16)0x0004) - SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest ); + SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, HitTest& rHitTest ); SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat(); SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const Window* pWindow ); SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 5163b5137a10..a77c38f56a49 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -426,7 +426,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow, return pW->OutputToScreenPixel( aPos ); } -FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest ) +FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, HitTest& rHitTest ) { FloatingWindow* pWin = this; @@ -460,7 +460,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Poin Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( Rectangle( aPt, pBorderWin->GetSizePixel()) ) ) ; if ( devRect.IsInside( aAbsolute ) ) { - rHitTest = IMPL_FLOATWIN_HITTEST_WINDOW; + rHitTest = HITTEST_WINDOW; return pWin; } @@ -470,7 +470,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Poin // is already in absolute device coordinates if ( pWin->maFloatRect.IsInside( aAbsolute ) ) { - rHitTest = IMPL_FLOATWIN_HITTEST_RECT; + rHitTest = HITTEST_RECT; return pWin; } @@ -478,7 +478,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Poin } while ( pWin ); - rHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; + rHitTest = HITTEST_OUTSIDE; return NULL; } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 4fab9485e00f..0763780b4a65 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -73,7 +73,7 @@ static bool ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, * #93895# since floats are system windows, coordinates have * to be converted to float relative for the hittest */ - sal_uInt16 nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; + HitTest nHitTest = HITTEST_OUTSIDE; FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, nHitTest ); FloatingWindow* pLastLevelFloat; sal_uLong nPopupFlags; @@ -82,7 +82,7 @@ static bool ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, if ( bMouseLeave ) return true; - if ( !pFloat || (nHitTest & IMPL_FLOATWIN_HITTEST_RECT) ) + if ( !pFloat || (nHitTest == HITTEST_RECT) ) { if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp ) ImplDestroyHelpWindow( true ); @@ -107,7 +107,7 @@ static bool ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, // else return true; } - else if ( nHitTest & IMPL_FLOATWIN_HITTEST_RECT ) + else if ( nHitTest == HITTEST_RECT ) { if ( !(pFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE) ) pFloat->ImplSetMouseDown(); @@ -118,7 +118,7 @@ static bool ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos, { if ( pFloat ) { - if ( nHitTest & IMPL_FLOATWIN_HITTEST_RECT ) + if ( nHitTest == HITTEST_RECT ) { if ( pFloat->ImplIsMouseDown() ) pFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL ); @@ -1420,7 +1420,7 @@ static bool ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv if ( pSVData->maWinData.mpFirstFloat && !pSVData->maWinData.mpCaptureWin && !pSVData->maWinData.mpFirstFloat->ImplIsFloatPopupModeWindow( pWindow ) ) { - sal_uInt16 nHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE; + HitTest nHitTest = HITTEST_OUTSIDE; pMouseWindow = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pWindow, aMousePos, nHitTest ); } // then try the window directly beneath the mouse