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 #include "keyboard_event.h"
17 namespace OHOS {
Initialize(MultimodalProperty & multiProperty,KeyProperty & keyProperty,KeyBoardProperty & keyBoardProperty)18 void KeyBoardEvent::Initialize(MultimodalProperty &multiProperty,
19 KeyProperty &keyProperty,
20 KeyBoardProperty &keyBoardProperty)
21 {
22 KeyEvent::Initialize(multiProperty, keyProperty);
23 keyBoardProperty_.handledByIme = keyBoardProperty.handledByIme;
24 keyBoardProperty_.unicode = keyBoardProperty.unicode;
25 keyBoardProperty_.isSingleNonCharacter = keyBoardProperty.isSingleNonCharacter;
26 keyBoardProperty_.isTwoNonCharacters = keyBoardProperty.isTwoNonCharacters;
27 keyBoardProperty_.isThreeNonCharacters = keyBoardProperty.isThreeNonCharacters;
28 }
29
EnableIme()30 void KeyBoardEvent::EnableIme()
31 {
32 }
33
DisableIme()34 void KeyBoardEvent::DisableIme()
35 {
36 }
37
IsHandledByIme()38 bool KeyBoardEvent::IsHandledByIme()
39 {
40 return keyBoardProperty_.handledByIme;
41 }
42
IsNoncharacterKeyPressed(int keycodeOne)43 bool KeyBoardEvent::IsNoncharacterKeyPressed(int keycodeOne)
44 {
45 return keyBoardProperty_.isSingleNonCharacter;
46 }
47
IsNoncharacterKeyPressed(int keycodeOne,int keycodeTwo)48 bool KeyBoardEvent::IsNoncharacterKeyPressed(int keycodeOne, int keycodeTwo)
49 {
50 return keyBoardProperty_.isTwoNonCharacters;
51 }
52
IsNoncharacterKeyPressed(int keycodeOne,int keycodeTwo,int keycodeThree)53 bool KeyBoardEvent::IsNoncharacterKeyPressed(int keycodeOne, int keycodeTwo, int keycodeThree)
54 {
55 return keyBoardProperty_.isThreeNonCharacters;
56 }
57
GetUnicode()58 int KeyBoardEvent::GetUnicode()
59 {
60 return keyBoardProperty_.unicode;
61 }
62
Marshalling(Parcel & parcel) const63 bool KeyBoardEvent::Marshalling(Parcel &parcel) const
64 {
65 return false;
66 }
67
Unmarshalling(Parcel & parcel)68 KeyBoardEvent *KeyBoardEvent::Unmarshalling(Parcel &parcel)
69 {
70 return new (std::nothrow) KeyBoardEvent();
71 }
72 }
73