1 /*
2  * Copyright (c) 2024 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 GESTURE_MONITOR_HANDLER_H
17 #define GESTURE_MONITOR_HANDLER_H
18 
19 #include <map>
20 #include <set>
21 #include <nocopyable.h>
22 #include "input_handler_type.h"
23 
24 namespace OHOS {
25 namespace MMI {
26 struct GestureMonitorHandler {
27     GestureMonitorHandler() = default;
28     GestureMonitorHandler(const GestureMonitorHandler &other);
29     ~GestureMonitorHandler() = default;
30     DISALLOW_MOVE(GestureMonitorHandler);
31     GestureMonitorHandler& operator=(const GestureMonitorHandler &other);
32 
33     static bool CheckMonitorValid(TouchGestureType type, int32_t fingers);
34     static bool IsTouchGestureEvent(int32_t pointerAction);
35 
36     bool IsMatchGesture(int32_t action, int32_t count) const;
37     void AddGestureMonitor(TouchGestureType type, int32_t fingers);
38     bool RemoveGestureMonitor(TouchGestureType type, int32_t fingers);
39 
40     int32_t fingers_ { 0 };
41     TouchGestureType gestureType_ { TOUCH_GESTURE_TYPE_NONE };
42     std::multimap<TouchGestureType, std::set<int32_t>> touchGestureInfo_;
43 };
44 } // namespace MMI
45 } // namespace OHOS
46 #endif // GESTURE_MONITOR_HANDLER_H