Make UEFI boot-platform build again
[haiku.git] / headers / private / shared / ShakeTrackingFilter.h
blobe6b88c0d710562ad50aeac16f23291d70c6de533
1 /*
2 * Copyright 2009, Alexandre Deckner, alex@zappotek.com
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef SHAKE_TRACKING_FILTER_H
6 #define SHAKE_TRACKING_FILTER_H
9 #include <MessageFilter.h>
10 #include <Point.h>
12 class BView;
13 class BHandler;
14 class BMessageRunner;
16 namespace BPrivate {
18 class LowPassFilter {
19 public:
20 LowPassFilter(uint32 size);
21 ~LowPassFilter();
23 void Input(const BPoint& p);
24 BPoint Output() const;
25 private:
26 BPoint* fPoints;
27 uint32 fSize;
28 BPoint fSum;
32 class ShakeTrackingFilter : public BMessageFilter {
33 public:
34 ShakeTrackingFilter(
35 BView* targetView,
36 uint32 messageWhat,
37 uint32 countThreshold = 2,
38 bigtime_t timeTreshold = 400000);
40 ~ShakeTrackingFilter();
42 filter_result Filter(BMessage* message, BHandler** _target);
44 private:
45 BView* fTargetView;
46 uint32 fMessageWhat;
48 BMessageRunner* fCancelRunner;
49 LowPassFilter fLowPass;
50 BPoint fLastDelta;
51 BPoint fLastPosition;
52 uint32 fCounter;
53 uint32 fCountThreshold;
54 bigtime_t fTimeThreshold;
57 } // namespace BPrivate
59 using BPrivate::ShakeTrackingFilter;
60 using BPrivate::LowPassFilter;
62 #endif // SHAKE_TRACKING_FILTER_H