1 #ifndef DALI_INTERNAL_ORIENTATION_H
2 #define DALI_INTERNAL_ORIENTATION_H
5 * Copyright (c) 2019 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.
23 #include <dali/public-api/common/constants.h>
24 #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>
41 typedef IntrusivePtr<Orientation> OrientationPtr;
43 class Orientation : public BaseObject
47 typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
49 static Orientation* New(Window* window);
54 Orientation(Window* window);
60 virtual ~Orientation();
65 * Returns the actual orientation in degrees
66 * @return The device's orientation
68 int GetDegrees() const;
71 * Returns the actual orientation in radians
72 * @return The device's orientation
74 float GetRadians() const;
77 * Called by the Window when orientation is changed
78 * @param[in] rotation The rotation event
80 void OnOrientationChange( const RotationEvent& rotation );
85 * @copydoc Dali::Orientation::ChangedSignal()
87 OrientationSignalType& ChangedSignal();
92 Orientation(const Orientation&);
93 Orientation& operator=(Orientation&);
99 OrientationSignalType mChangedSignal;
106 inline Orientation& GetImplementation (Dali::Orientation& orientation)
108 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
110 BaseObject& handle = orientation.GetBaseObject();
112 return static_cast<Orientation&>(handle);
115 inline const Orientation& GetImplementation(const Dali::Orientation& orientation)
117 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
119 const BaseObject& handle = orientation.GetBaseObject();
121 return static_cast<const Orientation&>(handle);
124 } // namespace Adaptor
126 } // namespace Internal
130 #endif // DALI_INTERNAL_ORIENTATION_H