2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/devel-api/adaptor-framework/orientation.h>
20 #include <dali-toolkit/public-api/dali-toolkit-common.h>
21 #include <dali/public-api/object/base-object.h>
22 #include <dali/public-api/signals/dali-signal.h>
39 int angle; ///< one of 0, 90, 180, 270
40 int winResize; ///< true if the window should be resized
41 int width; ///< new window width
42 int height; ///< new window height
45 class Orientation : public BaseObject
48 typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
50 static Orientation* New(Window* window)
52 Orientation* orientation = new Orientation(window);
55 Orientation(Window* window)
60 virtual ~Orientation()
64 int GetDegrees() const
68 float GetRadians() const
72 void OnOrientationChanged( const RotationEvent& rotation )
75 OrientationSignalType& ChangedSignal()
77 return mChangedSignal;
81 Orientation(const Orientation&);
82 Orientation& operator=(Orientation&);
83 OrientationSignalType mChangedSignal;
86 } // Adaptor namespace
87 } // Internal namespace
89 inline Internal::Adaptor::Orientation& GetImplementation (Dali::Orientation& orientation)
91 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
92 BaseObject& handle = orientation.GetBaseObject();
93 return static_cast<Internal::Adaptor::Orientation&>(handle);
95 inline const Internal::Adaptor::Orientation& GetImplementation(const Dali::Orientation& orientation)
97 DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
98 const BaseObject& handle = orientation.GetBaseObject();
99 return static_cast<const Internal::Adaptor::Orientation&>(handle);
102 Orientation::Orientation()
105 Orientation::~Orientation()
108 Orientation::Orientation(const Orientation& handle)
113 Orientation& Orientation::operator=(const Orientation& rhs)
115 BaseHandle::operator=(rhs);
119 int Orientation::GetDegrees() const
121 return GetImplementation(*this).GetDegrees();
124 float Orientation::GetRadians() const
126 return GetImplementation(*this).GetRadians();
129 Orientation::OrientationSignalType& Orientation::ChangedSignal()
131 return GetImplementation(*this).ChangedSignal();
134 Orientation::Orientation( Internal::Adaptor::Orientation* orientation )
135 : BaseHandle(orientation)