-#ifndef __DALI_INTEGRATION_ADAPTOR_H__
-#define __DALI_INTEGRATION_ADAPTOR_H__
+#ifndef DALI_INTEGRATION_ADAPTOR_H
+#define DALI_INTEGRATION_ADAPTOR_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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 <dali/public-api/signals/callback.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/common/view-mode.h>
+#include <dali/public-api/object/any.h>
+#include <dali/integration-api/processor-interface.h>
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/window.h>
namespace Dali
{
-class RenderSurface;
+class RenderSurfaceInterface;
+
+using WindowContainer = std::vector<Window>;
+
+namespace Integration
+{
+class SceneHolder;
+}
+
namespace Internal
{
namespace Adaptor
{
+class GraphicsFactory;
class Adaptor;
}
}
public:
typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals
+ typedef Signal< void (Window&) > WindowCreatedSignalType; ///< Window created signal type
+
+ using SurfaceSize = Uint16Pair; ///< Surface size type
public:
/**
/**
* @brief Create a new adaptor using render surface.
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to draw onto
* @param[in] surface The surface to draw onto
* @return a reference to the adaptor handle
*/
- static Adaptor& New( Any nativeWindow, const Dali::RenderSurface& surface );
+ static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface );
/**
* @brief Create a new adaptor using render surface.
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to draw onto
* @param[in] surface The surface to draw onto
* @param[in] configuration The context loss configuration.
* @return a reference to the adaptor handle
*/
- static Adaptor& New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
+ static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
+
+ /**
+ * @brief Create a new adaptor using the SceneHolder.
+ *
+ * @param[in] sceneHolder The SceneHolder to draw onto
+ * @return a reference to the adaptor handle
+ */
+ static Adaptor& New( Dali::Integration::SceneHolder sceneHolder );
+
+ /**
+ * @brief Create a new adaptor using the SceneHolder.
+ *
+ * @param[in] sceneHolder The SceneHolder to draw onto
+ * @param[in] configuration The context loss configuration.
+ * @return a reference to the adaptor handle
+ */
+ static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, Configuration::ContextLoss configuration );
+
+ /**
+ * @brief Create a new adaptor using render surface.
+ *
+ * @param[in] sceneHolder The SceneHolder to draw onto
+ * @param[in] surface The surface to draw onto
+ * @return a reference to the adaptor handle
+ */
+ static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, const Dali::RenderSurfaceInterface& surface );
+
+ /**
+ * @brief Create a new adaptor using render surface.
+ *
+ * @param[in] sceneHolder The SceneHolder to draw onto
+ * @param[in] surface The surface to draw onto
+ * @param[in] configuration The context loss configuration.
+ * @return a reference to the adaptor handle
+ */
+ static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
/**
* @brief Virtual Destructor.
* @brief Ensures that the function passed in is called from the main loop when it is idle.
* @note Function must be called from the main event thread only.
*
- * A callback of the following type may be used:
+ * Callbacks of the following types may be used:
* @code
* void MyFunction();
* @endcode
+ * This callback will be deleted once it is called.
+ *
+ * @code
+ * bool MyFunction();
+ * @endcode
+ * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
*
* @param[in] callback The function to call.
+ * @param[in] hasReturnValue Sould be set to true if the callback function has a return value.
* @return true if added successfully, false otherwise
*
* @note Ownership of the callback is passed onto this class.
*/
- bool AddIdle( CallbackBase* callback );
+ bool AddIdle( CallbackBase* callback, bool hasReturnValue );
+
+ /**
+ * @brief Adds a new Window instance to the Adaptor
+ *
+ * @param[in] childWindow The child window instance
+ * @param[in] childWindowName The child window title/name
+ * @param[in] childWindowClassName The class name that the child window belongs to
+ * @param[in] childWindowMode The mode of the child window
+ */
+ bool AddWindow( Dali::Integration::SceneHolder childWindow,
+ const std::string& childWindowName,
+ const std::string& childWindowClassName,
+ bool childWindowMode );
/**
* @brief Removes a previously added @p callback.
/**
* @brief Replaces the rendering surface
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to replace the surface for
* @param[in] surface to use
*/
- void ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface );
+ void ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface );
+
+ /**
+ * @brief Replaces the rendering surface
+ *
+ * @param[in] sceneHolder The SceneHolder to replace the surface for
+ * @param[in] surface to use
+ */
+ void ReplaceSurface( Dali::Integration::SceneHolder sceneHolder, Dali::RenderSurfaceInterface& surface );
/**
* @brief Get the render surface the adaptor is using to render to.
*
* @return reference to current render surface
*/
- RenderSurface& GetSurface();
+ Dali::RenderSurfaceInterface& GetSurface();
/**
* @brief Gets native window handle
Any GetNativeWindowHandle();
/**
+ * @brief Get the native display associated with the graphics backend
+ *
+ * @return A handle to the native display
+ */
+ Any GetGraphicsDisplay();
+
+ /**
* @brief Release any locks the surface may hold.
*
* For example, after compositing an offscreen surface, use this method to allow
void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
/**
- * @brief Set whether the frame count per render is managed using the hardware VSync or
- * manually timed.
+ * @brief The callback is called from the Update/Render thread prior to rendering.
*
- * @param[in] useHardware True if the hardware VSync should be used
+ * @param[in] callback The function to call
+ *
+ * @note The function is called from the Update thread, so should do as little processing as possible.
+ * It is not possible to call any DALi event side APIs from within the callback; doing so will cause
+ * instability. Only 1 callback is supported. Setting the callback to NULL will remove the current callback.
+ *
+ * A callback of the following type should be used:
+ * @code
+ * bool MyFunction();
+ * @endcode
+ * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
*/
- void SetUseHardwareVSync(bool useHardware);
+ void SetPreRenderCallback( CallbackBase* callback );
/**
* @brief Returns a reference to the instance of the adaptor used by the current thread.
void NotifyLanguageChanged();
/**
- * @brief Sets minimum distance in pixels that the fingers must move towards/away from each other in order to
- * trigger a pinch gesture
- *
- * @param[in] distance The minimum pinch distance in pixels
- */
- void SetMinimumPinchDistance(float distance);
-
- /**
* @brief Feed a touch point to the adaptor.
*
* @param[in] point touch point
void SceneCreated();
/**
- * @copydoc Dali::Application::SetViewMode();
+ * @brief Informs core the surface size has changed.
+ *
+ * @param[in] surface The current render surface
+ * @param[in] surfaceSize The new surface size
*/
- void SetViewMode( ViewMode viewMode );
+ void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
/**
- * @copydoc Dali::Application::SetStereoBase();
+ * @brief Informs ThreadController the surface size has changed.
+ *
+ * @param[in] surface The current render surface
+ * @param[in] surfaceSize The new surface size
*/
- void SetStereoBase( float stereoBase );
+ void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
/**
* @brief Renders once more even if we're paused
*/
const LogFactoryInterface& GetLogFactory();
+ /**
+ * @brief Register a processor implementing the Integration::Processor interface with dali-core.
+ * @param[in] processor the Processor to register
+ * @note using this api does not maintain the processor's lifecycle, must be done elsewhere.
+ */
+ void RegisterProcessor( Integration::Processor& processor );
+
+ /**
+ * @brief Unregister a previously registered processor from dali-core.
+ * @param[in] processor the Processor to unregister
+ */
+ void UnregisterProcessor( Integration::Processor& processor );
+
+ /**
+ * @brief Get the list of windows created.
+ * @return The list of windows
+ */
+ Dali::WindowContainer GetWindows() const;
+
+ /**
+ * @brief Called when the window becomes fully or partially visible.
+ */
+ void OnWindowShown();
+
+ /**
+ * @brief Called when the window is fully hidden.
+ */
+ void OnWindowHidden();
+
public: // Signals
/**
*/
AdaptorSignalType& LanguageChangedSignal();
+ /**
+ * @brief This signal is emitted when a new window is created
+ *
+ * @return The signal to connect to
+ */
+ WindowCreatedSignalType& WindowCreatedSignal();
+
private:
// Undefined
} // namespace Dali
-#endif // __DALI_INTEGRATION_ADAPTOR_H__
+#endif // DALI_INTEGRATION_ADAPTOR_H