summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-05-12 08:15:34 +0200
committerNoel Grandin <noel@peralex.com>2015-05-13 08:54:41 +0200
commit4c27e84145fc8546b180b81c15f58d2382779ac9 (patch)
tree7e0067927997c673301fd7f657b5b6205c2ec088
parent670b7ade84ec972d831055349e2bdbc2b1218955 (diff)
convert ENDTRACK_ constants to scoped enum
Change-Id: Iaccd9c3be1ae24f7f9861f9049cd5b52f155170f
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx2
-rw-r--r--include/vcl/event.hxx28
-rw-r--r--include/vcl/window.hxx19
-rw-r--r--sc/source/ui/view/select.cxx2
-rw-r--r--svtools/source/control/valueset.cxx2
-rw-r--r--vcl/source/control/button.cxx2
-rw-r--r--vcl/source/window/dialog.cxx2
-rw-r--r--vcl/source/window/mouse.cxx4
-rw-r--r--vcl/source/window/window.cxx4
-rw-r--r--vcl/source/window/window2.cxx10
-rw-r--r--vcl/source/window/winproc.cxx8
11 files changed, 44 insertions, 39 deletions
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index d9537a80ebb8..c2509dcd00cd 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -599,7 +599,7 @@ bool SbaGridHeader::ImplStartColumnDrag(sal_Int8 _nAction, const Point& _rMouseP
if (!bResizingCol)
{
// force the base class to end it's drag mode
- EndTracking(ENDTRACK_CANCEL | ENDTRACK_END);
+ EndTracking(TrackingEventFlags::Cancel | TrackingEventFlags::End);
// because we have 3d-buttons the select handler is called from MouseButtonUp, but StartDrag
// occurs earlier (while the mouse button is down)
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 89929d085018..973203356ac1 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -338,18 +338,6 @@ inline UserDrawEvent::UserDrawEvent( OutputDevice* pOut,
}
-// - Tracking-Types -
-
-
-#define ENDTRACK_CANCEL ((sal_uInt16)0x0001)
-#define ENDTRACK_KEY ((sal_uInt16)0x0002)
-#define ENDTRACK_FOCUS ((sal_uInt16)0x0004)
-#define ENDTRACK_END ((sal_uInt16)0x1000)
-#define ENDTRACK_DONTCALLHDL ((sal_uInt16)0x8000)
-
-#define TRACKING_REPEAT ((sal_uInt16)0x0100)
-
-
// - TrackingEvent -
@@ -357,32 +345,32 @@ class VCL_DLLPUBLIC TrackingEvent
{
private:
MouseEvent maMEvt;
- sal_uInt16 mnFlags;
+ TrackingEventFlags mnFlags;
public:
explicit TrackingEvent();
explicit TrackingEvent( const MouseEvent&,
- sal_uInt16 nTrackFlags = 0 );
+ TrackingEventFlags nTrackFlags = TrackingEventFlags::NONE );
const MouseEvent& GetMouseEvent() const { return maMEvt; }
bool IsTrackingRepeat() const
- { return ((mnFlags & TRACKING_REPEAT) != 0); }
+ { return bool(mnFlags & TrackingEventFlags::Repeat); }
bool IsTrackingEnded() const
- { return ((mnFlags & ENDTRACK_END) != 0); }
+ { return bool(mnFlags & TrackingEventFlags::End); }
bool IsTrackingCanceled() const
- { return ((mnFlags & ENDTRACK_CANCEL) != 0); }
- sal_uInt16 GetTrackingFlags() const { return mnFlags; }
+ { return bool(mnFlags & TrackingEventFlags::Cancel); }
+ TrackingEventFlags GetTrackingFlags() const { return mnFlags; }
};
inline TrackingEvent::TrackingEvent()
{
- mnFlags = 0;
+ mnFlags = TrackingEventFlags::NONE;
}
inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt,
- sal_uInt16 nTrackFlags ) :
+ TrackingEventFlags nTrackFlags ) :
maMEvt( rMEvt )
{
mnFlags = nTrackFlags;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 04cdb0f12594..1b236086bf6d 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -122,6 +122,23 @@ namespace svt { class PopupWindowControllerImpl; }
template<class T> class VclPtr;
+
+enum class TrackingEventFlags
+{
+ NONE = 0x0000,
+ Cancel = 0x0001,
+ Key = 0x0002,
+ Focus = 0x0004,
+ Repeat = 0x0100,
+ End = 0x1000,
+ DontCallHdl = 0x8000,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x9107> {};
+}
+
+
// - WindowTypes -
@@ -1104,7 +1121,7 @@ public:
void InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
void StartTracking( sal_uInt16 nFlags = 0 );
- void EndTracking( sal_uInt16 nFlags = 0 );
+ void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
bool IsTracking() const;
void StartAutoScroll( sal_uInt16 nFlags );
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 3dcbe415db71..09169f11c695 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -204,7 +204,7 @@ void ScViewFunctionSet::BeginDrag()
vcl::Window* pWindow = pViewData->GetActiveWin();
if ( pWindow->IsTracking() )
- pWindow->EndTracking( ENDTRACK_CANCEL ); // abort selecting
+ pWindow->EndTracking( TrackingEventFlags::Cancel ); // abort selecting
SC_MOD()->SetDragObject( pTransferObj, NULL ); // for internal D&D
pTransferObj->StartDrag( pWindow, nDragActions );
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 75882c4fb81e..b2c84dde2f39 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2104,7 +2104,7 @@ void ValueSet::EndSelection()
if ( mbHighlight )
{
if ( IsTracking() )
- EndTracking( ENDTRACK_CANCEL );
+ EndTracking( TrackingEventFlags::Cancel );
ImplHighlightItem( mnSelItemId );
mbHighlight = false;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 09c3a218f079..d545f2d4645f 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1590,7 +1590,7 @@ void PushButton::SetPressed( bool bPressed )
void PushButton::EndSelection()
{
- EndTracking( ENDTRACK_CANCEL );
+ EndTracking( TrackingEventFlags::Cancel );
if ( !IsDisposed() &&
ImplGetButtonState() & DrawButtonFlags::Pressed )
{
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index b92e1a743733..4aa3e15f08cc 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -777,7 +777,7 @@ bool Dialog::ImplStartExecuteModal()
// stop capturing, in order to have control over the dialog
if ( pSVData->maWinData.mpTrackWin )
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
if ( pSVData->maWinData.mpCaptureWin )
pSVData->maWinData.mpCaptureWin->ReleaseMouse();
EnableInput( true, true );
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index bbcd0ad1ff6e..6dd6014f0df8 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -353,7 +353,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
{
if ( pOldFocusWindow->IsTracking() &&
(pSVData->maWinData.mnTrackFlags & STARTTRACK_FOCUSCANCEL) )
- pOldFocusWindow->EndTracking( ENDTRACK_CANCEL | ENDTRACK_FOCUS );
+ pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus );
NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow );
if ( !ImplCallPreNotify( aNEvt ) )
pOldFocusWindow->LoseFocus();
@@ -455,7 +455,7 @@ void Window::CaptureMouse()
if ( pSVData->maWinData.mpTrackWin.get() != this )
{
if ( pSVData->maWinData.mpTrackWin )
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
}
if ( pSVData->maWinData.mpCaptureWin.get() != this )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 677de2ce717a..b42d7246bd4d 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2545,7 +2545,7 @@ void Window::Enable( bool bEnable, bool bChild )
// the tracking mode will be stopped or the capture will be stolen
// when a window is disabled,
if ( IsTracking() )
- EndTracking( ENDTRACK_CANCEL );
+ EndTracking( TrackingEventFlags::Cancel );
if ( IsMouseCaptured() )
ReleaseMouse();
// try to pass focus to the next control
@@ -2634,7 +2634,7 @@ void Window::EnableInput( bool bEnable, bool bChild )
if ( !bEnable )
{
if ( IsTracking() )
- EndTracking( ENDTRACK_CANCEL );
+ EndTracking( TrackingEventFlags::Cancel );
if ( IsMouseCaptured() )
ReleaseMouse();
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index fd6cdf926d07..43d3ecda4ef5 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -365,7 +365,7 @@ IMPL_LINK_TYPED( Window, ImplTrackTimerHdl, Timer*, pTimer, void )
mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
mpWindowImpl->mpFrameData->mnMouseCode,
mpWindowImpl->mpFrameData->mnMouseCode );
- TrackingEvent aTEvt( aMEvt, TRACKING_REPEAT );
+ TrackingEvent aTEvt( aMEvt, TrackingEventFlags::Repeat );
Tracking( aTEvt );
}
@@ -376,7 +376,7 @@ void Window::StartTracking( sal_uInt16 nFlags )
if ( pSVData->maWinData.mpTrackWin.get() != this )
{
if ( pSVData->maWinData.mpTrackWin )
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
}
if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) )
@@ -396,7 +396,7 @@ void Window::StartTracking( sal_uInt16 nFlags )
CaptureMouse();
}
-void Window::EndTracking( sal_uInt16 nFlags )
+void Window::EndTracking( TrackingEventFlags nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
@@ -418,7 +418,7 @@ void Window::EndTracking( sal_uInt16 nFlags )
}
// call EndTracking if required
- if ( !(nFlags & ENDTRACK_DONTCALLHDL) )
+ if ( !(nFlags & TrackingEventFlags::DontCallHdl) )
{
Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
if( ImplIsAntiparallel() )
@@ -432,7 +432,7 @@ void Window::EndTracking( sal_uInt16 nFlags )
mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
mpWindowImpl->mpFrameData->mnMouseCode,
mpWindowImpl->mpFrameData->mnMouseCode );
- TrackingEvent aTEvt( aMEvt, nFlags | ENDTRACK_END );
+ TrackingEvent aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
Tracking( aTEvt );
}
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index c2a7dc0c2d1c..0874091f37f2 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -949,7 +949,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent,
if ( (nOrigCode == KEY_ESCAPE) && !(pSVData->maWinData.mnTrackFlags & STARTTRACK_NOKEYCANCEL) )
{
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL | ENDTRACK_KEY );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Key );
if ( pSVData->maWinData.mpFirstFloat )
{
FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
@@ -965,7 +965,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent,
}
else if ( nOrigCode == KEY_RETURN )
{
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_KEY );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Key );
return true;
}
else if ( !(pSVData->maWinData.mnTrackFlags & STARTTRACK_KEYINPUT) )
@@ -1909,7 +1909,7 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow )
if ( pSVData->maWinData.mpTrackWin )
{
if ( pSVData->maWinData.mpTrackWin->ImplGetWindowImpl()->mpFrameWindow == pWindow )
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
}
// here we always terminate the popupmode, also when NOFOCUSCLOSE
@@ -1986,7 +1986,7 @@ void ImplHandleClose( vcl::Window* pWindow )
pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
if ( pSVData->maWinData.mpTrackWin )
- pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL | ENDTRACK_KEY );
+ pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Key );
if (bWasPopup)
return;