michael@0: /* michael@0: * Copyright (C) 2010 The Android Open Source Project michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef _ANDROIDFW_VIRTUAL_KEY_MAP_H michael@0: #define _ANDROIDFW_VIRTUAL_KEY_MAP_H michael@0: michael@0: #include michael@0: michael@0: #include "Input.h" michael@0: #include michael@0: #include michael@0: #include "Tokenizer.h" michael@0: #include michael@0: #include michael@0: michael@0: namespace android { michael@0: michael@0: /* Describes a virtual key. */ michael@0: struct VirtualKeyDefinition { michael@0: int32_t scanCode; michael@0: michael@0: // configured position data, specified in display coords michael@0: int32_t centerX; michael@0: int32_t centerY; michael@0: int32_t width; michael@0: int32_t height; michael@0: }; michael@0: michael@0: michael@0: /** michael@0: * Describes a collection of virtual keys on a touch screen in terms of michael@0: * virtual scan codes and hit rectangles. michael@0: * michael@0: * This object is immutable after it has been loaded. michael@0: */ michael@0: class VirtualKeyMap { michael@0: public: michael@0: ~VirtualKeyMap(); michael@0: michael@0: static status_t load(const String8& filename, VirtualKeyMap** outMap); michael@0: michael@0: inline const Vector& getVirtualKeys() const { michael@0: return mVirtualKeys; michael@0: } michael@0: michael@0: private: michael@0: class Parser { michael@0: VirtualKeyMap* mMap; michael@0: Tokenizer* mTokenizer; michael@0: michael@0: public: michael@0: Parser(VirtualKeyMap* map, Tokenizer* tokenizer); michael@0: ~Parser(); michael@0: status_t parse(); michael@0: michael@0: private: michael@0: bool consumeFieldDelimiterAndSkipWhitespace(); michael@0: bool parseNextIntField(int32_t* outValue); michael@0: }; michael@0: michael@0: Vector mVirtualKeys; michael@0: michael@0: VirtualKeyMap(); michael@0: }; michael@0: michael@0: } // namespace android michael@0: michael@0: #endif // _ANDROIDFW_KEY_CHARACTER_MAP_H