*
*/
-#define __DALI_ADAPTOR_H__
-#define __DALI_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TIMER_H__
-#define __DALI_CLIPBOARD_H__
-#define IMFMANAGER_H
+// CLASS HEADER
+#include <dali/integration-api/adaptors/adaptor.h>
-#include "toolkit-adaptor.h"
-#include <map>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/adaptor-framework/render-surface.h>
namespace Dali
{
-////////////////////////////////////////////////////////////////////////////////////////////////////
+class EglInterface;
+class DisplayConnection;
+class ThreadSynchronizationInterface;
-class TestRenderSurface : public RenderSurface
+namespace Integration
{
-public:
- TestRenderSurface(){}
- virtual ~TestRenderSurface(){}
- virtual SurfaceType GetType() { return RenderSurface::WINDOW; }
- virtual Dali::Any GetSurface() { return Dali::Any(); }
- virtual Dali::Any GetDisplay() { return Dali::Any(); }
- virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);}
- virtual void SetRenderMode(RenderMode mode){}
- virtual RenderMode GetRenderMode() const { return RenderSurface::RENDER_60FPS; }
-};
-typedef Dali::Rect<int> PositionSize;
+class GlAbstraction;
-/**
- * Stub for the Adaptor
- */
-class Adaptor
+} // namespace Integration
+
+class TestRenderSurface : public RenderSurface
{
public:
+ virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
- typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
+ virtual void InitializeEgl( EglInterface& egl ) {}
- typedef std::pair<std::string, Dali::BaseHandle> SingletonPair;
- typedef std::map<std::string, Dali::BaseHandle> SingletonContainer;
- typedef SingletonContainer::const_iterator SingletonConstIter;
+ virtual void CreateEglSurface( EglInterface& egl ) {}
-public:
+ virtual void DestroyEglSurface( EglInterface& egl ) {}
- Adaptor(ToolkitAdaptor& toolkitAdaptor);
- ~Adaptor();
+ virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
-public:
+ virtual void MoveResize( Dali::PositionSize positionSize ) {}
- void Start();
- void Pause();
- void Resume();
- void Stop();
- bool AddIdle(boost::function<void(void)> callBack);
- void FeedEvent(TouchPoint& point, int timeStamp);
- bool MoveResize(const PositionSize& positionSize);
- void SurfaceResized(const PositionSize& positionSize);
- void ReplaceSurface(RenderSurface& surface);
- void RenderSync();
- RenderSurface& GetSurface();
+ virtual void SetViewMode( ViewMode viewMode ) {}
- void RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton);
- Dali::BaseHandle GetSingleton(const std::type_info& info) const;
+ virtual void StartRender() {}
-public: // static methods
- static Adaptor& Get();
- static bool IsAvailable();
+ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
-public: // Signals
+ virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
- AdaptorSignalV2& SignalResize();
+ virtual void StopRender() {}
- void EmitSignalResize()
- {
- mResizeSignal.Emit( *this );
- }
+ virtual void ReleaseLock() {}
-private:
+ virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
- // Undefined
- Adaptor(const Adaptor&);
- Adaptor& operator=(Adaptor&);
+ virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
+};
- AdaptorSignalV2 mResizeSignal;
- TestRenderSurface mRenderSurface;
- ToolkitAdaptor& mToolkitAdaptor;
+namespace Internal
+{
+namespace Adaptor
+{
- SingletonContainer mSingletonContainer;
+class Adaptor: public BaseObject
+{
+public:
+ static Dali::Adaptor& Get();
+ Adaptor();
+ ~Adaptor();
+
+public:
+ static Dali::RenderSurface& GetSurface();
+ static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
};
-namespace
+Dali::Adaptor& Adaptor::Get()
{
-Adaptor* gAdaptor = NULL;
+ Dali::Adaptor* adaptor = new Dali::Adaptor;
+ return *adaptor;
+}
+Dali::RenderSurface& Adaptor::GetSurface()
+{
+ Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
+ return *renderSurface;
}
-Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor)
-: mToolkitAdaptor(toolkitAdaptor)
+Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
{
+ Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
+ return *signal;
}
-Adaptor::~Adaptor()
+}
+}
+}
+
+namespace Dali
+{
+
+Adaptor& Adaptor::New( Window window )
+{
+ return Internal::Adaptor::Adaptor::Get();
+}
+
+Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
+{
+ return Internal::Adaptor::Adaptor::Get();
+}
+
+Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
{
+ return Internal::Adaptor::Adaptor::Get();
+}
+Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
+{
+ return Internal::Adaptor::Adaptor::Get();
+}
+
+Adaptor::~Adaptor()
+{
}
void Adaptor::Start()
{
- mToolkitAdaptor.mFunctionsCalled.Start = true;
}
void Adaptor::Pause()
{
- mToolkitAdaptor.mFunctionsCalled.Pause = true;
}
void Adaptor::Resume()
{
- mToolkitAdaptor.mFunctionsCalled.Resume = true;
}
void Adaptor::Stop()
{
- mToolkitAdaptor.mFunctionsCalled.Stop = true;
}
-bool Adaptor::AddIdle(boost::function<void(void)> callBack)
+bool Adaptor::AddIdle( CallbackBase* callback )
{
- mToolkitAdaptor.mFunctionsCalled.AddIdle = true;
- mToolkitAdaptor.mLastIdleAdded = callBack;
- return true;
+ return false;
}
-void Adaptor::FeedEvent(TouchPoint& point, int timeStamp)
+void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
{
- mToolkitAdaptor.mFunctionsCalled.FeedEvent = true;
- mToolkitAdaptor.mLastTouchPointFed = point;
- mToolkitAdaptor.mLastTimeStampFed = timeStamp;
}
-bool Adaptor::MoveResize(const PositionSize& positionSize)
+Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
{
- mToolkitAdaptor.mFunctionsCalled.MoveResize = true;
- mToolkitAdaptor.mLastSizeSet = positionSize;
- return true;
+ return Internal::Adaptor::Adaptor::AdaptorSignal();
}
-void Adaptor::SurfaceResized(const PositionSize& positionSize)
+Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
{
- mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true;
- mToolkitAdaptor.mLastSizeSet = positionSize;
+ return Internal::Adaptor::Adaptor::AdaptorSignal();
}
-void Adaptor::ReplaceSurface(RenderSurface& surface)
+RenderSurface& Adaptor::GetSurface()
{
- mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true;
+ return Internal::Adaptor::Adaptor::GetSurface();
}
-void Adaptor::RenderSync()
+Any Adaptor::GetNativeWindowHandle()
{
- mToolkitAdaptor.mFunctionsCalled.RenderSync = true;
+ Any window;
+ return window;
}
-RenderSurface& Adaptor::GetSurface()
+void Adaptor::ReleaseSurfaceLock()
{
- mToolkitAdaptor.mFunctionsCalled.GetSurface = true;
- return mRenderSurface;
}
-Adaptor& Adaptor::Get()
+void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
{
- DALI_ASSERT_ALWAYS(gAdaptor);
- gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true;
- return *gAdaptor;
}
-bool Adaptor::IsAvailable()
+void Adaptor::SetUseHardwareVSync(bool useHardware)
{
- bool available(false);
-
- if (gAdaptor)
- {
- gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true;
- available = true;
- }
+}
- return available;
+Adaptor& Adaptor::Get()
+{
+ return Internal::Adaptor::Adaptor::Get();
}
-void Adaptor::RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton)
+bool Adaptor::IsAvailable()
{
- mToolkitAdaptor.mFunctionsCalled.RegisterSingleton = true;
+ return false;
+}
- if(singleton)
- {
- mSingletonContainer.insert(SingletonPair(info.name(), singleton));
- }
+void Adaptor::NotifySceneCreated()
+{
}
-Dali::BaseHandle Adaptor::GetSingleton(const std::type_info& info) const
+void Adaptor::NotifyLanguageChanged()
{
- mToolkitAdaptor.mFunctionsCalled.GetSingleton = true;
+}
- Dali::BaseHandle object = Dali::BaseHandle();
+void Adaptor::SetMinimumPinchDistance(float distance)
+{
+}
- SingletonConstIter iter = mSingletonContainer.find(info.name());
- if(iter != mSingletonContainer.end())
- {
- object = (*iter).second;
- }
+void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
+{
+}
- return object;
+void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
+{
}
-Adaptor::AdaptorSignalV2& Adaptor::SignalResize()
+void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
{
- mToolkitAdaptor.mFunctionsCalled.SignalResize = true;
- return mResizeSignal;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+void Adaptor::SceneCreated()
+{
+}
-ToolkitAdaptor::ToolkitAdaptor()
-: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f),
- mLastTimeStampFed(0),
- mStyleMonitor(StyleMonitor::Get()),
- mAccessibilityManager(AccessibilityManager::Get()),
- mImfManager(ImfManager::Get()),
- mAdaptorStub(new Adaptor(*this))
+void Adaptor::SetViewMode( ViewMode mode )
{
- gAdaptor = mAdaptorStub;
}
-ToolkitAdaptor::~ToolkitAdaptor()
+void Adaptor::SetStereoBase( float stereoBase )
{
- delete mAdaptorStub;
- gAdaptor = NULL;
}
-void ToolkitAdaptor::EmitSignalResize()
+Adaptor::Adaptor()
+: mImpl( NULL )
{
- mAdaptorStub->EmitSignalResize();
}
} // namespace Dali