• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_INFO_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_INFO_H
18 
19 #include <optional>
20 
21 #include "base/memory/ace_type.h"
22 #include "core/components/common/layout/constants.h"
23 #include "core/gestures/gesture_info.h"
24 
25 namespace OHOS::Ace::NG {
26 
27 class ACE_EXPORT GestureInfo : public virtual AceType {
28     DECLARE_ACE_TYPE(GestureInfo, AceType);
29 
30 public:
31     GestureInfo() = default;
GestureInfo(std::string tag,GestureTypeName type,bool isSystemGesture)32     GestureInfo(std::string tag, GestureTypeName type, bool isSystemGesture)
33         : tag_(std::move(tag)), type_(type), isSystemGesture_(isSystemGesture)
34     {}
GestureInfo(GestureTypeName type,bool isSystemGesture)35     GestureInfo(GestureTypeName type, bool isSystemGesture) : type_(type), isSystemGesture_(isSystemGesture) {}
GestureInfo(std::string tag)36     explicit GestureInfo(std::string tag) : tag_(std::move(tag)) {}
GestureInfo(GestureTypeName type)37     explicit GestureInfo(GestureTypeName type) : type_(type) {}
GestureInfo(bool isSystemGesture)38     explicit GestureInfo(bool isSystemGesture) : isSystemGesture_(isSystemGesture) {}
39     ~GestureInfo() override = default;
40 
GetTag()41     std::optional<std::string> GetTag() const
42     {
43         return tag_;
44     }
45 
GetType()46     GestureTypeName GetType() const
47     {
48         return type_;
49     }
50 
GetInputEventType()51     InputEventType GetInputEventType() const
52     {
53         return inputEventType_;
54     }
55 
IsSystemGesture()56     bool IsSystemGesture() const
57     {
58         return isSystemGesture_;
59     }
60 
SetTag(std::string tag)61     void SetTag(std::string tag)
62     {
63         tag_ = std::move(tag);
64     }
65 
SetType(GestureTypeName type)66     void SetType(GestureTypeName type)
67     {
68         type_ = type;
69     }
70 
SetInputEventType(InputEventType type)71     void SetInputEventType(InputEventType type)
72     {
73         inputEventType_ = type;
74     }
75 
SetIsSystemGesture(bool isSystemGesture)76     void SetIsSystemGesture(bool isSystemGesture)
77     {
78         isSystemGesture_ = isSystemGesture;
79     }
80 
81 private:
82     std::optional<std::string> tag_;
83     GestureTypeName type_ = GestureTypeName::UNKNOWN;
84     InputEventType inputEventType_ = InputEventType::TOUCH_SCREEN;
85     bool isSystemGesture_ = false;
86 };
87 } // namespace OHOS::Ace::NG
88 
89 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_INFO_H
90