Dali 3D User Interface Engine
orientation-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_ORIENTATION_H__
2 #define __DALI_INTERNAL_ORIENTATION_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <cmath>
25 
26 // INTERNAL INCLUDES
27 #include <orientation.h>
28 #include <rotation-observer.h>
29 
30 namespace Dali
31 {
32 class Adaptor;
33 
34 namespace Internal
35 {
36 
37 namespace Adaptor
38 {
39 class Window;
41 
43 
44 class Orientation : public BaseObject, public RotationObserver
45 {
46 public:
47 
48  typedef Dali::Orientation::OrientationSignalType OrientationSignalType;
49 
50  static Orientation* New(Window* window);
51 
55  Orientation(Window* window);
56 
57 protected:
61  virtual ~Orientation();
62 
63 public:
68  void SetAdaptor(Dali::Adaptor& adaptor);
69 
74  int GetDegrees() const;
75 
80  float GetRadians() const;
81 
82 public: // Signals
83 
88 
89 private:
93  virtual void OnRotationPrepare( const RotationEvent& rotation );
94 
98  virtual void OnRotationRequest( );
99 
100  // Undefined
101  Orientation(const Orientation&);
103 
104 private:
108  void EmitOrientationChange();
109 
110 private:
111 
113 
115 
119 };
120 
121 inline Orientation& GetImplementation (Dali::Orientation& orientation)
122 {
123  DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
124 
125  BaseObject& handle = orientation.GetBaseObject();
126 
127  return static_cast<Orientation&>(handle);
128 }
129 
130 inline const Orientation& GetImplementation(const Dali::Orientation& orientation)
131 {
132  DALI_ASSERT_ALWAYS(orientation && "Orientation handle is empty");
133 
134  const BaseObject& handle = orientation.GetBaseObject();
135 
136  return static_cast<const Orientation&>(handle);
137 }
138 
139 } // namespace Adaptor
140 
141 } // namespace Internal
142 
143 } // namespace Dali
144 
145 #endif // __DALI_INTERNAL_ORIENTATION_H__
Dali Docs Home
Read more about Dali