• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 I_INPUT_EVENT_HANDLER_H
17 #define I_INPUT_EVENT_HANDLER_H
18 
19 #include <memory>
20 
21 #include "define_multimodal.h"
22 #include "key_event.h"
23 #include "pointer_event.h"
24 
25 struct libinput_event;
26 
27 namespace OHOS {
28 namespace MMI {
29 class IInputEventHandler {
30 public:
31     IInputEventHandler() = default;
32     DISALLOW_COPY_AND_MOVE(IInputEventHandler);
33     virtual ~IInputEventHandler() = default;
34 #ifdef OHOS_BUILD_ENABLE_KEYBOARD
35     virtual void HandleKeyEvent(const std::shared_ptr<KeyEvent> keyEvent) = 0;
36 #endif // OHOS_BUILD_ENABLE_KEYBOARD
37 #ifdef OHOS_BUILD_ENABLE_POINTER
38     virtual void HandlePointerEvent(const std::shared_ptr<PointerEvent> pointerEvent) = 0;
39 #endif // OHOS_BUILD_ENABLE_POINTER
40 #ifdef OHOS_BUILD_ENABLE_TOUCH
41     virtual void HandleTouchEvent(const std::shared_ptr<PointerEvent> pointerEvent) = 0;
42 #endif // OHOS_BUILD_ENABLE_TOUCH
SetNext(std::shared_ptr<IInputEventHandler> nextHandler)43     virtual void SetNext(std::shared_ptr<IInputEventHandler> nextHandler)
44     {
45         nextHandler_ = nextHandler;
46     };
47 
48 protected:
49     std::shared_ptr<IInputEventHandler> nextHandler_ { nullptr };
50 };
51 } // namespace MMI
52 } // namespace OHOS
53 #endif // I_INPUT_EVENT_HANDLER_H