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-observer.h>
43 typedef IntrusivePtr<Orientation> OrientationPtr;
45 class Orientation : public BaseObject, public RotationObserver
49 typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
51 static Orientation* New(Window* window);
56 Orientation(Window* window);
62 virtual ~Orientation();
66 * Set the adaptor for basic setup
67 * @param[in] adaptor The adaptor
69 void SetAdaptor(Dali::Adaptor& adaptor);
72 * Set the adaptor for basic setup
73 * @param[in] adaptor The adaptor
75 void SetAdaptor(Adaptor& adaptor);
78 * Returns the actual orientation in degrees
79 * @return The device's orientation
81 int GetDegrees() const;
84 * Returns the actual orientation in radians
85 * @return The device's orientation
87 float GetRadians() const;
92 * @copydoc Dali::Orientation::ChangedSignal()
94 OrientationSignalType& ChangedSignal();
98 * @copydoc Dali::Internal::Adaptor::RotationObserver::OnRotationPrepare()
100 virtual void OnRotationPrepare( const RotationEvent& rotation );
103 * @copydoc Dali::Internal::Adaptor::RotationObserver::OnRotationRequest()
105 virtual void OnRotationRequest( );
108 Orientation(const Orientation&);
109 Orientation& operator=(Orientation&);
113 * Signals and sends event of orientation change.
115 void EmitOrientationChange();
121 OrientationSignalType mChangedSignal;
128 inline Orientation& GetImplementation (Dali::Orientation& orientation)
130 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
132 BaseObject& handle = orientation.GetBaseObject();
134 return static_cast<Orientation&>(handle);
137 inline const Orientation& GetImplementation(const Dali::Orientation& orientation)
139 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
141 const BaseObject& handle = orientation.GetBaseObject();
143 return static_cast<const Orientation&>(handle);
146 } // namespace Adaptor
148 } // namespace Internal
152 #endif // DALI_INTERNAL_ORIENTATION_H