1 #ifndef __DALI_WINDOW_H__
2 #define __DALI_WINDOW_H__
5 * Copyright (c) 2015 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/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>
31 typedef Dali::Rect<int> PositionSize;
33 namespace Internal DALI_INTERNAL
41 class DragAndDropDetector;
45 * @brief The window class is used internally for drawing.
47 * It has an orientation
48 * and indicator properties.
50 class DALI_IMPORT_API Window : public BaseHandle
53 typedef Signal< void (bool) > IndicatorSignalType;
60 * @brief Orientation of the window.
62 enum WindowOrientation
66 PORTRAIT_INVERSE = 180,
67 LANDSCAPE_INVERSE = 270
71 * @brief Opacity of the indicator.
73 enum IndicatorBgOpacity
75 OPAQUE = 100, // Fully opaque indicator Bg
76 TRANSLUCENT = 50, // Semi translucent indicator Bg
77 TRANSPARENT = 0 // Fully transparent indicator Bg
81 * @brief Visible mode of the indicator.
83 enum IndicatorVisibleMode
85 INVISIBLE = 0, // hide indicator
86 VISIBLE = 1, // show indicator
87 AUTO = 2 // hide in default, will show when necessary
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
99 static Window New(PositionSize windowPosition, std::string name, bool isTransparent = false);
102 * @brief Create an uninitalized handle.
104 * This can be initialized using Dali::Application::GetWindow() or
105 * Dali::Window::New()
112 * This is non-virtual since derived Handle types must not contain data or virtual methods.
117 * @brief This copy constructor is required for (smart) pointer semantics.
119 * @param [in] handle A reference to the copied handle
121 Window(const Window& handle);
124 * @brief This assignment operator is required for (smart) pointer semantics.
126 * @param [in] rhs A reference to the copied handle
127 * @return A reference to this
129 Window& operator=(const Window& rhs);
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
135 void ShowIndicator( IndicatorVisibleMode visibleMode );
138 * @brief This sets the opacity mode of indicator bar.
139 * @param[in] opacity - The opacity mode
141 void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
144 * @brief This sets the orientation of indicator bar.
146 * It does not implicitly show the indicator if it is currently
148 * @param[in] orientation The orientation
150 void RotateIndicator(WindowOrientation orientation);
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
157 void SetClass(std::string name, std::string klass);
160 * @brief Raise window to top of window stack.
165 * @brief Lower window to bottom of window stack.
170 * @brief Activate window to top of window stack even it is iconified.
175 * @brief Get the orientation class ( to allow signal connection ).
177 Orientation GetOrientation();
180 * @brief Add an orientation to the list of available orientations.
182 void AddAvailableOrientation( WindowOrientation orientation );
185 * @brief Remove an orientation from the list of available orientations.
187 void RemoveAvailableOrientation( WindowOrientation orientation );
190 * @brief Set a preferred orientation.
191 * @pre orientation is in the list of available orientations
192 * @param[in] orientation The preferred orientation
194 void SetPreferredOrientation( WindowOrientation orientation );
197 * @brief Get the preferred orientation.
198 * @return The preferred orientation if previously set, or none.
200 WindowOrientation GetPreferredOrientation();
203 * @brief Returns the Drag & drop detector which can be used to receive drag & drop events.
204 * @return A handle to the DragAndDropDetector.
206 DragAndDropDetector GetDragAndDropDetector() const;
209 * @brief Get the native handle of the window.
210 * @return The native handle of the window or an empty handle.
212 Any GetNativeHandle() const;
216 * The user should connect to this signal to get a timing when indicator was shown / hidden.
218 IndicatorSignalType& IndicatorVisibilityChangedSignal();
220 public: // Not intended for application developers
222 * @brief This constructor is used by Dali::Application::GetWindow().
223 * @param[in] window A pointer to the window.
225 explicit DALI_INTERNAL Window( Internal::Adaptor::Window* window );
230 #endif // __DALI_WINDOW_H__