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 MMI_VKEYBOARD_H
17 #define MMI_VKEYBOARD_H
18 #include <string>
19 
20 namespace OHOS {
21 namespace MMI {
22 using namespace std;
23 struct TOUCHPOINT
24 {
25     /// <summary>
26     /// Button name.
27     /// </summary>
28     string ButtonName;
29 
30     /// <summary>
31     /// Button width.
32     /// </summary>
33     double ButtonWidth = 0.0;
34 
35     /// <summary>
36     /// Button height.
37     /// </summary>
38     double ButtonHeight = 0.0;
39 
40     /// <summary>
41     /// touch area width (0 if not supported).
42     /// </summary>
43     int Width = 0;
44 
45     /// <summary>
46     /// touch area height (0 if not supported).
47     /// </summary>
48     int Height = 0;
49 
50     /// <summary>
51     /// raw touch x. (previous lower case x).
52     /// </summary>
53     int RawX = 0;
54 
55     /// <summary>
56     /// raw touch y. (previous lower case y).
57     /// </summary>
58     int RawY = 0;
59 
60     /// <summary>
61     /// canvas max x.
62     /// </summary>
63     int MaxX = 0;
64 
65     /// <summary>
66     /// canvas max y.
67     /// </summary>
68     int MaxY = 0;
69 
70     /// <summary>
71     /// canvas min x.
72     /// </summary>
73     int MinX = 0;
74 
75     /// <summary>
76     /// canvas min y.
77     /// </summary>
78     int MinY = 0;
79 
80     /// <summary>
81     /// scaled screen x. (previous upper case X).
82     /// </summary>
83     double ScreenX = 0.0;
84 
85     /// <summary>
86     /// scaled screen y. (previous upper case Y).
87     /// </summary>
88     double ScreenY = 0.0;
89 
90     /// <summary>
91     /// if the touch inside the keyboard.
92     /// </summary>
93     bool InKeyboard;
94 
95     /// <summary>
96     /// if the touch inside the trackpad.
97     /// </summary>
98     bool InTrackpad;
99 
100     /// <summary>
101     /// touch id.
102     /// </summary>
103     int TouchId = 0;
104 
105     /// <summary>
106     /// true - touch down; false - touch up.
107     /// </summary>
108     bool TipDown;
109 
110     /// <summary>
111     /// if Bayesian model effective.
112     /// </summary>
113     bool IsBayesian;
114 
115     /// <summary>
116     /// If Palm is Detected. (not implemented).
117     /// </summary>
118     bool IsPalmDetected;
119 };
120 
121 struct MMITouchpoint
122 {
123     int PointerId;
124     double X;
125     double Y;
126     string ButtonName;
127 };
128 
129 enum StateMachineMessageType
130 {
131     NoMessage = -1,
132     KeyPressed = 0,
133     CombinationKeyPressed,
134     ButtonSound,
135     TogglePinOn,
136     TogglePinOff,
137     DisableProtection,
138     BuildButtonMotionSpace,
139     ButtonHaptic,
140     EnableTrackpadSeparator,
141     DisableTrackpadSeparator,
142     ShowTaskbar,
143     SetButtonContent,
144     StartBackspace,
145     StopBackspace,
146     ResetButtonColor,
147     DelayUpdateButtonTouchDownVisual,
148     StartLongPressControl,
149     StopLongPressControl,
150     SwitchLayout,
151     SwipeUp,
152     BackSwipeLeft,
153     BackSwipeRight,
154     BackspaceSwipeRelease,
155 };
156 
157 class StateMachineMessage
158 {
159 public:
160     StateMachineMessageType type;
161     string buttonName;
162     string toggleButtonName;
163     int buttonMode = 0;
164     string RestList;
165     double interval = 0.0;
166     double locX = 0.0;
167     double locY = 0.0;
168 };
169 
170 enum class MotionSpaceType : int32_t {
171     // Full keyboard with narrow key gap.
172     NARROW = 0,
173     // Full keyboard with wide key gap.
174     WIDE = 1,
175     // Floating keyboard
176     FLOATING = 2,
177     // Trackpad UI-related motion space.
178     TRACKPAD = 3,
179     // Init value.
180     OTHERS = 10,
181 };
182 
183 class MotionSpacePatternIndex {
184 public:
185 	// Access to inside values from IPC package motion space pattern.
186     // Top left x.
187 	static const int PATTERN_X = 0;
188     // Top left y.
189     static const int PATTERN_Y = 1;
190     // Width.
191     static const int PATTERN_WIDTH = 2;
192     // Height.
193     static const int PATTERN_HEIGHT = 3;
194     // Key code.
195     static const int PATTERN_KEYCODE = 4;
196     // Motion space type id.
197     static const int PATTERN_MST_ID = 5;
198     // Page type id.
199     static const int PATTERN_PT_ID = 6;
200     // Size of the entire motion space pattern.
201     static const size_t PATTERN_SIZE = 7;
202 };
203 
204 enum TouchMode {
205     NO_TOUCH = 0,
206     TOUCH_ENTER_MODE = 1,
207     LIGHT_TOUCH_MODE = 2,
208     HEAVY_TOUCH_MODE = 3,
209     REST_TOUCH_MODE = 4,
210     ANCHORING_MODE = 5,
211     FITTING_MODE = 6,
212     LEAVE_SCREEN_MODE = 7,
213     MULTI_TOUCH_MODE = 8,
214 };
215 
216 /// <summary>
217 /// GestureMode stands for a working pattern of gesture in a given time duration
218 /// </summary>
219 enum class VGestureMode : int32_t {
220     NO_GESTURE = 0,
221     // Generic mode
222     MOTION_MODE = 1,
223     // Gestures in detailed defines
224     // Gtart of window operation gesture
225     WINDOW_GESTURE_BEGIN = 2,
226     ONE_HAND_TAP = 2,
227     ONE_HAND_UP = 3,
228     ONE_HAND_DOWN = 4,
229     TWO_HANDS_LOWER_TAP = 5,
230     TWO_HANDS_UPPER_TAP = 6,
231     TWO_HANDS_UP = 7,
232     TWO_HANDS_DOWN = 8,
233     TWO_HANDS_INWARDS = 9,
234     TWO_HANDS_OUTWARDS = 10,
235     // End of window operation gesture
236     WINDOW_GESTURE_END = 10,
237     PINCHING_MODE = 11,
238     PANNING_MODE = 12,
239     SWIPING_MODE = 13,
240     SWIPE_BACKSPACE_LEFT = 14,
241     SWIPE_BACKSPACE_RIGHT = 15,
242 };
243 } // namespace MMI
244 } // namespace OHOS
245 #endif // MMI_VKEYBOARD_H
246