[3.0] Update doxygen comments
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / adaptor-framework / window.h
1 #ifndef __DALI_WINDOW_H__
2 #define __DALI_WINDOW_H__
3
4 /*
5  * Copyright (c) 2015 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 <string>
23 #include <dali/public-api/math/rect.h>
24 #include <dali/public-api/math/vector2.h>
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/object/any.h>
27 #include <dali/public-api/signals/dali-signal.h>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_adaptor_framework
33  * @{
34  */
35
36 typedef Dali::Rect<int> PositionSize;
37
38 namespace Internal DALI_INTERNAL
39 {
40 namespace Adaptor
41 {
42 class Window;
43 }
44 }
45
46 class DragAndDropDetector;
47 class Orientation;
48
49 /**
50  * @brief The window class is used internally for drawing.
51  *
52  * A Window has an orientation and indicator properties.
53  * You can get a valid Window handle by calling Dali::Application::GetWindow().
54  * @SINCE_1_0.0
55  */
56 class DALI_IMPORT_API Window : public BaseHandle
57 {
58 public:
59   typedef Signal< void (bool) > IndicatorSignalType;
60
61 public:
62
63   // Enumerations
64
65   /**
66    * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
67    * @SINCE_1_0.0
68    */
69   enum WindowOrientation
70   {
71     PORTRAIT = 0,  ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0
72     LANDSCAPE = 90,  ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0
73     PORTRAIT_INVERSE = 180,  ///< Portrait inverse orientation @SINCE_1_0.0
74     LANDSCAPE_INVERSE = 270  ///< Landscape inverse orientation @SINCE_1_0.0
75   };
76
77   /**
78    * @brief Enumeration for opacity of the indicator.
79    * @SINCE_1_0.0
80    */
81   enum IndicatorBgOpacity
82   {
83     OPAQUE = 100, ///< Fully opaque indicator Bg @SINCE_1_0.0
84     TRANSLUCENT = 50, ///< Semi translucent indicator Bg @SINCE_1_0.0
85     TRANSPARENT = 0 ///< Fully transparent indicator Bg @SINCE_1_0.0
86   };
87
88   /**
89    * @brief Enumeration for visible mode of the indicator.
90    * @SINCE_1_0.0
91    */
92   enum IndicatorVisibleMode
93   {
94     INVISIBLE = 0, ///< Hide indicator @SINCE_1_0.0
95     VISIBLE = 1, ///< Show indicator @SINCE_1_0.0
96     AUTO = 2 ///< Hide in default, will show when necessary @SINCE_1_0.0
97   };
98
99   // Methods
100
101   /**
102    * @brief Creates an initialized handle to a new Window.
103    * @SINCE_1_0.0
104    * @param[in] windowPosition The position and size of the Window
105    * @param[in] name The Window title
106    * @param[in] isTransparent Whether Window is transparent
107    * @return A new window
108    */
109   static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
110
111   /**
112    * @brief Creates an initialized handle to a new Window.
113    * @SINCE_1_0.0
114    * @param[in] windowPosition The position and size of the Window
115    * @param[in] name The Window title
116    * @param[in] className The Window class name
117    * @param[in] isTransparent Whether Window is transparent
118    * @return A new Window
119    */
120   static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
121
122   /**
123    * @brief Creates an uninitialized handle.
124    *
125    * This can be initialized using Dali::Application::GetWindow() or
126    * Dali::Window::New().
127    * @SINCE_1_0.0
128    */
129   Window();
130
131   /**
132    * @brief Destructor.
133    *
134    * This is non-virtual since derived Handle types must not contain data or virtual methods.
135    * @SINCE_1_0.0
136    */
137   ~Window();
138
139   /**
140    * @brief This copy constructor is required for (smart) pointer semantics.
141    *
142    * @SINCE_1_0.0
143    * @param[in] handle A reference to the copied handle
144    */
145   Window(const Window& handle);
146
147   /**
148    * @brief This assignment operator is required for (smart) pointer semantics.
149    *
150    * @SINCE_1_0.0
151    * @param[in] rhs A reference to the copied handle
152    * @return A reference to this
153    */
154   Window& operator=(const Window& rhs);
155
156   /**
157    * @brief This sets whether the indicator bar should be shown or not.
158    * @SINCE_1_0.0
159    * @param[in] visibleMode Visible mode for indicator bar, VISIBLE in default
160    */
161   void ShowIndicator( IndicatorVisibleMode visibleMode );
162
163   /**
164    * @brief This sets the opacity mode of indicator bar.
165    * @SINCE_1_0.0
166    * @param[in] opacity The opacity mode
167    */
168   void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
169
170   /**
171    * @brief This sets the orientation of indicator bar.
172    *
173    * It does not implicitly show the indicator if it is currently hidden.
174    * @SINCE_1_0.0
175    * @param[in] orientation The orientation
176    */
177   void RotateIndicator(WindowOrientation orientation);
178
179   /**
180    * @brief Sets the window name and class string.
181    * @SINCE_1_0.0
182    * @param[in] name The name of the window
183    * @param[in] klass The class of the window
184    */
185   void SetClass(std::string name, std::string klass);
186
187   /**
188    * @brief Raises window to the top of Window stack.
189    * @SINCE_1_0.0
190    */
191   void Raise();
192
193   /**
194    * @brief Lowers window to the bottom of Window stack.
195    * @SINCE_1_0.0
196    */
197   void Lower();
198
199   /**
200    * @brief Activates window to the top of Window stack even it is iconified.
201    * @SINCE_1_0.0
202    */
203   void Activate();
204
205   /**
206    * @brief Adds an orientation to the list of available orientations.
207    * @SINCE_1_0.0
208    * @param[in] orientation The available orientation to add
209    */
210   void AddAvailableOrientation( WindowOrientation orientation );
211
212   /**
213    * @brief Removes an orientation from the list of available orientations.
214    * @SINCE_1_0.0
215    * @param[in] orientation The available orientation to remove
216    */
217   void RemoveAvailableOrientation( WindowOrientation orientation );
218
219   /**
220    * @brief Sets a preferred orientation.
221    * @SINCE_1_0.0
222    * @param[in] orientation The preferred orientation
223    * @pre Orientation is in the list of available orientations.
224    */
225   void SetPreferredOrientation( WindowOrientation orientation );
226
227   /**
228    * @brief Gets the preferred orientation.
229    * @SINCE_1_0.0
230    * @return The preferred orientation if previously set, or none
231    */
232   WindowOrientation GetPreferredOrientation();
233
234   /**
235    * @brief Returns the Drag & drop detector which can be used to receive drag & drop events.
236    * @note  Not intended for application developers.
237    * @SINCE_1_0.0
238    * @return A handle to the DragAndDropDetector
239    */
240   DragAndDropDetector GetDragAndDropDetector() const;
241
242   /**
243    * @brief Gets the native handle of the window.
244    *
245    * When users call this function, it wraps the actual type used by the underlying window system.
246    * @SINCE_1_0.0
247    * @return The native handle of the Window or an empty handle
248    */
249   Any GetNativeHandle() const;
250
251 public: // Signals
252   /**
253    * @brief The user should connect to this signal to get a timing when indicator was shown / hidden.
254    * @SINCE_1_0.0
255    * @return The signal to connect to
256    */
257   IndicatorSignalType& IndicatorVisibilityChangedSignal();
258
259 public: // Not intended for application developers
260   /**
261    * @internal
262    * @brief This constructor is used by Dali::Application::GetWindow().
263    * @SINCE_1_0.0
264    * @param[in] window A pointer to the Window
265    */
266   explicit DALI_INTERNAL Window( Internal::Adaptor::Window* window );
267 };
268
269 /**
270  * @}
271  */
272 } // namespace Dali
273
274 #endif // __DALI_WINDOW_H__