xref: /haiku/headers/private/shared/LongAndDragTrackingFilter.h (revision 596bb6891a80782c057a54f77c72060671761248)
1*596bb689SAlexandre Deckner /*
2*596bb689SAlexandre Deckner  * Copyright 2009, Alexandre Deckner, alex@zappotek.com
3*596bb689SAlexandre Deckner  * Distributed under the terms of the MIT License.
4*596bb689SAlexandre Deckner  */
5*596bb689SAlexandre Deckner #ifndef LONG_AND_DRAG_TRACKING_FILTER_H
6*596bb689SAlexandre Deckner #define LONG_AND_DRAG_TRACKING_FILTER_H
7*596bb689SAlexandre Deckner 
8*596bb689SAlexandre Deckner 
9*596bb689SAlexandre Deckner #include <MessageFilter.h>
10*596bb689SAlexandre Deckner #include <Point.h>
11*596bb689SAlexandre Deckner 
12*596bb689SAlexandre Deckner 
13*596bb689SAlexandre Deckner class BHandler;
14*596bb689SAlexandre Deckner class BMessageRunner;
15*596bb689SAlexandre Deckner 
16*596bb689SAlexandre Deckner 
17*596bb689SAlexandre Deckner namespace BPrivate {
18*596bb689SAlexandre Deckner 
19*596bb689SAlexandre Deckner class LongAndDragTrackingFilter : public BMessageFilter {
20*596bb689SAlexandre Deckner public:
21*596bb689SAlexandre Deckner 								LongAndDragTrackingFilter(
22*596bb689SAlexandre Deckner 									uint32 longMessageWhat,
23*596bb689SAlexandre Deckner 									uint32 dragMessageWhat,
24*596bb689SAlexandre Deckner 									float radiusThreshold = 4.0f,
25*596bb689SAlexandre Deckner 									bigtime_t durationThreshold = 0);
26*596bb689SAlexandre Deckner 								~LongAndDragTrackingFilter();
27*596bb689SAlexandre Deckner 
28*596bb689SAlexandre Deckner 			filter_result		Filter(BMessage* message, BHandler** target);
29*596bb689SAlexandre Deckner 
30*596bb689SAlexandre Deckner private:
31*596bb689SAlexandre Deckner 			void				_StopTracking();
32*596bb689SAlexandre Deckner 
33*596bb689SAlexandre Deckner 			uint32				fLongMessageWhat;
34*596bb689SAlexandre Deckner 			uint32				fDragMessageWhat;
35*596bb689SAlexandre Deckner 			BMessageRunner*		fMessageRunner;
36*596bb689SAlexandre Deckner 			BPoint				fClickPoint;
37*596bb689SAlexandre Deckner 			uint32				fClickButtons;
38*596bb689SAlexandre Deckner 			float				fSquaredRadiusThreshold;
39*596bb689SAlexandre Deckner 			bigtime_t			fDurationThreshold;
40*596bb689SAlexandre Deckner };
41*596bb689SAlexandre Deckner 
42*596bb689SAlexandre Deckner }	// namespace BPrivate
43*596bb689SAlexandre Deckner 
44*596bb689SAlexandre Deckner using BPrivate::LongAndDragTrackingFilter;
45*596bb689SAlexandre Deckner 
46*596bb689SAlexandre Deckner #endif	// LONG_AND_DRAG_TRACKING_FILTER_H
47*596bb689SAlexandre Deckner 
48