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>
28 namespace Dali DALI_IMPORT_API
30 typedef Dali::Rect<int> PositionSize;
32 namespace Internal DALI_INTERNAL
40 class DragAndDropDetector;
44 * @brief The window class is used internally for drawing.
46 * It has an orientation
47 * and indicator properties.
49 class Window : public BaseHandle
56 * @brief Orientation of the window.
58 enum WindowOrientation
62 PORTRAIT_INVERSE = 180,
63 LANDSCAPE_INVERSE = 270
67 * @brief Opacity of the indicator.
69 enum IndicatorBgOpacity
71 OPAQUE = 100, // Fully opaque indicator Bg
72 TRANSLUCENT = 50, // Semi translucent indicator Bg
73 TRANSPARENT = 0 // Fully transparent indicator Bg
77 * @brief Visible mode of the indicator.
79 enum IndicatorVisibleMode
81 INVISIBLE = 0, // hide indicator
82 VISIBLE = 1, // show indicator
83 AUTO = 2 // hide in default, will show when necessary
87 * @brief Style of the indicator.
91 FIXED_COLOR = 0, // fixed color style
92 CHANGEABLE_COLOR // changeable color style
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
104 static Window New(PositionSize windowPosition, std::string name, bool isTransparent = false);
107 * @brief Create an uninitalized handle.
109 * This can be initialized using Dali::Application::GetWindow() or
110 * Dali::Window::New()
117 * This is non-virtual since derived Handle types must not contain data or virtual methods.
122 * @brief This copy constructor is required for (smart) pointer semantics.
124 * @param [in] handle A reference to the copied handle
126 Window(const Window& handle);
129 * @brief This assignment operator is required for (smart) pointer semantics.
131 * @param [in] rhs A reference to the copied handle
132 * @return A reference to this
134 Window& operator=(const Window& rhs);
137 * @brief This method is defined to allow assignment of the NULL value,
138 * and will throw an exception if passed any other value.
140 * Assigning to NULL is an alias for Reset().
141 * @param [in] rhs A NULL pointer
142 * @return A reference to this handle
144 Window& operator=(BaseHandle::NullType* rhs);
147 * @brief This sets the style of indicator
148 * @param[in] style style type of the indicator
150 * @note This should be called before ShowIndicator()
152 void SetIndicatorStyle( IndicatorStyle style );
155 * @brief This sets whether the indicator bar should be shown or not.
156 * @param[in] visibleMode visible mode for indicator bar, VISIBLE in default
158 void ShowIndicator( IndicatorVisibleMode visibleMode );
161 * @brief This sets the opacity mode of indicator bar.
162 * @param[in] opacity - The opacity mode
164 void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
167 * @brief This sets the orientation of indicator bar.
169 * It does not implicitly show the indicator if it is currently
171 * @param[in] orientation The orientation
173 void RotateIndicator(WindowOrientation orientation);
176 * @brief Set the window name and class string.
177 * @param[in] name The name of the window
178 * @param[in] klass The class of the window
180 void SetClass(std::string name, std::string klass);
183 * @brief Raise window to top of window stack.
188 * @brief Lower window to bottom of window stack.
193 * @brief Activate window to top of window stack even it is iconified.
198 * @brief Get the orientation class ( to allow signal connection ).
200 Orientation GetOrientation();
203 * @brief Add an orientation to the list of available orientations.
205 void AddAvailableOrientation( WindowOrientation orientation );
208 * @brief Remove an orientation from the list of available orientations.
210 void RemoveAvailableOrientation( WindowOrientation orientation );
213 * @brief Set the orientations that this window can rotate to.
215 * By default, the window does not change orientation.
216 * @param[in] orientations The list of orientations
218 void SetAvailableOrientations( const std::vector<WindowOrientation>& orientations );
221 * @brief Get the list of orientations this window can rotate to.
222 * @return the list of orientations
224 const std::vector<WindowOrientation>& GetAvailableOrientations();
227 * @brief Set a preferred orientation.
228 * @pre orientation is in the list of available orientations
229 * @param[in] orientation The preferred orientation
231 void SetPreferredOrientation( WindowOrientation orientation );
234 * @brief Get the preferred orientation.
235 * @return The preferred orientation if previously set, or none.
237 WindowOrientation GetPreferredOrientation();
240 * @brief Returns the Drag & drop detector which can be used to receive drag & drop events.
241 * @return A handle to the DragAndDropDetector.
243 DragAndDropDetector GetDragAndDropDetector() const;
245 public: // Not intended for application developers
247 * @brief This constructor is used by Dali::Application::GetWindow().
248 * @param[in] window A pointer to the window.
250 explicit Window( Internal::Adaptor::Window* window );
255 #endif // __DALI_WINDOW_H__