1 /*
2 * Copyright (c) 2021-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 INPUT_MONITOR_MANAGER_H
17 #define INPUT_MONITOR_MANAGER_H
18
19 #include "nocopyable.h"
20
21 #include "input_handler_manager.h"
22
23 namespace OHOS {
24 namespace MMI {
25 class InputMonitorManager final : public InputHandlerManager {
26 public:
27 DISALLOW_COPY_AND_MOVE(InputMonitorManager);
28
29 int32_t AddGestureMonitor(std::shared_ptr<IInputEventConsumer> consumer,
30 TouchGestureType type, int32_t fingers);
31 int32_t RemoveGestureMonitor(int32_t monitorId);
32 int32_t AddMonitor(std::shared_ptr<IInputEventConsumer> monitor,
33 HandleEventType eventType = HANDLE_EVENT_TYPE_KP);
34 int32_t RemoveMonitor(int32_t monitorId);
35 int32_t AddMonitor(std::shared_ptr<IInputEventConsumer> monitor,
36 std::vector<int32_t> actionsType);
37 void MarkConsumed(int32_t monitorId, int32_t eventId);
38 InputHandlerType GetHandlerType() const override;
39 static InputMonitorManager &GetInstance();
40
41 private:
42 InputMonitorManager() = default;
43 bool CheckMonitorValid(TouchGestureType type, int32_t fingers) override;
44 };
45
GetHandlerType()46 inline InputHandlerType InputMonitorManager::GetHandlerType() const
47 {
48 return InputHandlerType::MONITOR;
49 }
50
51 #define IMonitorMgr ::OHOS::MMI::InputMonitorManager::GetInstance()
52 } // namespace MMI
53 } // namespace OHOS
54 #endif // INPUT_MONITOR_MANAGER_H