1 #ifndef DALI_INTERNAL_ORIENTATION_H
2 #define DALI_INTERNAL_ORIENTATION_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/constants.h>
23 #include <dali/public-api/object/base-object.h>
27 #include <dali/devel-api/adaptor-framework/orientation.h>
28 #include <dali/internal/window-system/common/rotation-event.h>
39 typedef IntrusivePtr<Orientation> OrientationPtr;
41 class Orientation : public BaseObject
44 typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
46 static Orientation* New(Window* window);
51 Orientation(Window* window);
57 ~Orientation() override;
61 * Returns the actual orientation in degrees
62 * @return The device's orientation
64 int GetDegrees() const;
67 * Returns the actual orientation in radians
68 * @return The device's orientation
70 float GetRadians() const;
73 * Called by the Window when orientation is changed
74 * @param[in] rotation The rotation event
76 void OnOrientationChange(const RotationEvent& rotation);
80 * @copydoc Dali::Orientation::ChangedSignal()
82 OrientationSignalType& ChangedSignal();
86 Orientation(const Orientation&);
87 Orientation& operator=(Orientation&);
92 OrientationSignalType mChangedSignal;
99 inline Orientation& GetImplementation(Dali::Orientation& orientation)
101 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
103 BaseObject& handle = orientation.GetBaseObject();
105 return static_cast<Orientation&>(handle);
108 inline const Orientation& GetImplementation(const Dali::Orientation& orientation)
110 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
112 const BaseObject& handle = orientation.GetBaseObject();
114 return static_cast<const Orientation&>(handle);
117 } // namespace Adaptor
119 } // namespace Internal
123 #endif // DALI_INTERNAL_ORIENTATION_H