Jeff Brown | 5541de9 | 2011-04-11 11:54:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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_SPOT_CONTROLLER_H |
| 18 | #define _UI_SPOT_CONTROLLER_H |
| 19 | |
| 20 | #include "SpriteController.h" |
| 21 | |
| 22 | #include <utils/RefBase.h> |
| 23 | #include <utils/Looper.h> |
| 24 | |
| 25 | #include <SkBitmap.h> |
| 26 | |
| 27 | namespace android { |
| 28 | |
| 29 | /* |
| 30 | * Interface for displaying spots on screen that visually represent the positions |
| 31 | * of fingers on a touch pad. |
| 32 | * |
| 33 | * The spot controller is responsible for providing synchronization and for tracking |
| 34 | * display orientation changes if needed. |
| 35 | */ |
| 36 | class SpotControllerInterface : public virtual RefBase { |
| 37 | protected: |
| 38 | SpotControllerInterface() { } |
| 39 | virtual ~SpotControllerInterface() { } |
| 40 | |
| 41 | public: |
| 42 | |
| 43 | }; |
| 44 | |
| 45 | |
| 46 | /* |
| 47 | * Sprite-based spot controller implementation. |
| 48 | */ |
| 49 | class SpotController : public SpotControllerInterface, public MessageHandler { |
| 50 | protected: |
| 51 | virtual ~SpotController(); |
| 52 | |
| 53 | public: |
| 54 | SpotController(const sp<Looper>& looper, const sp<SpriteController>& spriteController); |
| 55 | |
| 56 | private: |
| 57 | mutable Mutex mLock; |
| 58 | |
| 59 | sp<Looper> mLooper; |
| 60 | sp<SpriteController> mSpriteController; |
| 61 | sp<WeakMessageHandler> mHandler; |
| 62 | |
| 63 | struct Locked { |
| 64 | } mLocked; |
| 65 | |
| 66 | void handleMessage(const Message& message); |
| 67 | }; |
| 68 | |
| 69 | } // namespace android |
| 70 | |
| 71 | #endif // _UI_SPOT_CONTROLLER_H |