#define DALI_WINDOW_DEVEL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+// EXTERNAL INCLUDES
+#include <memory>
+
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/common/vector-wrapper.h>
namespace Dali
{
+class KeyEvent;
+class TouchEvent;
+class WheelEvent;
+class RenderTaskList;
namespace DevelWindow
{
+/**
+ * @brief Enumeration for transition effect's state.
+ */
+enum class EffectState
+{
+ NONE = 0, ///< None state
+ START, ///< Transition effect is started.
+ END ///< Transition effect is ended.
+};
+
+/**
+ * @brief Enumeration for transition effect's type.
+ */
+enum class EffectType
+{
+ NONE = 0, ///< None type
+ SHOW, ///< Window show effect.
+ HIDE, ///< Window hide effect.
+};
+
+typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
+
+typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
+
+typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
+
+typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
+
+typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
+
+typedef Signal<void(Window, EffectState, EffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
+
+typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
+
+/**
+ * @brief Creates an initialized handle to a new Window.
+ *
+ * @param[in] surface Can be a window or pixmap.
+ * @param[in] windowPosition The position and size of the Window
+ * @param[in] name The Window title
+ * @param[in] isTransparent Whether Window is transparent
+ * @return A new window
+ * @note This creates an extra window in addition to the default main window
+*/
+DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
+
+/**
+ * @brief Creates an initialized handle to a new Window.
+ *
+ * @param[in] surface Can be a window or pixmap.
+ * @param[in] windowPosition The position and size of the Window
+ * @param[in] name The Window title
+ * @param[in] className The Window class name
+ * @param[in] isTransparent Whether Window is transparent
+ * @note This creates an extra window in addition to the default main window
+ * @return A new Window
+ */
+DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
/**
* @brief Sets position and size of the window. This API guarantees that both moving and resizing of window will appear on the screen at once.
* @param[in] window The window instance
* @param[in] positionSize The new window position and size
*/
-DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize );
+DALI_ADAPTOR_API void SetPositionSize(Window window, PositionSize positionSize);
+
+/**
+ * @brief Retrieve the window that the given actor is added to.
+ *
+ * @param[in] actor The actor
+ * @return The window the actor is added to or an empty handle if the actor is not added to any window.
+ */
+DALI_ADAPTOR_API Window Get(Actor actor);
+
+/**
+ * @brief This signal is emitted just after the event processing is finished.
+ *
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
+
+/**
+ * @brief This signal is emitted when wheel event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const WheelEvent& event);
+ * @endcode
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal(Window window);
/**
- * @brief Adds a child Actor to the Window.
+ * @brief This signal is emitted when the window is shown or hidden.
*
- * The child will be referenced.
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( Window window, bool visible );
+ * @endcode
* @param[in] window The window instance
- * @param[in] actor The child
- * @pre The actor has been initialized.
- * @pre The actor does not have a parent.
+ * @return The signal to connect to
*/
-DALI_ADAPTOR_API void Add( Window window, Dali::Actor actor );
+DALI_ADAPTOR_API VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
/**
- * @brief Removes a child Actor from the Window.
+ * @brief This signal is emitted for transition effect.
*
- * The child will be unreferenced.
+ * The transition animation is appeared when the window is shown/hidden.
+ * When the animation is started, START signal is emitted.
+ * Then the animation is ended, END signal is emitted, too.
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( Window window, EffectState state, EffectType type );
+ * @endcode
* @param[in] window The window instance
- * @param[in] actor The child
- * @pre The actor has been added to the stage.
+ * @return The signal to connect to
*/
-DALI_ADAPTOR_API void Remove( Window window, Dali::Actor actor );
+DALI_ADAPTOR_API TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window);
/**
- * @brief Sets the background color of the window.
+ * @brief This signal is emitted just after the keyboard repeat setting is changed globally.
*
* @param[in] window The window instance
- * @param[in] color The new background color
+ * @return The signal to connect to
*/
-DALI_ADAPTOR_API void SetBackgroundColor( Window window, Vector4 color );
+DALI_ADAPTOR_API KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window);
/**
- * @brief Gets the background color of the surface.
+ * @brief Sets parent window of the window.
+ *
+ * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+ * Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
+ * If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
*
* @param[in] window The window instance
- * @return The background color
+ * @param[in] parent The parent window instance
*/
-DALI_ADAPTOR_API Vector4 GetBackgroundColor( Window window );
+DALI_ADAPTOR_API void SetParent(Window window, Window parent);
/**
- * @brief Returns the Scene's Root Layer.
+ * @brief Unsets parent window of the window.
+ *
+ * After unsetting, the window is disconnected his parent window.
*
* @param[in] window The window instance
- * @return The root layer
*/
-DALI_ADAPTOR_API Dali::Layer GetRootLayer( Window window );
+DALI_ADAPTOR_API void Unparent(Window window);
/**
- * @brief Queries the number of on-stage layers.
+ * @brief Gets parent window of the window.
*
- * Note that a default layer is always provided (count >= 1).
* @param[in] window The window instance
- * @return The number of layers
+ * @return The parent window of the window
+ */
+DALI_ADAPTOR_API Window GetParent(Window window);
+
+/**
+ * @brief Downcast sceneHolder to window
+ *
+ * @param[in] handle The handle need to downcast
+ * @return The window cast from SceneHolder
*/
-DALI_ADAPTOR_API uint32_t GetLayerCount( Window window );
+DALI_ADAPTOR_API Window DownCast(BaseHandle handle);
/**
- * @brief Retrieves the layer at a specified depth.
+ * @brief Gets current orientation of the window.
*
* @param[in] window The window instance
- * @param[in] depth The depth
- * @return The layer found at the given depth
- * @pre Depth is less than layer count; see GetLayerCount().
+ * @return The current window orientation if previously set, or none
*/
-DALI_ADAPTOR_API Dali::Layer GetLayer( Window window, uint32_t depth );
+DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation(Window window);
+/**
+ * @brief Sets available orientations of the window.
+ *
+ * This API is for setting several orientations one time.
+ *
+ * @param[in] window The window instance
+ * @param[in] orientations The available orientation list to add
+ */
+DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations);
+
+/**
+ * @brief Gets current window ID.
+ *
+ * @param[in] window The window instance
+ */
+DALI_ADAPTOR_API int32_t GetNativeId(Window window);
+
+/**
+ * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
+ *
+ * @param[in] window The window instance
+ * @param[in] callback The function to call
+ * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
+ *
+ * @note A callback of the following type may be used:
+ * @code
+ * void MyFunction( int frameId );
+ * @endcode
+ * This callback will be deleted once it is called.
+ *
+ * @note Ownership of the callback is passed onto this class.
+ */
+DALI_ADAPTOR_API void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
+
+/**
+ * @brief Adds a callback that is called when the frame is displayed on the display.
+ *
+ * @param[in] window The window instance
+ * @param[in] callback The function to call
+ * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
+ *
+ * @note A callback of the following type may be used:
+ * @code
+ * void MyFunction( int frameId );
+ * @endcode
+ * This callback will be deleted once it is called.
+ *
+ * @note Ownership of the callback is passed onto this class.
+ */
+DALI_ADAPTOR_API void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
} // namespace DevelWindow