diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-10 10:23:36 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-10 11:59:04 +0000 |
commit | aa544a002e534a313ad9dd365e80f052789d9963 (patch) | |
tree | f0f7aaaa75e09483faf0771f8ac871bbe64445ad /vcl | |
parent | 8898a2359504c0c1e80c39468b8be10065597182 (diff) |
Convert SALOBJ_EVENT to scoped enum
Change-Id: I41fcdbb2381008b99f6cb7cafb085d35f8db9374
Reviewed-on: https://gerrit.libreoffice.org/24828
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salobj.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/salwtype.hxx | 12 | ||||
-rw-r--r-- | vcl/source/window/syschild.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/window/salobj.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/gtkobject.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkobject.cxx | 4 | ||||
-rw-r--r-- | vcl/win/window/salobj.cxx | 14 |
7 files changed, 28 insertions, 24 deletions
diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx index 174b1b11abc4..b1005fb87846 100644 --- a/vcl/inc/salobj.hxx +++ b/vcl/inc/salobj.hxx @@ -52,7 +52,7 @@ public: void SetCallback( void* pInst, SALOBJECTPROC pProc ) { m_pInst = pInst; m_pCallback = pProc; } - void CallCallback( sal_uInt16 nEvent, const void* pEvent ) + void CallCallback( SalObjEvent nEvent, const void* pEvent ) { if (m_pCallback) m_pCallback( m_pInst, this, nEvent, pEvent ); } void SetMouseTransparent( bool bMouseTransparent ) diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index d0adae4cbf29..4e5b6896d4ba 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -219,13 +219,15 @@ struct SalQueryCharPositionEvent typedef bool (*SALFRAMEPROC)( vcl::Window* pInst, SalEvent nEvent, const void* pEvent ); -#define SALOBJ_EVENT_GETFOCUS ((sal_uInt16)1) -#define SALOBJ_EVENT_LOSEFOCUS ((sal_uInt16)2) -#define SALOBJ_EVENT_TOTOP ((sal_uInt16)3) -#define SALOBJ_EVENT_COUNT ((sal_uInt16)4) +enum class SalObjEvent { + GetFocus = 1, + LoseFocus = 2, + ToTop = 3, + Count = 4 +}; typedef long (*SALOBJECTPROC)( void* pInst, SalObject* pObject, - sal_uInt16 nEvent, const void* pEvent ); + SalObjEvent nEvent, const void* pEvent ); struct SalFrameState { diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 3bf1271acd44..7f92c641127d 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -50,14 +50,14 @@ using namespace ::com::sun::star; long ImplSysChildProc( void* pInst, SalObject* /* pObject */, - sal_uInt16 nEvent, const void* /* pEvent */ ) + SalObjEvent nEvent, const void* /* pEvent */ ) { VclPtr<SystemChildWindow> pWindow = static_cast<SystemChildWindow*>(pInst); long nRet = 0; switch ( nEvent ) { - case SALOBJ_EVENT_GETFOCUS: + case SalObjEvent::GetFocus: // get focus, such that all handlers are called, // as if this window gets the focus assuring // that the frame does not steal it @@ -74,7 +74,7 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = false; break; - case SALOBJ_EVENT_LOSEFOCUS: + case SalObjEvent::LoseFocus: // trigger a LoseFocus which matches the status // of the window with matching Activate-Status pWindow->ImplGetFrameData()->mbSysObjFocus = false; @@ -85,7 +85,7 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, } break; - case SALOBJ_EVENT_TOTOP: + case SalObjEvent::ToTop: pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = true; if ( !Application::GetFocusWindow() || pWindow->HasChildPathFocus() ) pWindow->ToTop( ToTopFlags::NoGrabFocus ); @@ -98,6 +98,8 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */, break; pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = false; break; + + default: break; } return nRet; diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 23e531a10d08..5ea811adae1e 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -458,13 +458,13 @@ bool X11SalObject::Dispatch( XEvent* pEvent ) pObject->mbVisible = true; return true; case ButtonPress: - pObject->CallCallback( SALOBJ_EVENT_TOTOP, nullptr ); + pObject->CallCallback( SalObjEvent::ToTop, nullptr ); return true; case FocusIn: - pObject->CallCallback( SALOBJ_EVENT_GETFOCUS, nullptr ); + pObject->CallCallback( SalObjEvent::GetFocus, nullptr ); return true; case FocusOut: - pObject->CallCallback( SALOBJ_EVENT_LOSEFOCUS, nullptr ); + pObject->CallCallback( SalObjEvent::LoseFocus, nullptr ); return true; default: break; } diff --git a/vcl/unx/gtk/gtkobject.cxx b/vcl/unx/gtk/gtkobject.cxx index 32a41d05c7cc..0717ffe8b8c2 100644 --- a/vcl/unx/gtk/gtkobject.cxx +++ b/vcl/unx/gtk/gtkobject.cxx @@ -159,7 +159,7 @@ gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointe if( pEvent->type == GDK_BUTTON_PRESS ) { - pThis->CallCallback( SALOBJ_EVENT_TOTOP, nullptr ); + pThis->CallCallback( SalObjEvent::ToTop, nullptr ); } return FALSE; @@ -169,7 +169,7 @@ gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer { GtkSalObject* pThis = static_cast<GtkSalObject*>(object); - pThis->CallCallback( pEvent->in ? SALOBJ_EVENT_GETFOCUS : SALOBJ_EVENT_LOSEFOCUS, nullptr ); + pThis->CallCallback( pEvent->in ? SalObjEvent::GetFocus : SalObjEvent::LoseFocus, nullptr ); return FALSE; } diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx index 72d157a0a5e1..bf3fbbeb7a74 100644 --- a/vcl/unx/gtk3/gtk3gtkobject.cxx +++ b/vcl/unx/gtk3/gtk3gtkobject.cxx @@ -150,7 +150,7 @@ gboolean GtkSalObject::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointe if( pEvent->type == GDK_BUTTON_PRESS ) { - pThis->CallCallback( SALOBJ_EVENT_TOTOP, nullptr ); + pThis->CallCallback( SalObjEvent::ToTop, nullptr ); } return FALSE; @@ -160,7 +160,7 @@ gboolean GtkSalObject::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer { GtkSalObject* pThis = static_cast<GtkSalObject*>(object); - pThis->CallCallback( pEvent->in ? SALOBJ_EVENT_GETFOCUS : SALOBJ_EVENT_LOSEFOCUS, nullptr ); + pThis->CallCallback( pEvent->in ? SalObjEvent::GetFocus : SalObjEvent::LoseFocus, nullptr ); return FALSE; } diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx index 49aa26f0c2c7..9231e36ca0aa 100644 --- a/vcl/win/window/salobj.cxx +++ b/vcl/win/window/salobj.cxx @@ -108,7 +108,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) pObject->mhLastFocusWnd = pData->hwnd; if ( ImplSalYieldMutexTryToAcquire() ) { - pObject->CallCallback( SALOBJ_EVENT_GETFOCUS, 0 ); + pObject->CallCallback( SalObjEvent::GetFocus, 0 ); ImplSalYieldMutexRelease(); } else @@ -128,7 +128,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) { if ( ImplSalYieldMutexTryToAcquire() ) { - pObject->CallCallback( SALOBJ_EVENT_LOSEFOCUS, 0 ); + pObject->CallCallback( SalObjEvent::LoseFocus, 0 ); ImplSalYieldMutexRelease(); } else @@ -286,7 +286,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l ImplSalYieldMutexAcquireWithWait(); pSysObj = GetSalObjWindowPtr( hWnd ); if ( pSysObj && !pSysObj->IsMouseTransparent() ) - pSysObj->CallCallback( SALOBJ_EVENT_TOTOP, 0 ); + pSysObj->CallCallback( SalObjEvent::ToTop, 0 ); ImplSalYieldMutexRelease(); } } @@ -309,7 +309,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l if ( ImplSalYieldMutexTryToAcquire() ) { pSysObj = GetSalObjWindowPtr( hWnd ); - pSysObj->CallCallback( SALOBJ_EVENT_TOTOP, 0 ); + pSysObj->CallCallback( SalObjEvent::ToTop, 0 ); ImplSalYieldMutexRelease(); rDef = FALSE; } @@ -325,11 +325,11 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l { pSysObj = GetSalObjWindowPtr( hWnd ); HWND hFocusWnd = ::GetFocus(); - sal_uInt16 nEvent; + SalObjEvent nEvent; if ( hFocusWnd && ImplIsSysWindowOrChild( hWnd, hFocusWnd ) ) - nEvent = SALOBJ_EVENT_GETFOCUS; + nEvent = SalObjEvent::GetFocus; else - nEvent = SALOBJ_EVENT_LOSEFOCUS; + nEvent = SalObjEvent::LoseFocus; pSysObj->CallCallback( nEvent, 0 ); ImplSalYieldMutexRelease(); } |