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 ACCESSIBILITY_GESTURE_INJECT_PATH_H 17 #define ACCESSIBILITY_GESTURE_INJECT_PATH_H 18 19 #include <vector> 20 21 namespace OHOS { 22 namespace Accessibility { 23 struct AccessibilityGesturePosition { 24 float positionX_ = .0f; 25 float positionY_ = .0f; 26 }; 27 28 class AccessibilityGestureInjectPath { 29 public: 30 /** 31 * @brief The constructor of AccessibilityGestureInjectPath 32 */ 33 AccessibilityGestureInjectPath() = default; 34 35 /** 36 * @brief The deconstructor of AccessibilityGestureInjectPath 37 */ 38 ~AccessibilityGestureInjectPath() = default; 39 40 /** 41 * @brief Obtains the duration in which this gesture path continues. 42 * @return Return the duration in which this gesture path continues. 43 */ 44 int64_t GetDurationTime() const; 45 46 /** 47 * @brief Obtains all positions of this gesture path. 48 * @return Return all positions of this gesture path. 49 */ 50 const std::vector<AccessibilityGesturePosition> &GetPositions() const; 51 52 /** 53 * @brief Sets the duration for this gesture path to continue. 54 * @param durationTime The duration for this gesture path to continue. 55 */ 56 void SetDurationTime(int64_t durationTime); 57 58 /** 59 * @brief Add a position of this gesture path. 60 * @param position A position of this gesture path. 61 */ 62 void AddPosition(AccessibilityGesturePosition &position); 63 64 protected: 65 std::vector<AccessibilityGesturePosition> positions_; 66 int64_t durationTime_ = 0; 67 }; 68 } // namespace Accessibility 69 } // namespace OHOS 70 #endif // ACCESSIBILITY_GESTURE_INJECT_PATH_H