Merge "Use existing callback ID for recurring callbacks" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
index 229d091..e9f8063 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_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.
@@ -23,6 +23,8 @@
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/adaptor-framework/window-enumerations.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/window.h>
@@ -57,17 +59,15 @@ using EventHandlerPtr = IntrusivePtr< EventHandler >;
 class Window : public Dali::Internal::Adaptor::SceneHolder, public EventHandler::Observer, public ConnectionTracker
 {
 public:
-  typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
-  typedef Dali::Window::FocusSignalType FocusSignalType;
-  typedef Dali::Window::ResizedSignalType ResizedSignalType;
   typedef Dali::Window::FocusChangeSignalType FocusChangeSignalType;
   typedef Dali::Window::ResizeSignalType ResizeSignalType;
   typedef Dali::DevelWindow::VisibilityChangedSignalType VisibilityChangedSignalType;
   typedef Dali::DevelWindow::TransitionEffectEventSignalType TransitionEffectEventSignalType;
+  typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType;
   typedef Signal< void () > SignalType;
 
   /**
-   * Create a new Window. This should only be called once by the Application class
+   * @brief Create a new Window. This should only be called once by the Application class
    * @param[in] positionSize The position and size of the window
    * @param[in] name The window title
    * @param[in] className The window class name
@@ -77,19 +77,15 @@ public:
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
 
   /**
-   * @copydoc Dali::Window::ShowIndicator()
-   */
-  void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode );
-
-  /**
-   * @copydoc Dali::Window::SetIndicatorBgOpacity()
-   */
-  void SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacity );
-
-  /**
-   * @copydoc Dali::Window::RotateIndicator()
+   * @brief Create a new Window. This should only be called once by the Application class
+   * @param[in] surface The surface used to render on.
+   * @param[in] positionSize 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
+   * @return A newly allocated Window
    */
-  void RotateIndicator( Dali::Window::WindowOrientation orientation );
+  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
 
   /**
    * @copydoc Dali::Window::SetClass()
@@ -135,22 +131,22 @@ public:
   /**
    * @copydoc Dali::Window::AddAvailableOrientation()
    */
-  void AddAvailableOrientation(Dali::Window::WindowOrientation orientation);
+  void AddAvailableOrientation(WindowOrientation orientation);
 
   /**
    * @copydoc Dali::Window::RemoveAvailableOrientation()
    */
-  void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation);
+  void RemoveAvailableOrientation(WindowOrientation orientation);
 
   /**
    * @copydoc Dali::Window::SetPreferredOrientation()
    */
-  void SetPreferredOrientation(Dali::Window::WindowOrientation orientation);
+  void SetPreferredOrientation(WindowOrientation orientation);
 
   /**
    * @copydoc Dali::Window::GetPreferredOrientation()
    */
-  Dali::Window::WindowOrientation GetPreferredOrientation();
+  WindowOrientation GetPreferredOrientation();
 
   /**
    * @copydoc Dali::Window::SetAcceptFocus()
@@ -215,22 +211,22 @@ public:
   /**
    * @copydoc Dali::Window::SetType()
    */
-  void SetType( Dali::Window::Type type );
+  void SetType( WindowType type );
 
   /**
    * @copydoc Dali::Window::GetType() const
    */
-  Dali::Window::Type GetType() const;
+  WindowType GetType() const;
 
   /**
    * @copydoc Dali::Window::SetNotificationLevel()
    */
-  bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level );
+  bool SetNotificationLevel( WindowNotificationLevel level );
 
   /**
    * @copydoc Dali::Window::GetNotificationLevel()
    */
-  Dali::Window::NotificationLevel::Type GetNotificationLevel() const;
+  WindowNotificationLevel GetNotificationLevel() const;
 
   /**
    * @copydoc Dali::Window::SetOpaqueState()
@@ -245,12 +241,12 @@ public:
   /**
    * @copydoc Dali::Window::SetScreenOffMode()
    */
-  bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode);
+  bool SetScreenOffMode(WindowScreenOffMode screenOffMode);
 
   /**
    * @copydoc Dali::Window::GetScreenOffMode()
    */
-  Dali::Window::ScreenOffMode::Type GetScreenOffMode() const;
+  WindowScreenOffMode GetScreenOffMode() const;
 
   /**
    * @copydoc Dali::Window::SetBrightness()
@@ -337,6 +333,16 @@ public:
    */
   Dali::Window GetParent();
 
+  /**
+   * @copydoc Dali::DevelWindow::GetCurrentOrientation()
+   */
+  WindowOrientation GetCurrentOrientation() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::SetAvailableOrientations()
+   */
+  void SetAvailableOrientations( const Dali::Vector<WindowOrientation>& orientations );
+
 public: // Dali::Internal::Adaptor::SceneHolder
 
   /**
@@ -349,6 +355,11 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   bool IsVisible() const override;
 
+  /**
+   * @copydoc Dali::DevelWindow::GetNativeId()
+   */
+  int32_t GetNativeId() const;
+
 private:
 
   /**
@@ -372,12 +383,12 @@ private:
   /**
    * Destructor
    */
-  virtual ~Window();
+  ~Window() override;
 
   /**
    * Second stage initialization
    */
-  void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
+  void Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className);
 
   /**
    * Called when the window becomes iconified or deiconified.
@@ -402,7 +413,17 @@ private:
   /**
    * Called when the window receives a Transition effect-start/end event.
    */
-  void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
+  void OnTransitionEffectEvent( WindowEffectState state, WindowEffectType type );
+
+  /**
+   * @brief Called when window receives a keyboard repeat event.
+   */
+  void OnKeyboardRepeatSettingsChanged();
+
+  /**
+   * @brief Called when the window redraw is requested.
+   */
+  void OnWindowRedrawRequest();
 
   /**
    * @brief Set available orientation to window base.
@@ -412,12 +433,17 @@ private:
   /**
    * @brief Convert from window orientation to angle using OrientationMode.
    */
-  int ConvertToAngle( Dali::Window::WindowOrientation orientation );
+  int ConvertToAngle( WindowOrientation orientation );
 
   /**
    * @brief Convert from angle to window orientation using OrientationMode.
    */
-  Dali::Window::WindowOrientation ConvertToOrientation( int angle );
+  WindowOrientation ConvertToOrientation( int angle ) const;
+
+  /**
+   * @brief Check available window orientation for Available orientation.
+   */
+  bool IsOrientationAvailable( WindowOrientation orientation ) const;
 
 private: // Dali::Internal::Adaptor::SceneHolder
 
@@ -471,23 +497,9 @@ private: // Dali::Internal::Adaptor::EventHandler::Observer
 public: // Signals
 
   /**
-   * The user should connect to this signal to get a timing when indicator was shown / hidden.
-   */
-  IndicatorSignalType& IndicatorVisibilityChangedSignal() { return mIndicatorVisibilityChangedSignal; }
-
-  /**
-   * @copydoc Dali::Window::FocusChangedSignal()
-   */
-  FocusSignalType& FocusChangedSignal() { return mFocusChangedSignal; }
-
-  /**
-   * @copydoc Dali::Window::WindowFocusChangedSignal()
+   * @copydoc Dali::Window::FocusChangeSignal()
    */
   FocusChangeSignalType& FocusChangeSignal() { return mFocusChangeSignal; }
-  /**
-   * @copydoc Dali::Window::ResizedSignal()
-   */
-  ResizedSignalType& ResizedSignal() { return mResizedSignal; }
 
   /**
    * @copydoc Dali::Window::ResizedSignal()
@@ -514,6 +526,11 @@ public: // Signals
    */
   TransitionEffectEventSignalType& TransitionEffectEventSignal() { return mTransitionEffectEventSignal; }
 
+  /**
+   * @copydoc Dali::DevelWindow::KeyboardRepeatSettingsChangedSignal()
+   */
+  KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal() { return mKeyboardRepeatSettingsChangedSignal; }
+
 private:
 
   WindowRenderSurface*                  mWindowSurface;      ///< The window rendering surface
@@ -525,7 +542,7 @@ private:
   bool                                  mIconified:1;
   bool                                  mOpaqueState:1;
   bool                                  mResizeEnabled:1;
-  Dali::Window::Type                    mType;
+  WindowType                            mType;
   Dali::Window                          mParentWindow;
 
   OrientationPtr                        mOrientation;
@@ -540,15 +557,15 @@ private:
 
   OrientationMode                       mOrientationMode;
 
+  int                                   mNativeWindowId;          ///< The Native Window Id
+
   // Signals
-  IndicatorSignalType                   mIndicatorVisibilityChangedSignal;
-  FocusSignalType                       mFocusChangedSignal;
-  ResizedSignalType                     mResizedSignal;
-  SignalType                            mDeleteRequestSignal;
-  FocusChangeSignalType                 mFocusChangeSignal;
-  ResizeSignalType                      mResizeSignal;
-  VisibilityChangedSignalType           mVisibilityChangedSignal;
-  TransitionEffectEventSignalType       mTransitionEffectEventSignal;
+  SignalType                              mDeleteRequestSignal;
+  FocusChangeSignalType                   mFocusChangeSignal;
+  ResizeSignalType                        mResizeSignal;
+  VisibilityChangedSignalType             mVisibilityChangedSignal;
+  TransitionEffectEventSignalType         mTransitionEffectEventSignal;
+  KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
 };
 
 } // namespace Adaptor