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