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