Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_layers_DragTracker_h
8
#define mozilla_layers_DragTracker_h
9
10
#include "mozilla/EventForwards.h"
11
#include "mozilla/Maybe.h"
12
13
namespace mozilla {
14
15
class MouseInput;
16
17
namespace layers {
18
19
// DragTracker simply tracks a sequence of mouse inputs and allows us to tell
20
// if we are in a drag or not (i.e. the left mouse button went down and hasn't
21
// gone up yet).
22
class DragTracker {
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 */