Add move semantics to BaseHandle derived classes in Adaptor public API
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.h
old mode 100755 (executable)
new mode 100644 (file)
index 404fd3e..8105e5d
@@ -1,8 +1,8 @@
-#ifndef __DALI_WINDOW_H__
-#define __DALI_WINDOW_H__
+#ifndef DALI_WINDOW_H
+#define DALI_WINDOW_H
 
 /*
- * Copyright (c) 2018 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.
@@ -31,6 +31,9 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-adaptor-common.h>
 
+#undef OPAQUE
+#undef TRANSPARENT
+
 namespace Dali
 {
 /**
@@ -52,6 +55,9 @@ class DragAndDropDetector;
 class Orientation;
 class Actor;
 class Layer;
+class RenderTaskList;
+class TouchData;
+struct KeyEvent;
 
 /**
  * @brief The window class is used internally for drawing.
@@ -64,12 +70,14 @@ class DALI_ADAPTOR_API Window : public BaseHandle
 {
 public:
 
-  typedef Uint16Pair WindowSize;          ///< Window size type @SINCE_1_2.60
-  typedef Uint16Pair WindowPosition;      ///< Window position type @SINCE_1_2.60
+  using WindowSize = Uint16Pair ;     ///< Window size type @SINCE_1_2.60
+  using WindowPosition = Uint16Pair;  ///< Window position type @SINCE_1_2.60
 
-  typedef Signal< void (bool) > IndicatorSignalType;  ///< @DEPRECATED_1_4.9 @brief Indicator state signal type @SINCE_1_0.0
-  typedef Signal< void (bool) > FocusSignalType;         ///< Window focus signal type @SINCE_1_2.60
-  typedef Signal< void (WindowSize) > ResizedSignalType; ///< Window resized signal type @SINCE_1_2.60
+  using ResizedSignalType = Signal< void (WindowSize) >;       ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60
+  using FocusChangeSignalType = Signal< void (Window,bool) >;  ///< Window focus signal type @SINCE_1_4.35
+  using ResizeSignalType = Signal< void (Window,WindowSize) >; ///< Window resized signal type @SINCE_1_4.35
+  using KeyEventSignalType = Signal< void (const KeyEvent&) >; ///< Key event signal type
+  using TouchSignalType = Signal< void (const TouchData&) >;   ///< Touch signal type
 
 public:
 
@@ -77,6 +85,9 @@ public:
 
   /**
    * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
+   *
+   * This Enumeration is used the available orientation APIs and the preferred orientation.
+   *
    * @SINCE_1_0.0
    */
   enum WindowOrientation
@@ -84,31 +95,8 @@ public:
     PORTRAIT = 0,  ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0
     LANDSCAPE = 90,  ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0
     PORTRAIT_INVERSE = 180,  ///< Portrait inverse orientation @SINCE_1_0.0
-    LANDSCAPE_INVERSE = 270  ///< Landscape inverse orientation @SINCE_1_0.0
-  };
-
-  /**
-   * @DEPRECATED_1_4.9
-   * @brief Enumeration for opacity of the indicator.
-   * @SINCE_1_0.0
-   */
-  enum IndicatorBgOpacity
-  {
-    OPAQUE = 100, ///< @DEPRECATED_1_4.9 @brief Fully opaque indicator Bg @SINCE_1_0.0
-    TRANSLUCENT = 50, ///< @DEPRECATED_1_4.9 @brief Semi translucent indicator Bg @SINCE_1_0.0
-    TRANSPARENT = 0 ///< @DEPRECATED_1_4.9 @brief Fully transparent indicator Bg @SINCE_1_0.0
-  };
-
-  /**
-   * @DEPRECATED_1_4.9
-   * @brief Enumeration for visible mode of the indicator.
-   * @SINCE_1_0.0
-   */
-  enum IndicatorVisibleMode
-  {
-    INVISIBLE = 0, ///< @DEPRECATED_1_4.9 @brief Hide indicator @SINCE_1_0.0
-    VISIBLE = 1, ///< @DEPRECATED_1_4.9 @brief Show indicator @SINCE_1_0.0
-    AUTO = 2 ///< @DEPRECATED_1_4.9 @brief Hide in default, will show when necessary @SINCE_1_0.0
+    LANDSCAPE_INVERSE = 270,  ///< Landscape inverse orientation @SINCE_1_0.0
+    NO_ORIENTATION_PREFERENCE = -1 ///< No orientation. It is used to initialize or unset the preferred orientation.  @SINCE_1_4.51
   };
 
   /**
@@ -171,6 +159,7 @@ public:
    * @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
    */
   static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
 
@@ -181,6 +170,7 @@ public:
    * @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
    */
   static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
@@ -220,30 +210,96 @@ public:
   Window& operator=(const Window& rhs);
 
   /**
-   * @DEPRECATED_1_4.9
-   * @brief This sets whether the indicator bar should be shown or not.
-   * @SINCE_1_0.0
-   * @param[in] visibleMode Visible mode for indicator bar, VISIBLE in default
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.24
+   * @param[in] rhs A reference to the moved handle
    */
-  void ShowIndicator( IndicatorVisibleMode visibleMode ) DALI_DEPRECATED_API;
+  Window( Window&& rhs );
 
   /**
-   * @DEPRECATED_1_4.9
-   * @brief This sets the opacity mode of indicator bar.
-   * @SINCE_1_0.0
-   * @param[in] opacity The opacity mode
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.24
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
    */
-  void SetIndicatorBgOpacity( IndicatorBgOpacity opacity ) DALI_DEPRECATED_API;
+  Window& operator=( Window&& rhs );
 
   /**
-   * @DEPRECATED_1_4.9
-   * @brief This sets the orientation of indicator bar.
+   * @brief Adds a child Actor to the Window.
    *
-   * It does not implicitly show the indicator if it is currently hidden.
-   * @SINCE_1_0.0
-   * @param[in] orientation The orientation
+   * The child will be referenced.
+   *
+   * @SINCE_1_4.19
+   * @param[in] actor The child
+   * @pre The actor has been initialized.
+   * @pre The actor does not have a parent.
+   */
+  void Add( Actor actor );
+
+  /**
+   * @brief Removes a child Actor from the Window.
+   *
+   * The child will be unreferenced.
+   *
+   * @SINCE_1_4.19
+   * @param[in] actor The child
+   * @pre The actor has been added to the stage.
+   */
+  void Remove( Actor actor );
+
+  /**
+   * @brief Sets the background color of the Window.
+   *
+   * @SINCE_1_4.19
+   * @param[in] color The new background color
+   */
+  void SetBackgroundColor( const Vector4& color );
+
+  /**
+   * @brief Gets the background color of the Window.
+   *
+   * @SINCE_1_4.19
+   * @return The background color
+   */
+  Vector4 GetBackgroundColor() const;
+
+  /**
+   * @brief Returns the root Layer of the Window.
+   *
+   * @SINCE_1_4.19
+   * @return The root layer
+   */
+  Layer GetRootLayer() const;
+
+  /**
+   * @brief Queries the number of on-scene layers in the Window.
+   *
+   * Note that a default layer is always provided (count >= 1).
+   *
+   * @SINCE_1_4.19
+   * @return The number of layers
+   */
+  uint32_t GetLayerCount() const;
+
+  /**
+   * @brief Retrieves the layer at a specified depth in the Window.
+   *
+   * @SINCE_1_4.19
+   * @param[in] depth The depth
+   * @return The layer found at the given depth
+   * @pre Depth is less than layer count; see GetLayerCount().
+   */
+  Layer GetLayer( uint32_t depth ) const;
+
+  /**
+   * @brief Retrieves the DPI of the window.
+   *
+   * @SINCE_1_9.21
+   * @return The DPI of the window
    */
-  void RotateIndicator(WindowOrientation orientation) DALI_DEPRECATED_API;
+  Uint16Pair GetDpi() const;
 
   /**
    * @brief Sets the window name and class string.
@@ -290,6 +346,8 @@ public:
    * @SINCE_1_0.0
    * @param[in] orientation The preferred orientation
    * @pre Orientation is in the list of available orientations.
+   *
+   * @note To unset the preferred orientation, orientation should be set NO_ORIENTATION_PREFERENCE.
    */
   void SetPreferredOrientation( WindowOrientation orientation );
 
@@ -301,14 +359,6 @@ public:
   WindowOrientation GetPreferredOrientation();
 
   /**
-   * @brief Returns the Drag & drop detector which can be used to receive drag & drop events.
-   * @note  Not intended for application developers.
-   * @SINCE_1_0.0
-   * @return A handle to the DragAndDropDetector
-   */
-  DragAndDropDetector GetDragAndDropDetector() const;
-
-  /**
    * @brief Gets the native handle of the window.
    *
    * When users call this function, it wraps the actual type used by the underlying window system.
@@ -557,42 +607,91 @@ public:
    */
   void SetTransparency( bool transparent );
 
+  /**
+   * @brief Retrieves the list of render-tasks in the window.
+   *
+   * @SINCE_1_9.21
+   * @return A valid handle to a RenderTaskList
+   */
+  RenderTaskList GetRenderTaskList();
+
 public: // Signals
+
   /**
-   * @DEPRECATED_1_4.9
-   * @brief The user should connect to this signal to get a timing when indicator was shown / hidden.
-   * @SINCE_1_0.0
+   * @brief This signal is emitted when the window is resized.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName( int width, int height );
+   * @endcode
+   * The parameters are the resized width and height.
+   *
+   * @SINCE_1_2.60
    * @return The signal to connect to
    */
-  IndicatorSignalType& IndicatorVisibilityChangedSignal() DALI_DEPRECATED_API;
+  ResizedSignalType& ResizedSignal() DALI_DEPRECATED_API;
 
   /**
    * @brief The user should connect to this signal to get a timing when window gains focus or loses focus.
    *
    * A callback of the following type may be connected:
    * @code
-   *   void YourCallbackName( bool focusIn );
+   *   void YourCallbackName( Window window, bool focusIn );
    * @endcode
    * The parameter is true if window gains focus, otherwise false.
+   * and window means this signal was called from what window
    *
-   * @SINCE_1_2.60
+   * @SINCE_1_4.35
    * @return The signal to connect to
    */
-  FocusSignalType& FocusChangedSignal();
+  FocusChangeSignalType& FocusChangeSignal();
 
   /**
    * @brief This signal is emitted when the window is resized.
    *
    * A callback of the following type may be connected:
    * @code
-   *   void YourCallbackName( int width, int height );
+   *   void YourCallbackName( Window window, int width, int height );
    * @endcode
    * The parameters are the resized width and height.
+   * and window means this signal was called from what window
    *
-   * @SINCE_1_2.60
+   * @SINCE_1_4.35
    * @return The signal to connect to
    */
-  ResizedSignalType& ResizedSignal();
+  ResizeSignalType& ResizeSignal();
+
+  /**
+   * @brief This signal is emitted when key event is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const KeyEvent& event);
+   * @endcode
+   *
+   * @SINCE_1_9.21
+   * @return The signal to connect to
+   */
+  KeyEventSignalType& KeyEventSignal();
+
+  /**
+   * @brief This signal is emitted when the screen is touched and when the touch ends
+   * (i.e. the down & up touch events only).
+   *
+   * If there are multiple touch points, then this will be emitted when the first touch occurs and
+   * then when the last finger is lifted.
+   * An interrupted event will also be emitted (if it occurs).
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const TouchData& event);
+   * @endcode
+   *
+   * @SINCE_1_9.21
+   * @return The touch signal to connect to
+   *
+   * @note Motion events are not emitted.
+   */
+  TouchSignalType& TouchSignal();
 
 public: // Not intended for application developers
   /// @cond internal