1 /* 2 * Copyright (C) 2021 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 MANIPULATION_EVENT_H 17 #define MANIPULATION_EVENT_H 18 19 #include "mmi_point.h" 20 #include "multimodal_event.h" 21 22 namespace OHOS { 23 struct ManipulationProperty { 24 unsigned int startTime; 25 int operationState; 26 int pointerCount; 27 int pointerId; 28 MmiPoint mp; 29 float touchArea; 30 float touchPressure; 31 float offsetX; 32 float offsetY; 33 }; 34 35 const int MAX_TOUCH_NUM = 10; 36 37 class ManipulationEvent : public MultimodalEvent { 38 public: 39 void Initialize(MultimodalProperty &multiProperty, ManipulationProperty &ManipulationProperty); 40 41 virtual int32_t GetStartTime(); 42 43 virtual int GetPhase(); 44 45 virtual MmiPoint GetPointerPosition(int index); 46 47 virtual void SetScreenOffset(float offsetX, float offsetY); 48 49 virtual MmiPoint GetPointerScreenPosition(int index); 50 51 virtual int GetPointerCount(); 52 53 virtual int GetPointerId(int index); 54 55 virtual float GetForce(int index); 56 57 virtual float GetRadius(int index); 58 bool Marshalling(Parcel &parcel) const override; 59 static ManipulationEvent *Unmarshalling(Parcel &parcel); 60 61 static constexpr int PHASE_NONE = 0; 62 63 static constexpr int PHASE_START = 1; 64 65 static constexpr int PHASE_MOVE = 2; 66 67 static constexpr int PHASE_COMPLETED = 3; 68 69 static constexpr int PHASE_CANCEL = 4; 70 protected: 71 ManipulationProperty manipulationProperty_; 72 }; 73 } // namespace OHOS 74 #endif // MANIPULATION_EVENT_H