$(adaptor_imaging_ubuntu_x11_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_ubuntu_x11_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
$(adaptor_imaging_tizen_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_tizen_wayland_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
$(adaptor_imaging_tizen_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_tizen_wayland_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
$(adaptor_imaging_tizen_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_tizen_wayland_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
$(adaptor_imaging_tizen_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_tizen_wayland_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
$(adaptor_imaging_tizen_src_files) \
$(adaptor_input_common_src_files) \
$(adaptor_input_tizen_wayland_src_files) \
+ $(adaptor_integration_api_src_files) \
$(adaptor_legacy_common_src_files) \
$(adaptor_network_common_src_files) \
$(adaptor_public_api_src_files) \
#include <dali/devel-api/adaptor-framework/application-devel.h>
#include <dali/internal/adaptor/common/application-impl.h>
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/scene-holder.h>
+#else
+#include <dali/integration-api/adaptors/scene-holder.h>
+#endif
+
namespace Dali
{
#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.
#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
class RenderSurfaceInterface;
+namespace Integration
+{
+class SceneHolder;
+}
+
+
namespace Internal
{
namespace Adaptor
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.
*/
virtual ~Adaptor();
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
+adaptor_integration_api_src_files = \
+ $(adaptor_integration_api_dir)/scene-holder.cpp \
+ $(adaptor_integration_api_dir)/scene-holder-impl.cpp
+
adaptor_integration_api_header_files = \
$(adaptor_integration_api_dir)/adaptor.h \
$(adaptor_integration_api_dir)/egl-interface.h \
$(adaptor_integration_api_dir)/native-render-surface.h \
$(adaptor_integration_api_dir)/native-render-surface-factory.h \
$(adaptor_integration_api_dir)/render-surface-interface.h \
+ $(adaptor_integration_api_dir)/scene-holder.h \
+ $(adaptor_integration_api_dir)/scene-holder-impl.h \
$(adaptor_integration_api_dir)/thread-synchronization-interface.h \
$(adaptor_integration_api_dir)/trigger-event-interface.h \
$(adaptor_integration_api_dir)/trigger-event-factory-interface.h \
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/integration-api/scene-holder-impl.h>
+
+// EXTERNAL HEADERS
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/layer.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/common/lifecycle-observer.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+uint32_t SceneHolder::mSceneHolderCounter = 0;
+
+class SceneHolder::SceneHolderLifeCycleObserver : public LifeCycleObserver
+{
+public:
+
+ SceneHolderLifeCycleObserver(Adaptor*& adaptor)
+ : mAdaptor( adaptor )
+ {
+ };
+
+private: // Adaptor::LifeCycleObserver interface
+
+ void OnStart() override {};
+ void OnPause() override {};
+ void OnResume() override {};
+ void OnStop() override {};
+ void OnDestroy() override
+ {
+ mAdaptor = nullptr;
+ };
+
+private:
+ Adaptor*& mAdaptor;
+};
+
+
+SceneHolder::SceneHolder()
+: mLifeCycleObserver( new SceneHolderLifeCycleObserver( mAdaptor ) ),
+ mId( mSceneHolderCounter++ ),
+ mSurface( nullptr ),
+ mAdaptor( nullptr ),
+ mAdaptorStarted( false ),
+ mVisible( true )
+{
+}
+
+SceneHolder::~SceneHolder()
+{
+ if ( mAdaptor )
+ {
+ mAdaptor->RemoveObserver( *mLifeCycleObserver.get() );
+ mAdaptor->RemoveWindow( this );
+ mAdaptor = nullptr;
+ }
+}
+
+void SceneHolder::Add( Dali::Actor actor )
+{
+ if ( mScene )
+ {
+ mScene.Add( actor );
+ }
+}
+
+void SceneHolder::Remove( Dali::Actor actor )
+{
+ if ( mScene )
+ {
+ mScene.Remove( actor );
+ }
+}
+
+Dali::Layer SceneHolder::GetRootLayer() const
+{
+ return mScene ? mScene.GetRootLayer() : Dali::Layer();
+}
+
+uint32_t SceneHolder::GetId() const
+{
+ return mId;
+}
+
+std::string SceneHolder::GetName() const
+{
+ return mName;
+}
+
+bool SceneHolder::IsVisible() const
+{
+ return mVisible;
+}
+
+Dali::Integration::Scene SceneHolder::GetScene()
+{
+ return mScene;
+}
+
+void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
+{
+ mSurface.reset( surface );
+
+ mScene.SetSurface( *mSurface.get() );
+
+ unsigned int dpiHorizontal, dpiVertical;
+ dpiHorizontal = dpiVertical = 0;
+
+ mSurface->GetDpi( dpiHorizontal, dpiVertical );
+ mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+
+ mSurface->SetAdaptor( *mAdaptor );
+
+ OnSurfaceSet( surface );
+}
+
+Dali::RenderSurfaceInterface* SceneHolder::GetSurface() const
+{
+ return mSurface.get();
+}
+
+void SceneHolder::SetBackgroundColor( Vector4 color )
+{
+ if ( mSurface )
+ {
+ mSurface->SetBackgroundColor( color );
+ }
+}
+
+Vector4 SceneHolder::GetBackgroundColor() const
+{
+ return mSurface ? mSurface->GetBackgroundColor() : Vector4();
+}
+
+void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
+{
+ // Avoid doing this more than once
+ if( mAdaptorStarted )
+ {
+ return;
+ }
+
+ mAdaptorStarted = true;
+
+ // Create the scene
+ PositionSize positionSize = mSurface->GetPositionSize();
+ mScene = Dali::Integration::Scene::New( Vector2( positionSize.width, positionSize.height ) );
+ mScene.SetSurface( *mSurface.get() );
+
+ Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation( adaptor );
+ mAdaptor = &adaptorImpl;
+
+ // Create an observer for the adaptor lifecycle
+ mAdaptor->AddObserver( *mLifeCycleObserver );
+
+ if ( mSurface )
+ {
+ unsigned int dpiHorizontal, dpiVertical;
+ dpiHorizontal = dpiVertical = 0;
+
+ mSurface->GetDpi( dpiHorizontal, dpiVertical );
+ mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+
+ mSurface->SetAdaptor( *mAdaptor );
+ }
+
+ OnAdaptorSet( adaptor );
+}
+
+void SceneHolder::Pause()
+{
+ OnPause();
+}
+
+void SceneHolder::Resume()
+{
+ OnResume();
+}
+
+}// Adaptor
+
+}// Internal
+
+} // Dali
--- /dev/null
+#ifndef DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
+#define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <memory>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/common/intrusive-ptr.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/scene-holder.h>
+#include <dali/integration-api/scene.h>
+
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/render-surface-interface.h>
+#else
+#include <dali/integration-api/adaptors/render-surface-interface.h>
+#endif
+
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+
+namespace Dali
+{
+
+class Any;
+class Adaptor;
+class Actor;
+class Layer;
+struct TouchPoint;
+struct WheelEvent;
+struct KeyEvent;
+
+namespace Integration
+{
+
+class Scene;
+
+}
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class SceneHolder;
+using SceneHolderPtr = IntrusivePtr< SceneHolder >;
+
+/**
+ * @brief SceneHolder creates a Scene for rendering.
+ */
+class SceneHolder : public BaseObject
+{
+
+public:
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::Add
+ */
+ void Add( Dali::Actor actor );
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::Remove
+ */
+ void Remove( Dali::Actor actor );
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::GetRootLayer
+ */
+ Dali::Layer GetRootLayer() const;
+
+ /**
+ * @brief Gets the window name.
+ * @return The name of the window
+ */
+ std::string GetName() const;
+
+ /**
+ * @brief Retrieve the unique ID of the window.
+ * @return The ID
+ */
+ uint32_t GetId() const;
+
+ /**
+ * @brief Retrieve the Scene.
+ * @return The Scene
+ */
+ Dali::Integration::Scene GetScene();
+
+ /**
+ * @brief Set the render surface
+ * @param[in] surface The render surface
+ */
+ void SetSurface( Dali::RenderSurfaceInterface* surface );
+
+ /**
+ * @brief Get the render surface
+ * @return The render surface
+ */
+ Dali::RenderSurfaceInterface* GetSurface() const;
+
+ /**
+ * @brief Set the adaptor to the scene holder
+ * @param[in] adaptor An initialized adaptor
+ */
+ void SetAdaptor( Dali::Adaptor& adaptor );
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::SetBackgroundColor
+ */
+ void SetBackgroundColor( Dali::Vector4 color );
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::GetBackgroundColor
+ */
+ Vector4 GetBackgroundColor() const;
+
+ /**
+ * @brief Pause the rendering of the scene holder.
+ */
+ void Pause();
+
+ /**
+ * @brief Resume the rendering of the scene holder (from pause).
+ */
+ void Resume();
+
+public: // The following methods can be overridden if required
+
+ /**
+ * @brief Returns whether the Scene is visible or not.
+ * @return True if the Scene is visible, false otherwise.
+ */
+ virtual bool IsVisible() const;
+
+public: // The following methods must be overridden
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::GetNativeHandle
+ */
+ virtual Dali::Any GetNativeHandle() const = 0;
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::FeedTouchPoint
+ */
+ virtual void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp ) = 0;
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::FeedWheelEvent
+ */
+ virtual void FeedWheelEvent( Dali::WheelEvent& wheelEvent ) = 0;
+
+ /**
+ * @copydoc Dali::Integration::SceneHolder::FeedKeyEvent
+ */
+ virtual void FeedKeyEvent( Dali::KeyEvent& keyEvent ) = 0;
+
+protected:
+
+ // Constructor
+ SceneHolder();
+
+ // Undefined
+ SceneHolder(const SceneHolder&) = delete;
+
+ // Undefined
+ SceneHolder& operator=(const SceneHolder& rhs) = delete;
+
+ /**
+ * virtual destructor
+ */
+ virtual ~SceneHolder();
+
+private: // The following methods can be overridden if required
+
+ /**
+ * @brief Called by the base class to inform deriving classes that the adaptor has been set.
+ * @param[in] adaptor The adaptor
+ */
+ virtual void OnAdaptorSet( Dali::Adaptor& adaptor ) {};
+
+ /**
+ * @brief Called by the base class to inform deriving classes that a new surface has been set.
+ * @param[in] surface The new render surface
+ */
+ virtual void OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) {};
+
+ /**
+ * @brief Called by the base class to inform deriving classes that we are being paused.
+ */
+ virtual void OnPause() {};
+
+ /**
+ * @brief Called by the base class to inform deriving classes that we are resuming from a paused state.
+ */
+ virtual void OnResume() {};
+
+private:
+
+ static uint32_t mSceneHolderCounter; ///< A counter to track the SceneHolder creation
+
+ class SceneHolderLifeCycleObserver;
+ std::unique_ptr< SceneHolderLifeCycleObserver > mLifeCycleObserver; ///< The adaptor life cycle observer
+
+protected:
+
+ uint32_t mId; ///< A unique ID to identify the SceneHolder starting from 0
+ Dali::Integration::Scene mScene; ///< The Scene
+ std::string mName; ///< The name of the SceneHolder
+
+ std::unique_ptr< Dali::RenderSurfaceInterface > mSurface; ///< The window rendering surface
+ Adaptor* mAdaptor; ///< The adaptor
+
+ bool mAdaptorStarted:1; ///< Whether the adaptor has started or not
+ bool mVisible:1; ///< Whether the scene is visible or not
+};
+
+} // Adaptor
+
+} // Internal
+
+// Get impl of handle
+inline Internal::Adaptor::SceneHolder& GetImplementation( Dali::Integration::SceneHolder& sceneHolder )
+{
+ DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
+ Dali::RefObject& object = sceneHolder.GetBaseObject();
+ return static_cast<Internal::Adaptor::SceneHolder&>( object );
+}
+
+inline const Internal::Adaptor::SceneHolder& GetImplementation( const Dali::Integration::SceneHolder& sceneHolder )
+{
+ DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
+ const Dali::RefObject& object = sceneHolder.GetBaseObject();
+ return static_cast<const Internal::Adaptor::SceneHolder&>( object );
+}
+
+} // Dali
+
+#endif // DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/integration-api/scene-holder.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/actors/layer.h>
+#include <dali/integration-api/scene-holder-impl.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+SceneHolder::SceneHolder()
+{
+}
+
+SceneHolder::~SceneHolder()
+{
+}
+
+SceneHolder::SceneHolder( const SceneHolder& handle )
+:BaseHandle(handle)
+{
+}
+
+SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
+: BaseHandle(internal)
+{
+}
+
+SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+void SceneHolder::Add( Actor actor )
+{
+ GetImplementation(*this).Add( actor );
+}
+
+void SceneHolder::Remove( Actor actor )
+{
+ GetImplementation(*this).Remove( actor );
+}
+
+Layer SceneHolder::GetRootLayer() const
+{
+ return GetImplementation(*this).GetRootLayer();
+}
+
+void SceneHolder::SetBackgroundColor( Vector4 color )
+{
+ GetImplementation(*this).SetBackgroundColor( color );
+}
+
+Vector4 SceneHolder::GetBackgroundColor() const
+{
+ return GetImplementation(*this).GetBackgroundColor();
+}
+
+void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
+{
+ GetImplementation(*this).FeedTouchPoint( point, timeStamp );
+}
+
+void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
+{
+ GetImplementation(*this).FeedWheelEvent( wheelEvent );
+}
+
+void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
+{
+ GetImplementation(*this).FeedKeyEvent( keyEvent );
+}
+
+}// Integration
+
+} // Dali
--- /dev/null
+#ifndef DALI_INTEGRATION_SCENEHOLDER_H
+#define DALI_INTEGRATION_SCENEHOLDER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/math/vector4.h>
+
+namespace Dali
+{
+
+class Actor;
+class Layer;
+class Any;
+struct TouchPoint;
+struct WheelEvent;
+struct KeyEvent;
+
+namespace Internal DALI_INTERNAL
+{
+
+namespace Adaptor
+{
+
+class SceneHolder;
+
+}
+
+}
+
+namespace Integration
+{
+
+/**
+ * @brief SceneHolder is responsible for creating a Scene for rendering.
+ */
+class DALI_ADAPTOR_API SceneHolder : public BaseHandle
+{
+public:
+
+ /**
+ * @brief Create an uninitialized SceneHolder handle.
+ */
+ SceneHolder();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~SceneHolder();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ SceneHolder( const SceneHolder& handle );
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ SceneHolder& operator=( const SceneHolder& rhs );
+
+ /**
+ * @brief Adds a child Actor to the SceneHolder.
+ *
+ * The child will be referenced.
+ * @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 SceneHolder.
+ *
+ * The child will be unreferenced.
+ * @param[in] actor The child
+ * @pre The actor has been added to the SceneHolder.
+ */
+ void Remove( Actor actor );
+
+ /**
+ * @brief Returns the Scene's Root Layer.
+ *
+ * @return The root layer
+ */
+ Layer GetRootLayer() const;
+
+ /**
+ * @brief Sets the background color.
+ *
+ * @param[in] color The new background color
+ */
+ void SetBackgroundColor( Vector4 color );
+
+ /**
+ * @brief Gets the background color.
+ *
+ * @return The background color
+ */
+ Vector4 GetBackgroundColor() const;
+
+ /**
+ * @brief Gets the native handle.
+ *
+ * When users call this function, it wraps the actual type used by the underlying system.
+ *
+ * @return The native handle or an empty handle
+ */
+ Any GetNativeHandle() const;
+
+ /**
+ * @brief Feed (Send) touch event to core
+ * @param[in] point The touch point
+ * @param[in] timeStamp The time stamp
+ */
+ void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
+
+ /**
+ * @brief Feed (Send) wheel event to core
+ * @param[in] wheelEvent The wheel event
+ */
+ void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
+
+ /**
+ * @brief Feed (Send) key event to core
+ * @param[in] keyEvent The key event holding the key information.
+ */
+ void FeedKeyEvent( Dali::KeyEvent& keyEvent );
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used internally to create additional SceneHolder handles.
+ *
+ * @param[in] sceneHolder A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL SceneHolder( Internal::Adaptor::SceneHolder* sceneHolder );
+
+};
+
+} // namespace Integration
+
+} // namespace Dali
+
+#endif // DALI_INTEGRATION_SCENEHOLDER_H
thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
} // unnamed namespace
-Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions );
return adaptor;
}
-Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( Dali::Integration::SceneHolder window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
- Window& windowImpl = Dali::GetImplementation( window );
+ Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( window );
Dali::Adaptor* adaptor = New( window, windowImpl.GetSurface(), configuration, environmentOptions );
windowImpl.SetAdaptor( *adaptor );
return adaptor;
}
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Window window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor; // Public adaptor
Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions ); // Impl adaptor
return adaptor;
} // Called second
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Integration::SceneHolder window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
- Window& windowImpl = Dali::GetImplementation( window );
+ Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( window );
Dali::Adaptor* adaptor = New( graphicsFactory, window, windowImpl.GetSurface(), configuration, environmentOptions );
windowImpl.SetAdaptor( *adaptor );
return adaptor;
mCallbackManager = CallbackManager::New();
- WindowPtr defaultWindow = mWindows.front();
+ SceneHolderPtr defaultWindow = mWindows.front();
DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
mGraphics->GetDepthBufferRequired(),
mGraphics->GetStencilBufferRequired() );
- defaultWindow->SetAdaptor( *this );
+ defaultWindow->SetAdaptor( Get() );
const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
if( 0u < timeInterval )
// Start the callback manager
mCallbackManager->Start();
- WindowPtr defaultWindow = mWindows.front();
+ SceneHolderPtr defaultWindow = mWindows.front();
unsigned int dpiHor, dpiVer;
dpiHor = dpiVer = 0;
}
// Pause all windows event handlers when adaptor paused
- for( WindowPtr window : mWindows )
+ for( SceneHolderPtr window : mWindows )
{
window->Pause();
}
mState = RUNNING;
// Reset the event handlers when adaptor resumed
- for( WindowPtr window : mWindows )
+ for( SceneHolderPtr window : mWindows )
{
window->Resume();
}
mWindows.front()->FeedKeyEvent( keyEvent );
}
-void Adaptor::ReplaceSurface( Dali::Window window, Dali::RenderSurfaceInterface& newSurface )
+void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& newSurface )
{
- Window* windowImpl = &Dali::GetImplementation( window );
- for( WindowPtr windowPtr : mWindows )
+ Internal::Adaptor::SceneHolder* windowImpl = &Dali::GetImplementation( window );
+ for( SceneHolderPtr windowPtr : mWindows )
{
if( windowPtr.Get() == windowImpl ) // the window is not deleted
{
mResizedSignal.Emit( mAdaptor );
- windowImpl->SetSurface( static_cast<WindowRenderSurface*>( &newSurface ) );
+ windowImpl->SetSurface( &newSurface );
// Flush the event queue to give the update-render thread chance
// to start processing messages for new camera setup etc as soon as possible
mThreadController->SetPreRenderCallback( callback );
}
-bool Adaptor::AddWindow( Dali::Window* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
+bool Adaptor::AddWindow( Dali::Integration::SceneHolder* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
{
- Window& windowImpl = Dali::GetImplementation( *childWindow );
+ Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow );
windowImpl.SetAdaptor( Get() );
// Add the new Window to the container - the order is not important
- mWindows.push_back( WindowPtr( &windowImpl ) );
+ mWindows.push_back( SceneHolderPtr( &windowImpl ) );
return true;
}
-bool Adaptor::RemoveWindow( Dali::Window* childWindow )
+bool Adaptor::RemoveWindow( Dali::Integration::SceneHolder* childWindow )
{
- Window& windowImpl = Dali::GetImplementation( *childWindow );
+ Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow );
for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
{
if( *iter == &windowImpl )
return false;
}
-bool Adaptor::RemoveWindow( Window* childWindow )
+bool Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* childWindow )
{
for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
{
{
bool allWindowsHidden = true;
- for( WindowPtr window : mWindows )
+ for( SceneHolderPtr window : mWindows )
{
if ( window->IsVisible() )
{
return false;
}
-Adaptor::Adaptor(Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
+Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
: mResizedSignal(),
mLanguageChangedSignal(),
mAdaptor( adaptor ),
mUseRemoteSurface( false )
{
DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
- mWindows.insert( mWindows.begin(), WindowPtr( &Dali::GetImplementation( window ) ) );
+ mWindows.insert( mWindows.begin(), SceneHolderPtr( &Dali::GetImplementation( window ) ) );
gThreadLocalAdaptor = this;
}
#define DALI_INTERNAL_ADAPTOR_IMPL_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.
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor.h>
#include <dali/integration-api/scene.h>
+
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/scene-holder-impl.h>
+#else
+#include <dali/integration-api/adaptors/scene-holder-impl.h>
+#endif
+
#include <dali/public-api/adaptor-framework/tts-player.h>
#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/internal/system/common/core-event-interface.h>
#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
#include <dali/internal/window-system/common/damage-observer.h>
-#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/window-system/common/window-visibility-observer.h>
#include <dali/internal/system/common/kernel-trace.h>
#include <dali/internal/system/common/system-trace.h>
{
class RenderSurfaceInterface;
-class Window;
namespace Integration
{
class PerformanceInterface;
class LifeCycleObserver;
class ObjectProfiler;
+class SceneHolder;
/**
* Implementation of the Adaptor class.
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- static Dali::Adaptor* New( Dali::Window window,
+ static Dali::Adaptor* New( Dali::Integration::SceneHolder window,
Dali::RenderSurfaceInterface* surface,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- static Dali::Adaptor* New( Dali::Window window,
+ static Dali::Adaptor* New( Dali::Integration::SceneHolder window,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
static Dali::Adaptor* New( GraphicsFactory& graphicsFactory,
- Dali::Window window,
+ Dali::Integration::SceneHolder window,
Dali::RenderSurfaceInterface* surface,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
static Dali::Adaptor* New( GraphicsFactory& graphicsFactory,
- Dali::Window window,
+ Dali::Integration::SceneHolder window,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
virtual void FeedKeyEvent( KeyEvent& keyEvent );
/**
- * @copydoc AdaptorInterface::ReplaceSurface()
+ * @copydoc Dali::Adaptor::ReplaceSurface()
*/
- virtual void ReplaceSurface( Dali::Window window, Dali::RenderSurfaceInterface& surface );
+ virtual void ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface );
/**
* @copydoc Dali::Adaptor::GetSurface()
* @param[in] childWindowClassName The class name that the child window belongs to
* @param[in] childWindowMode The mode of the child window
*/
- virtual bool AddWindow( Dali::Window* childWindow,
+ virtual bool AddWindow( Dali::Integration::SceneHolder* childWindow,
const std::string& childWindowName,
const std::string& childWindowClassName,
const bool& childWindowMode );
* Removes an existing Window instance from the Adaptor
* @param[in] window The Window instance
*/
- virtual bool RemoveWindow( Dali::Window* childWindow );
+ virtual bool RemoveWindow( Dali::Integration::SceneHolder* childWindow );
/**
* Removes an existing Window instance from the Adaptor
* Removes an existing Window instance from the Adaptor
* @param[in] childWindow The Window instance
*/
- bool RemoveWindow( Dali::Internal::Adaptor::Window* childWindow );
+ bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow );
public:
* - Window, adaptor will use existing Window to draw on to
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- Adaptor( Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions );
+ Adaptor( Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions );
private: // Types
STOPPED, ///< Adaptor has been stopped.
};
- using WindowPtr = IntrusivePtr< Window >;
- using WindowContainer = std::vector<WindowPtr>;
+ using SceneHolderPtr = IntrusivePtr< Dali::Internal::Adaptor::SceneHolder >;
+ using WindowContainer = std::vector<SceneHolderPtr>;
using ObserverContainer = std::vector<LifeCycleObserver*>;
private: // Data
/*
- * 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.
#include <dali/devel-api/adaptor-framework/style-monitor.h>
#include <dali/integration-api/render-surface.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/window-system/common/window-impl.h>
+
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/scene-holder.h>
+#else
+#include <dali/integration-api/adaptors/scene-holder.h>
+#endif
namespace Dali
{
Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
{
- Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
+ Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), configuration, NULL );
return *adaptor;
}
Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
{
+ Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
+ Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( sceneHolder ), pSurface, configuration, NULL );
+ return *adaptor;
+}
+
+Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
+{
+ return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
+}
+
+Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
+{
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
+ return *adaptor;
+}
+
+Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
+{
+ return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
+}
+
+Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
+{
Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
return *adaptor;
void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
{
+ Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation( window );
+ mImpl->ReplaceSurface( Dali::Integration::SceneHolder( sceneHolder ), surface );
+}
+
+void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface )
+{
mImpl->ReplaceSurface( window, surface );
}
auto graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
- mAdaptor = Dali::Internal::Adaptor::Adaptor::New( graphicsFactory, mMainWindow, mContextLossConfiguration, &mEnvironmentOptions );
+ Integration::SceneHolder sceneHolder = Integration::SceneHolder( &Dali::GetImplementation( mMainWindow ) );
+
+ mAdaptor = Adaptor::New( graphicsFactory, sceneHolder, mContextLossConfiguration, &mEnvironmentOptions );
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
- Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
+ Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
}
void Application::CreateAdaptorBuilder()
#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/devel-api/adaptor-framework/orientation.h>
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/render-surface-interface.h>
+#else
+#include <dali/integration-api/adaptors/render-surface-interface.h>
+#endif
+
// INTERNAL HEADERS
#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
#include <dali/internal/window-system/common/event-handler.h>
namespace Adaptor
{
-uint32_t Window::mWindowCounter = 0;
-
namespace
{
}
Window::Window()
-: mId( mWindowCounter++ ),
- mSurface( nullptr ),
+: mWindowSurface( nullptr ),
mWindowBase(),
- mStarted( false ),
mIsTransparent( false ),
mIsFocusAcceptable( true ),
- mVisible( true ),
mIconified( false ),
mOpaqueState( false ),
mResizeEnabled( false ),
- mAdaptor( NULL ),
mType( Dali::Window::NORMAL ),
mPreferredOrientation( Dali::Window::PORTRAIT ),
mFocusChangedSignal(),
Window::~Window()
{
- if ( mAdaptor )
- {
- mAdaptor->RemoveObserver( *this );
- mAdaptor->RemoveWindow( this );
- mAdaptor = NULL;
- }
-
if ( mEventHandler )
{
mEventHandler->SetRotationObserver( nullptr );
Any surface;
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
+ mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
// Get a window base
- mWindowBase = mSurface->GetWindowBase();
+ mWindowBase = mWindowSurface->GetWindowBase();
// Connect signals
mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
- mSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
+ mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
if( !positionSize.IsEmpty() )
{
SetClass( name, className );
- mSurface->Map();
+ mWindowSurface->Map();
mOrientation = Orientation::New( this );
}
-void Window::SetAdaptor(Dali::Adaptor& adaptor)
-{
- Window::SetAdaptor( Internal::Adaptor::Adaptor::GetImplementation( adaptor ) );
-}
-
-void Window::SetAdaptor(Adaptor& adaptor)
+void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
{
- if( mStarted )
- {
- return;
- }
-
- mStarted = true;
-
- // Create scene for the window
- PositionSize positionSize = mSurface->GetPositionSize();
- mScene = Dali::Integration::Scene::New( Vector2( positionSize.width, positionSize.height ) );
- mScene.SetSurface( *mSurface.get() );
-
- unsigned int dpiHorizontal, dpiVertical;
- dpiHorizontal = dpiVertical = 0;
-
- mSurface->GetDpi( dpiHorizontal, dpiVertical );
- mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
-
- // Add the window to the adaptor observers
- mAdaptor = &adaptor;
- mAdaptor->AddObserver( *this );
-
// Can only create the detector when we know the Core has been instantiated.
mDragAndDropDetector = DragAndDropDetector::New();
- mSurface->SetAdaptor( *mAdaptor );
-
mEventHandler = EventHandlerPtr(
new EventHandler( mScene, *mAdaptor, *mAdaptor->GetGestureManager(), *mAdaptor ) );
}
}
-WindowRenderSurface* Window::GetSurface() const
-{
- return mSurface.get();
-}
-
-void Window::SetSurface(WindowRenderSurface* surface)
+void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
{
- mSurface.reset( surface );
-
- mScene.SetSurface( *mSurface.get() );
-
- unsigned int dpiHorizontal, dpiVertical;
- dpiHorizontal = dpiVertical = 0;
-
- mSurface->GetDpi( dpiHorizontal, dpiVertical );
- mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
-
- mSurface->SetAdaptor( *mAdaptor );
+ mWindowSurface = static_cast<WindowRenderSurface*>( surface );
}
void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
mWindowBase->SetClass( name, className );
}
-std::string Window::GetName() const
-{
- return mName;
-}
-
std::string Window::GetClassName() const
{
return mClassName;
mWindowBase->Activate();
}
-void Window::Add( Dali::Actor actor )
-{
- mScene.Add( actor );
-}
-
-void Window::Remove( Dali::Actor actor )
-{
- mScene.Remove( actor );
-}
-
-Dali::Layer Window::GetRootLayer() const
-{
- return mScene.GetRootLayer();
-}
-
uint32_t Window::GetLayerCount() const
{
return mScene.GetLayerCount();
return mScene.GetLayer( depth );
}
-void Window::SetBackgroundColor( Vector4 color )
-{
- if ( mSurface )
- {
- mSurface->SetBackgroundColor( color );
- }
-}
-
-Vector4 Window::GetBackgroundColor() const
-{
- return mSurface ? mSurface->GetBackgroundColor() : Vector4();
-}
-
void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
{
bool found = false;
Dali::Any Window::GetNativeHandle() const
{
- return mSurface->GetNativeWindow();
+ return mWindowSurface->GetNativeWindow();
}
void Window::SetAcceptFocus( bool accept )
PositionSize oldRect = mSurface->GetPositionSize();
- mSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
+ mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
PositionSize newRect = mSurface->GetPositionSize();
PositionSize oldRect = mSurface->GetPositionSize();
- mSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
+ mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
}
Dali::Window::WindowPosition Window::GetPosition() const
PositionSize oldRect = mSurface->GetPositionSize();
- mSurface->MoveResize( positionSize );
+ mWindowSurface->MoveResize( positionSize );
PositionSize newRect = mSurface->GetPositionSize();
void Window::SetTransparency( bool transparent )
{
- mSurface->SetTransparency( transparent );
+ mWindowSurface->SetTransparency( transparent );
}
bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
void Window::RotationDone( int orientation, int width, int height )
{
- mSurface->RequestRotation( orientation, width, height );
+ mWindowSurface->RequestRotation( orientation, width, height );
mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( width, height ) );
mDeleteRequestSignal.Emit();
}
-void Window::OnStart()
-{
-}
-
-void Window::OnPause()
-{
-}
-
-void Window::OnResume()
-{
-}
-
-void Window::OnStop()
-{
-}
-
-void Window::OnDestroy()
-{
- mAdaptor = NULL;
-}
-
-uint32_t Window::GetId() const
-{
- return mId;
-}
-
void Window::FeedTouchPoint( TouchPoint& point, int timeStamp )
{
if( mEventHandler )
}
}
-void Window::Pause()
+void Window::OnPause()
{
if( mEventHandler )
{
}
}
-void Window::Resume()
+void Window::OnResume()
{
if( mEventHandler )
{
#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/integration-api/scene.h>
+
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/scene-holder-impl.h>
+#else
+#include <dali/integration-api/adaptors/scene-holder-impl.h>
+#endif
// INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/lifecycle-observer.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
{
class Adaptor;
class Actor;
+class RenderSurfaceInterface;
namespace Internal
{
/**
* Window provides a surface to render onto with orientation & indicator properties.
*/
-class Window : public Dali::BaseObject, public LifeCycleObserver, public ConnectionTracker
+class Window : public Dali::Internal::Adaptor::SceneHolder, public ConnectionTracker
{
public:
typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
/**
- * Pass the adaptor back to the overlay. This allows the window to access Core's overlay.
- * @param[in] adaptor An initialized adaptor
- */
- void SetAdaptor(Dali::Adaptor& adaptor);
-
- /**
- * Pass the adaptor back to the overlay. This allows the window to access Core's overlay.
- * @param[in] adaptor implementation An initialized adaptor implementation
- */
- void SetAdaptor(Adaptor& adaptor);
-
- /**
- * Get the window surface
- * @return The render surface
- */
- WindowRenderSurface* GetSurface() const;
-
- /**
- * Set the window surface
- * @param[in] surface The surface
- */
- void SetSurface(WindowRenderSurface* surface);
-
- /**
* @copydoc Dali::Window::ShowIndicator()
*/
void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode );
void SetClass( std::string name, std::string className );
/**
- * @brief Gets the window name.
- * @return The name of the window
- */
- std::string GetName() const;
-
- /**
* @brief Gets the window class name.
* @return The class of the window
*/
void Activate();
/**
- * @copydoc Dali::Window::Add()
- */
- void Add( Dali::Actor actor );
-
- /**
- * @copydoc Dali::Window::Remove()
- */
- void Remove( Dali::Actor remove );
-
- /**
- * @copydoc Dali::Window::SetBackgroundColor()
- */
- void SetBackgroundColor(Vector4 color);
-
- /**
- * @copydoc Dali::Window::GetBackgroundColor()
- */
- Vector4 GetBackgroundColor() const;
-
- /**
- * @copydoc Dali::Window::GetRootLayer()
- */
- Dali::Layer GetRootLayer() const;
-
- /**
* @copydoc Dali::Window::GetLayerCount()
*/
uint32_t GetLayerCount() const;
Dali::DragAndDropDetector GetDragAndDropDetector() const;
/**
- * @copydoc Dali::Window::GetNativeHandle() const
- */
- Dali::Any GetNativeHandle() const;
-
- /**
* @copydoc Dali::Window::SetAcceptFocus()
*/
void SetAcceptFocus( bool accept );
void Hide();
/**
- * @copydoc Dali::Window::IsVisible() const
- */
- bool IsVisible() const;
-
- /**
* @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
*/
unsigned int GetSupportedAuxiliaryHintCount() const;
void RotationDone( int orientation, int width, int height );
/**
- * @brief Retrieves the unique ID of the window.
- * @return The ID
- */
- uint32_t GetId() const;
-
- /**
- * Feed (Send) touch event to core and gesture manager
- * @param[in] touchEvent The touch event holding the touch point information.
- */
- void FeedTouchPoint( TouchPoint& point, int timeStamp );
-
- /**
- * Feed (Send) wheel event to core and gesture manager
- * @param[in] wheelEvent The wheel event
- */
- void FeedWheelEvent( WheelEvent& wheelEvent );
-
- /**
- * Feed (Send) key event to core
- * @param[in] keyEvent The key event holding the key information.
+ * Set the rotation observer (note, some adaptors may not have a rotation observer)
+ * @param[in] observer The rotation observer
+ * @return If the rotation observer is set
*/
- void FeedKeyEvent( KeyEvent& keyEvent );
+ bool SetRotationObserver( RotationObserver* observer );
- /**
- * Called when the adaptor is paused.
- */
- void Pause();
+public: // Dali::Internal::Adaptor::SceneHolder
/**
- * Called when the adaptor is resumed (from pause).
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle
*/
- void Resume();
+ Dali::Any GetNativeHandle() const override;
/**
- * Set the rotation observer (note, some adaptors may not have a rotation observer)
- * @param[in] observer The rotation observer
- * @return If the rotation observer is set
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::IsVisible
*/
- bool SetRotationObserver( RotationObserver* observer );
+ bool IsVisible() const override;
private:
*/
void OnDeleteRequest();
-private: // Adaptor::Observer interface
+private: // Dali::Internal::Adaptor::SceneHolder
/**
- * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStart()
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::FeedTouchPoint
*/
- virtual void OnStart();
+ void FeedTouchPoint( TouchPoint& point, int timeStamp ) override;
/**
- * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnPause()
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::FeedWheelEvent
*/
- virtual void OnPause();
+ void FeedWheelEvent( WheelEvent& wheelEvent ) override;
/**
- * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnResume()
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::FeedKeyEvent
*/
- virtual void OnResume();
+ void FeedKeyEvent( KeyEvent& keyEvent ) override;
/**
- * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStop()
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet
*/
- virtual void OnStop();
+ void OnAdaptorSet( Dali::Adaptor& adaptor ) override;
/**
- * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnDestroy()
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::OnSurfaceSet
*/
- virtual void OnDestroy();
+ void OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::OnPause
+ */
+ void OnPause() override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::SceneHolder::OnResume
+ */
+ void OnResume() override;
public: // Signals
private:
- static uint32_t mWindowCounter; ///< A counter to track the window creation
- uint32_t mId; ///< A unique ID to identify the window starting from 0
- std::unique_ptr< WindowRenderSurface >mSurface; ///< The window rendering surface
- Dali::Integration::Scene mScene;
+ WindowRenderSurface* mWindowSurface; ///< The window rendering surface
WindowBase* mWindowBase;
std::string mName;
std::string mClassName;
- bool mStarted:1;
bool mIsTransparent:1;
bool mIsFocusAcceptable:1;
- bool mVisible:1;
bool mIconified:1;
bool mOpaqueState:1;
bool mResizeEnabled:1;
- Adaptor* mAdaptor;
Dali::DragAndDropDetector mDragAndDropDetector;
Dali::Window::Type mType;
EventHandlerPtr mEventHandler; ///< The window events handler
- Vector4 mBackgroundColor;
-
// Signals
IndicatorSignalType mIndicatorVisibilityChangedSignal;
FocusSignalType mFocusChangedSignal;
Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
{
- Internal::Adaptor::Window* windowImpl = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
+ Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
- Dali::Window window = Dali::Window( windowImpl );
- Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &window, name, "", isTransparent );
+ Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
+ Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
return Window(window);
}
Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
{
- Internal::Adaptor::Window* windowImpl = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+ Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
- Dali::Window window = Dali::Window( windowImpl );
- Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &window, name, className, isTransparent );
+ Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
+ Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, className, isTransparent );
return Window(window);
}