1 #ifndef __DALI_WINDOW_H__
2 #define __DALI_WINDOW_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
32 typedef Dali::Rect<int> PositionSize;
34 namespace Internal DALI_INTERNAL
42 class DragAndDropDetector;
46 * @brief The window class is used internally for drawing.
48 * It has an orientation
49 * and indicator properties.
51 class DALI_IMPORT_API Window : public BaseHandle
54 typedef Signal< void (bool) > IndicatorSignalType;
61 * @brief Orientation of the window.
63 enum WindowOrientation
67 PORTRAIT_INVERSE = 180,
68 LANDSCAPE_INVERSE = 270
72 * @brief Opacity of the indicator.
74 enum IndicatorBgOpacity
76 OPAQUE = 100, // Fully opaque indicator Bg
77 TRANSLUCENT = 50, // Semi translucent indicator Bg
78 TRANSPARENT = 0 // Fully transparent indicator Bg
82 * @brief Visible mode of the indicator.
84 enum IndicatorVisibleMode
86 INVISIBLE = 0, // hide indicator
87 VISIBLE = 1, // show indicator
88 AUTO = 2 // hide in default, will show when necessary
94 * @brief Create an initialized handle to a new Window.
95 * @param[in] windowPosition The position and size of the window
96 * @param[in] name The window title
97 * @param[in] isTransparent Whether window is transparent
98 * @return a new window
100 static Window New(PositionSize windowPosition, std::string name, bool isTransparent = false);
103 * @brief Create an uninitalized handle.
105 * This can be initialized using Dali::Application::GetWindow() or
106 * Dali::Window::New()
113 * This is non-virtual since derived Handle types must not contain data or virtual methods.
118 * @brief This copy constructor is required for (smart) pointer semantics.
120 * @param [in] handle A reference to the copied handle
122 Window(const Window& handle);
125 * @brief This assignment operator is required for (smart) pointer semantics.
127 * @param [in] rhs A reference to the copied handle
128 * @return A reference to this
130 Window& operator=(const Window& rhs);
133 * @brief This sets whether the indicator bar should be shown or not.
134 * @param[in] visibleMode visible mode for indicator bar, VISIBLE in default
136 void ShowIndicator( IndicatorVisibleMode visibleMode );
139 * @brief This sets the opacity mode of indicator bar.
140 * @param[in] opacity - The opacity mode
142 void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
145 * @brief This sets the orientation of indicator bar.
147 * It does not implicitly show the indicator if it is currently
149 * @param[in] orientation The orientation
151 void RotateIndicator(WindowOrientation orientation);
154 * @brief Set the window name and class string.
155 * @param[in] name The name of the window
156 * @param[in] klass The class of the window
158 void SetClass(std::string name, std::string klass);
161 * @brief Raise window to top of window stack.
166 * @brief Lower window to bottom of window stack.
171 * @brief Activate window to top of window stack even it is iconified.
176 * @brief Get the orientation class ( to allow signal connection ).
178 Orientation GetOrientation();
181 * @brief Add an orientation to the list of available orientations.
183 void AddAvailableOrientation( WindowOrientation orientation );
186 * @brief Remove an orientation from the list of available orientations.
188 void RemoveAvailableOrientation( WindowOrientation orientation );
191 * @brief Set the orientations that this window can rotate to.
193 * By default, the window does not change orientation.
194 * @param[in] orientations The list of orientations
196 void SetAvailableOrientations( const std::vector<WindowOrientation>& orientations );
199 * @brief Get the list of orientations this window can rotate to.
200 * @return the list of orientations
202 const std::vector<WindowOrientation>& GetAvailableOrientations();
205 * @brief Set a preferred orientation.
206 * @pre orientation is in the list of available orientations
207 * @param[in] orientation The preferred orientation
209 void SetPreferredOrientation( WindowOrientation orientation );
212 * @brief Get the preferred orientation.
213 * @return The preferred orientation if previously set, or none.
215 WindowOrientation GetPreferredOrientation();
218 * @brief Returns the Drag & drop detector which can be used to receive drag & drop events.
219 * @return A handle to the DragAndDropDetector.
221 DragAndDropDetector GetDragAndDropDetector() const;
224 * @brief Get the native handle of the window.
225 * @return The native handle of the window or an empty handle.
227 Any GetNativeHandle() const;
231 * The user should connect to this signal to get a timing when indicator was shown / hidden.
233 IndicatorSignalType& IndicatorVisibilityChangedSignal();
235 public: // Not intended for application developers
237 * @brief This constructor is used by Dali::Application::GetWindow().
238 * @param[in] window A pointer to the window.
240 explicit DALI_INTERNAL Window( Internal::Adaptor::Window* window );
245 #endif // __DALI_WINDOW_H__