Add SetWindowEffect in WindowExtension namespace.
[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) 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 <string>
23 #include <dali/public-api/common/vector-wrapper.h>
24 #include <dali/public-api/math/rect.h>
25 #include <dali/public-api/math/vector2.h>
26 #include <dali/public-api/object/base-handle.h>
27 #include <dali/public-api/object/any.h>
28 #include <dali/public-api/signals/dali-signal.h>
29
30 namespace Dali
31 {
32 typedef Dali::Rect<int> PositionSize;
33
34 namespace Internal DALI_INTERNAL
35 {
36 namespace Adaptor
37 {
38 class Window;
39 }
40 }
41
42 class DragAndDropDetector;
43 class Orientation;
44
45 /**
46  * @brief The window class is used internally for drawing.
47  *
48  * It has an orientation
49  * and indicator properties.
50  */
51 class DALI_IMPORT_API Window : public BaseHandle
52 {
53 public:
54   typedef Signal< void (bool) > IndicatorSignalType;
55
56 public:
57
58   // Enumerations
59
60   /**
61    * @brief Orientation of the window.
62    */
63   enum WindowOrientation
64   {
65     PORTRAIT = 0,
66     LANDSCAPE = 90,
67     PORTRAIT_INVERSE = 180,
68     LANDSCAPE_INVERSE = 270
69   };
70
71   /**
72    * @brief Opacity of the indicator.
73    */
74   enum IndicatorBgOpacity
75   {
76     OPAQUE = 100, // Fully opaque indicator Bg
77     TRANSLUCENT = 50, // Semi translucent indicator Bg
78     TRANSPARENT = 0 // Fully transparent indicator Bg
79   };
80
81   /**
82    * @brief Visible mode of the indicator.
83    */
84   enum IndicatorVisibleMode
85   {
86     INVISIBLE = 0, // hide indicator
87     VISIBLE = 1, // show indicator
88     AUTO = 2 // hide in default, will show when necessary
89   };
90
91   /**
92    * @brief Style of the indicator.
93    */
94   enum IndicatorStyle
95   {
96     FIXED_COLOR = 0, // fixed color style
97     CHANGEABLE_COLOR // changeable color style
98   };
99
100   // Methods
101
102   /**
103    * @brief Create an initialized handle to a new Window.
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, std::string name, bool isTransparent = false);
110
111   /**
112    * @brief Create an uninitalized handle.
113    *
114    * This can be initialized using Dali::Application::GetWindow() or
115    * Dali::Window::New()
116    */
117   Window();
118
119   /**
120    * @brief Destructor
121    *
122    * This is non-virtual since derived Handle types must not contain data or virtual methods.
123    */
124   ~Window();
125
126   /**
127    * @brief This copy constructor is required for (smart) pointer semantics.
128    *
129    * @param [in] handle A reference to the copied handle
130    */
131   Window(const Window& handle);
132
133   /**
134    * @brief This assignment operator is required for (smart) pointer semantics.
135    *
136    * @param [in] rhs  A reference to the copied handle
137    * @return A reference to this
138    */
139   Window& operator=(const Window& rhs);
140
141   /**
142    * @brief This sets the style of indicator
143    * @param[in] style style type of the indicator
144    *
145    * @note This should be called before ShowIndicator()
146    */
147   void SetIndicatorStyle( IndicatorStyle style );
148
149   /**
150    * @brief This sets whether the indicator bar should be shown or not.
151    * @param[in] visibleMode visible mode for indicator bar, VISIBLE in default
152    */
153   void ShowIndicator( IndicatorVisibleMode visibleMode );
154
155   /**
156    * @brief This sets the opacity mode of indicator bar.
157    * @param[in] opacity - The opacity mode
158    */
159   void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
160
161   /**
162    * @brief This sets the orientation of indicator bar.
163    *
164    * It does not implicitly show the indicator if it is currently
165    * hidden.
166    * @param[in] orientation The orientation
167    */
168   void RotateIndicator(WindowOrientation orientation);
169
170   /**
171    * @brief Set the window name and class string.
172    * @param[in] name The name of the window
173    * @param[in] klass The class of the window
174    */
175   void SetClass(std::string name, std::string klass);
176
177   /**
178    * @brief Raise window to top of window stack.
179    */
180   void Raise();
181
182   /**
183    * @brief Lower window to bottom of window stack.
184    */
185   void Lower();
186
187   /**
188    * @brief Activate window to top of window stack even it is iconified.
189    */
190   void Activate();
191
192   /**
193    * @brief Get the orientation class ( to allow signal connection ).
194    */
195   Orientation GetOrientation();
196
197   /**
198    * @brief Add an orientation to the list of available orientations.
199    */
200   void AddAvailableOrientation( WindowOrientation orientation );
201
202   /**
203    * @brief Remove an orientation from the list of available orientations.
204    */
205   void RemoveAvailableOrientation( WindowOrientation orientation );
206
207   /**
208    * @brief Set the orientations that this window can rotate to.
209    *
210    * By default, the window does not change orientation.
211    * @param[in] orientations The list of orientations
212    */
213   void SetAvailableOrientations( const std::vector<WindowOrientation>& orientations );
214
215   /**
216    * @brief Get the list of orientations this window can rotate to.
217    * @return the list of orientations
218    */
219   const std::vector<WindowOrientation>& GetAvailableOrientations();
220
221   /**
222    * @brief Set a preferred orientation.
223    * @pre orientation is in the list of available orientations
224    * @param[in] orientation The preferred orientation
225    */
226   void SetPreferredOrientation( WindowOrientation orientation );
227
228   /**
229    * @brief Get the preferred orientation.
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    * @return A handle to the DragAndDropDetector.
237    */
238   DragAndDropDetector GetDragAndDropDetector() const;
239
240   /**
241    * @brief Get the native handle of the window.
242    * @return The native handle of the window or an empty handle.
243    */
244   Any GetNativeHandle() const;
245
246 public: // Signals
247   /**
248    * The user should connect to this signal to get a timing when indicator was shown / hidden.
249    */
250   IndicatorSignalType& IndicatorVisibilityChangedSignal();
251
252 public: // Not intended for application developers
253   /**
254    * @brief This constructor is used by Dali::Application::GetWindow().
255    * @param[in] window A pointer to the window.
256    */
257   explicit DALI_INTERNAL Window( Internal::Adaptor::Window* window );
258 };
259
260 } // namespace Dali
261
262 #endif // __DALI_WINDOW_H__