1 #ifndef __DALI_INTERNAL_ORIENTATION_H__
2 #define __DALI_INTERNAL_ORIENTATION_H__
5 * Copyright (c) 2014 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 <orientation.h>
28 #include <rotation-observer.h>
42 typedef IntrusivePtr<Orientation> OrientationPtr;
44 class Orientation : public BaseObject, public RotationObserver
48 typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
50 static Orientation* New(Window* window);
55 Orientation(Window* window);
61 virtual ~Orientation();
65 * Set the adaptor for basic setup
66 * @param[in] adaptor The adaptor
68 void SetAdaptor(Dali::Adaptor& adaptor);
71 * Returns the actual orientation in degrees
72 * @return The device's orientation
74 int GetDegrees() const;
77 * Returns the actual orientation in radians
78 * @return The device's orientation
80 float GetRadians() const;
85 * @copydoc Dali::Orientation::ChangedSignal()
87 OrientationSignalType& ChangedSignal();
91 * @copydoc Dali::Internal::Adaptor::RotationObserver::OnRotationPrepare()
93 virtual void OnRotationPrepare( const RotationEvent& rotation );
96 * @copydoc Dali::Internal::Adaptor::RotationObserver::OnRotationRequest()
98 virtual void OnRotationRequest( );
101 Orientation(const Orientation&);
102 Orientation& operator=(Orientation&);
106 * Signals and sends event of orientation change.
108 void EmitOrientationChange();
114 OrientationSignalType mChangedSignal;
121 inline Orientation& GetImplementation (Dali::Orientation& orientation)
123 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
125 BaseObject& handle = orientation.GetBaseObject();
127 return static_cast<Orientation&>(handle);
130 inline const Orientation& GetImplementation(const Dali::Orientation& orientation)
132 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
134 const BaseObject& handle = orientation.GetBaseObject();
136 return static_cast<const Orientation&>(handle);
139 } // namespace Adaptor
141 } // namespace Internal
145 #endif // __DALI_INTERNAL_ORIENTATION_H__