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