blob: 4db24e5369e10832902ab36551c8bdeab8d01619 [file] [log] [blame]
Jeff Brown83c09682010-12-23 17:50:18 -08001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _UI_POINTER_CONTROLLER_H
18#define _UI_POINTER_CONTROLLER_H
19
20#include <utils/RefBase.h>
21
22namespace android {
23
24enum {
25 POINTER_BUTTON_1 = 1 << 0,
26};
27
28/**
29 * Interface for tracking a single (mouse) pointer.
30 *
31 * The pointer controller is responsible for providing synchronization and for tracking
32 * display orientation changes if needed.
33 */
34class PointerControllerInterface : public virtual RefBase {
35protected:
36 PointerControllerInterface() { }
37 virtual ~PointerControllerInterface() { }
38
39public:
40 /* Gets the bounds of the region that the pointer can traverse.
41 * Returns true if the bounds are available. */
42 virtual bool getBounds(float* outMinX, float* outMinY,
43 float* outMaxX, float* outMaxY) const = 0;
44
45 /* Move the pointer. */
46 virtual void move(float deltaX, float deltaY) = 0;
47
48 /* Sets a mask that indicates which buttons are pressed. */
49 virtual void setButtonState(uint32_t buttonState) = 0;
50
51 /* Gets a mask that indicates which buttons are pressed. */
52 virtual uint32_t getButtonState() const = 0;
53
54 /* Sets the absolute location of the pointer. */
55 virtual void setPosition(float x, float y) = 0;
56
57 /* Gets the absolute location of the pointer. */
58 virtual void getPosition(float* outX, float* outY) const = 0;
59};
60
61} // namespace android
62
63#endif // _UI_POINTER_CONTROLLER_H