[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source

Noel Grandin noel at peralex.com
Tue May 24 13:07:43 UTC 2016


 include/vcl/window.hxx         |   12 +++++++++++-
 vcl/inc/window.h               |    4 +---
 vcl/source/window/mouse.cxx    |   10 +++++-----
 vcl/source/window/stacking.cxx |    6 +++---
 4 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit d31935043f7b4ce44811cd6de51f64eb207a6b3a
Author: Noel Grandin <noel at peralex.com>
Date:   Tue May 24 09:32:18 2016 +0200

    Convert WINDOW_HITTEST to scoped enum
    
    Change-Id: I18c3798ae41eeffe96797828709f6ee42b32fcbe
    Reviewed-on: https://gerrit.libreoffice.org/25395
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 4b6a415..9f6f7ef 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -474,6 +474,16 @@ struct WindowResHeader
     RSWND     nRSStyle;
 };
 
+enum class WindowHitTest {
+    NONE        = 0x0000,
+    Inside      = 0x0001,
+    Transparent = 0x0002
+};
+namespace o3tl {
+    template<> struct typed_flags<WindowHitTest> : is_typed_flags<WindowHitTest, 0x0003> {};
+};
+
+
 namespace vcl {
 
 class VCL_DLLPUBLIC RenderTools
@@ -619,7 +629,7 @@ protected:
 
     SAL_DLLPRIVATE void                 ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags );
 
-    SAL_DLLPRIVATE sal_uInt16           ImplHitTest( const Point& rFramePos );
+    SAL_DLLPRIVATE WindowHitTest        ImplHitTest( const Point& rFramePos );
 
     SAL_DLLPRIVATE void                 ImplSetMouseTransparent( bool bTransparent );
 
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 701ad43..cfd214d 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -21,6 +21,7 @@
 #define INCLUDED_VCL_INC_WINDOW_H
 
 #include <sal/config.h>
+
 #include <tools/fract.hxx>
 #include <vcl/idle.hxx>
 #include <vcl/rendersettings.hxx>
@@ -80,9 +81,6 @@ namespace dnd {
 
 bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEvent );
 
-#define WINDOW_HITTEST_INSIDE           ((sal_uInt16)0x0001)
-#define WINDOW_HITTEST_TRANSPARENT      ((sal_uInt16)0x0002)
-
 struct ImplWinData
 {
     OUString*           mpExtOldText;
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 19cdc73..b47949d 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star::uno;
 
 namespace vcl {
 
-sal_uInt16 Window::ImplHitTest( const Point& rFramePos )
+WindowHitTest Window::ImplHitTest( const Point& rFramePos )
 {
     Point aFramePos( rFramePos );
     if( ImplIsAntiparallel() )
@@ -61,19 +61,19 @@ sal_uInt16 Window::ImplHitTest( const Point& rFramePos )
     }
     Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
     if ( !aRect.IsInside( aFramePos ) )
-        return 0;
+        return WindowHitTest::NONE;
     if ( mpWindowImpl->mbWinRegion )
     {
         Point aTempPos = aFramePos;
         aTempPos.X() -= mnOutOffX;
         aTempPos.Y() -= mnOutOffY;
         if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) )
-            return 0;
+            return WindowHitTest::NONE;
     }
 
-    sal_uInt16 nHitTest = WINDOW_HITTEST_INSIDE;
+    WindowHitTest nHitTest = WindowHitTest::Inside;
     if ( mpWindowImpl->mbMouseTransparent )
-        nHitTest |= WINDOW_HITTEST_TRANSPARENT;
+        nHitTest |= WindowHitTest::Transparent;
     return nHitTest;
 }
 
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index cb51c6d..b9bab21 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -661,8 +661,8 @@ vcl::Window* Window::ImplFindWindow( const Point& rFramePos )
     if ( !mpWindowImpl->mbVisible )
         return nullptr;
 
-    sal_uInt16 nHitTest = ImplHitTest( rFramePos );
-    if ( nHitTest & WINDOW_HITTEST_INSIDE )
+    WindowHitTest nHitTest = ImplHitTest( rFramePos );
+    if ( nHitTest & WindowHitTest::Inside )
     {
         // and then we check all child windows
         pTempWindow = mpWindowImpl->mpFirstChild;
@@ -674,7 +674,7 @@ vcl::Window* Window::ImplFindWindow( const Point& rFramePos )
             pTempWindow = pTempWindow->mpWindowImpl->mpNext;
         }
 
-        if ( nHitTest & WINDOW_HITTEST_TRANSPARENT )
+        if ( nHitTest & WindowHitTest::Transparent )
             return nullptr;
         else
             return this;


More information about the Libreoffice-commits mailing list