Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_layers_DragTracker_h
7 : #define mozilla_layers_DragTracker_h
8 :
9 : #include "mozilla/EventForwards.h"
10 : #include "mozilla/Maybe.h"
11 :
12 : namespace mozilla {
13 :
14 : class MouseInput;
15 :
16 : namespace layers {
17 :
18 : // DragTracker simply tracks a sequence of mouse inputs and allows us to tell
19 : // if we are in a drag or not (i.e. the left mouse button went down and hasn't
20 : // gone up yet).
21 0 : class DragTracker
22 : {
23 : public:
24 : DragTracker();
25 : static bool StartsDrag(const MouseInput& aInput);
26 : static bool EndsDrag(const MouseInput& aInput);
27 : void Update(const MouseInput& aInput);
28 : bool InDrag() const;
29 : bool IsOnScrollbar(bool aOnScrollbar);
30 :
31 : private:
32 : Maybe<bool> mOnScrollbar;
33 : bool mInDrag;
34 : };
35 :
36 : } // namespace layers
37 : } // namespace mozilla
38 :
39 : #endif /* mozilla_layers_DragTracker_h */
|