1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef KEYBOARD_EVENT_H 17 #define KEYBOARD_EVENT_H 18 19 #include "key_event.h" 20 21 namespace OHOS { 22 struct KeyBoardProperty { 23 bool handledByIme; 24 int unicode; 25 bool isSingleNonCharacter; 26 bool isTwoNonCharacters; 27 bool isThreeNonCharacters; 28 }; 29 30 class KeyBoardEvent :public KeyEvent { 31 public: 32 void Initialize(MultimodalProperty &multiProperty, KeyProperty &keyProperty, KeyBoardProperty &keyBoardProperty); 33 34 void EnableIme(); 35 36 void DisableIme(); 37 38 bool IsHandledByIme(); 39 40 virtual bool IsNoncharacterKeyPressed(int keycodeOne); 41 42 virtual bool IsNoncharacterKeyPressed(int keycodeOne, int keycodeTwo); 43 44 virtual bool IsNoncharacterKeyPressed(int keycodeOne, int keycodeTwo, int keycodeThree); 45 46 virtual int GetUnicode(); 47 bool Marshalling(Parcel &parcel) const override; 48 static KeyBoardEvent *Unmarshalling(Parcel &parcel); 49 protected: 50 KeyBoardProperty keyBoardProperty_; 51 }; 52 } // namespace OHOS 53 #endif // KEYBOARD_EVENT_H