/*
- * 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.
#include <algorithm>
-#include <toolkit-window.h>
+#include <toolkit-window-impl.h>
// Don't want to include the actual window.h which otherwise will be indirectly included by adaptor.h.
#define DALI_WINDOW_H
-#include <dali/integration-api/adaptors/adaptor.h>
-
-#include <dali/integration-api/adaptors/scene-holder.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/integration-api/adaptor-framework/scene-holder.h>
+#include <toolkit-scene-holder-impl.h>
#include <toolkit-adaptor-impl.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/scene.h>
#include <test-application.h>
-#include <test-render-surface.h>
namespace Dali
{
void Adaptor::Start( Dali::Window window )
{
- if ( window )
- {
- mWindows.push_back( window );
- mWindowCreatedSignal.Emit( window );
- }
+ AddWindow( &GetImplementation( window ) );
}
Integration::Scene Adaptor::GetScene( Dali::Window window )
{
DALI_ASSERT_ALWAYS( ! mWindows.empty() );
- return reinterpret_cast < Dali::RenderSurfaceInterface& >( mWindows.front().GetRenderSurface() );
+ return reinterpret_cast < Dali::RenderSurfaceInterface& >( mWindows.front()->GetRenderSurface() );
}
Dali::WindowContainer Adaptor::GetWindows()
{
- return mWindows;
+ Dali::WindowContainer windows;
+
+ for ( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+ {
+ // Downcast to Dali::Window
+ Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( *iter ) );
+ if ( window )
+ {
+ windows.push_back( window );
+ }
+ }
+
+ return windows;
+}
+
+Dali::SceneHolderList Adaptor::GetSceneHolders()
+{
+ Dali::SceneHolderList sceneHolderList;
+
+ for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+ {
+ sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) );
+ }
+
+ return sceneHolderList;
+}
+
+Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
+{
+ Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+
+ for( auto window : mWindows )
+ {
+ if ( scene == window->GetScene() )
+ {
+ return window;
+ }
+ }
+
+ return nullptr;
+}
+
+void Adaptor::AddWindow( Internal::Adaptor::SceneHolder* window )
+{
+ if ( window )
+ {
+ mWindows.push_back( window );
+
+ Dali::Integration::SceneHolder newWindow( window );
+ mWindowCreatedSignal.Emit( newWindow );
+ }
+}
+
+void Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* window )
+{
+ auto iter = std::find( mWindows.begin(), mWindows.end(), window );
+ if( iter != mWindows.end() )
+ {
+ mWindows.erase( iter );
+ }
+}
+
+void Adaptor::RegisterProcessor( Integration::Processor& processor )
+{
+ Integration::Core& core = mTestApplication->GetCore();
+ core.RegisterProcessor( processor );
+}
+
+void Adaptor::UnregisterProcessor( Integration::Processor& processor )
+{
+ Integration::Core& core = mTestApplication->GetCore();
+ core.UnregisterProcessor( processor );
+}
+
+void Adaptor::SetApplication( Dali::TestApplication& testApplication )
+{
+ mTestApplication = &testApplication;
}
Dali::Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
return mImpl->GetWindows();
}
+Dali::SceneHolderList Adaptor::GetSceneHolders() const
+{
+ return mImpl->GetSceneHolders();
+}
+
Any Adaptor::GetNativeWindowHandle()
{
Any window;
return window;
}
+Any Adaptor::GetNativeWindowHandle( Actor actor )
+{
+ return GetNativeWindowHandle();
+}
+
void Adaptor::ReleaseSurfaceLock()
{
}
return *gLogFactory;
}
+void Adaptor::RegisterProcessor( Integration::Processor& processor )
+{
+ mImpl->RegisterProcessor( processor );
+}
+
+void Adaptor::UnregisterProcessor( Integration::Processor& processor )
+{
+ mImpl->UnregisterProcessor( processor );
+}
+
} // namespace Dali