Updated CAPI documentation style.
[platform/core/uifw/dali-adaptor.git] / capi / dali / public-api / adaptor-framework / common / orientation.h
1 #ifndef __DALI_ORIENTATION_H__
2 #define __DALI_ORIENTATION_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @addtogroup CAPI_DALI_ADAPTOR_MODULE
22  * @{
23  */
24
25 // EXTERNAL INCLUDES
26 #include <boost/function.hpp>
27
28 #include <dali/public-api/signals/dali-signal-v2.h>
29 #include <dali/public-api/object/base-handle.h>
30
31 namespace Dali DALI_IMPORT_API
32 {
33
34 namespace Internal DALI_INTERNAL
35 {
36 namespace Adaptor
37 {
38 class Orientation;
39 }
40 }
41
42 /**
43  * @brief Orientation allows the user to determine the orientation of the device.
44  *
45  * A signal is emitted whenever the orientation changes.
46  * Dali applications have full control over visual layout when the device is rotated
47  * i.e. the application developer decides which UI controls to rotate, if any.
48  */
49 class Orientation : public BaseHandle
50 {
51 public:
52
53   typedef SignalV2< void (Orientation) > OrientationSignalV2; ///< Orientation changed signal type
54
55   /**
56    * @brief Create an unintialized handle.
57    *
58    * This can be initialized by calling Dali::Application::GetOrientation()
59    */
60   Orientation();
61
62   /**
63    * @brief Virtual Destructor
64    */
65   virtual ~Orientation();
66
67   /**
68    * @copydoc Dali::BaseHandle::operator=
69    */
70   using BaseHandle::operator=;
71
72
73   /**
74    * @brief Returns the orientation of the device in degrees.
75    *
76    * This is one of four discrete values, in degrees clockwise: 0, 90, 180, & 270
77    * For a device with a portrait form-factor:
78    *   0 indicates that the device is in the "normal" portrait orientation.
79    *   90 indicates that device has been rotated clockwise, into a landscape orientation.
80    * @return The orientation in degrees clockwise.
81    */
82   int GetDegrees() const;
83
84   /**
85    * @brief Returns the orientation of the device in radians.
86    *
87    * This is one of four discrete values, in radians clockwise: 0, PI/2, PI, & 3xPI/2
88    * For a device with a portrait form-factor:
89    *   0 indicates that the device is in the "normal" portrait orientation.
90    *   PI/2 indicates that device has been rotated clockwise, into a landscape orientation.
91    * @return The orientation in radians clockwise.
92    */
93   float GetRadians() const;
94
95   /**
96    * @brief The user should connect to this signal so that they can be notified whenever
97    * the orientation of the device changes.
98    *
99    * @return The orientation change signal.
100    */
101   OrientationSignalV2& ChangedSignal();
102
103 public: // Not intended for application developers
104   /**
105    * @brief This constructor is used by Dali::Application::GetOrientation().
106    *
107    * @param[in] orientation A pointer to the orientation object
108    */
109   explicit DALI_INTERNAL Orientation( Internal::Adaptor::Orientation* orientation );
110 };
111
112 } // namespace Dali
113
114 /**
115  * @}
116  */
117 #endif // __DALI_ORIENTATION_H__