1 /* 2 * Copyright (c) 2020-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 GRAPHIC_LITE_ROTATE_EVENT_H 17 #define GRAPHIC_LITE_ROTATE_EVENT_H 18 /** 19 * @addtogroup Graphic 20 * @{ 21 * 22 * @brief Defines a lightweight graphics system that provides basic UI and container views, 23 * including buttons, images, labels, lists, animators, scroll views, swipe views, and layouts. 24 * This system also provides the Design for X (DFX) capability to implement features such as 25 * view rendering, animation, and input event distribution. 26 * 27 * @since 1.0 28 * @version 1.0 29 */ 30 31 /** 32 * @file rotate_event.h 33 * 34 * @brief Declares a <b>RotateEvent</b>, which usually occurs on a knob. 35 * 36 * @since 5.0 37 * @version 3.0 38 */ 39 40 #include "event.h" 41 42 namespace OHOS { 43 /** 44 * @brief Defines a <b>RotateEvent</b>, which usually occurs on a knob. 45 * 46 * @since 5.0 47 * @version 3.0 48 */ 49 class RotateEvent : public Event { 50 public: 51 RotateEvent() = delete; 52 53 /** 54 * @brief A constructor used to create a <b>RotateEvent</b> instance. 55 * @param rotate Indicates the short data representing the number reported by a <b>RotateEvent</b>. 56 * 57 * @since 5.0 58 * @version 3.0 59 */ RotateEvent(int16_t rotate)60 RotateEvent(int16_t rotate) : rotate_(static_cast<int16_t>(rotate * ROTATE_SENSITIVITY)) {} // Rotation direction 61 ~RotateEvent()62 ~RotateEvent() {} 63 64 /** 65 * @brief Obtains the number reported by a <b>RotateEvent</b>. 66 * @return Returns the number reported by a <b>RotateEvent</b>. 67 * 68 * @since 5.0 69 * @version 3.0 70 */ GetRotate()71 int16_t GetRotate() const 72 { 73 return rotate_; 74 } 75 76 private: 77 int16_t rotate_; 78 }; 79 } // namespace OHOS 80 #endif // GRAPHIC_LITE_ROTATE_EVENT_H 81