// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-#include <style-monitor.h>
// INTERNAL INCLUDES
+#include <style-monitor.h>
#include <command-line-options.h>
#include <common/adaptor-impl.h>
#include <singleton-service-impl.h>
+#include <lifecycle-controller-impl.h>
namespace Dali
{
-namespace SlpPlatform
+namespace TizenPlatform
{
-class SlpPlatformAbstraction;
+class TizenPlatformAbstraction;
}
namespace Integration
namespace Adaptor
{
-namespace
-{
-// Defaults taken from H2 device
-const unsigned int DEFAULT_WINDOW_WIDTH = 480;
-const unsigned int DEFAULT_WINDOW_HEIGHT = 800;
-const float DEFAULT_HORIZONTAL_DPI = 220;
-const float DEFAULT_VERTICAL_DPI = 217;
-}
-
ApplicationPtr Application::New(
int* argc,
char **argv[],
}
Application::Application( int* argc, char** argv[], const std::string& name, const DeviceLayout& baseLayout, Dali::Application::WINDOW_MODE windowMode)
-: mInitSignalV2(),
- mTerminateSignalV2(),
- mPauseSignalV2(),
- mResumeSignalV2(),
- mResetSignalV2(),
- mResizeSignalV2(),
- mLanguageChangedSignalV2(),
+: mInitSignal(),
+ mTerminateSignal(),
+ mPauseSignal(),
+ mResumeSignal(),
+ mResetSignal(),
+ mResizeSignal(),
+ mAppControlSignal(),
+ mLanguageChangedSignal(),
+ mRegionChangedSignal(),
+ mBatteryLowSignal(),
+ mMemoryLowSignal(),
mEventLoop( NULL ),
mFramework( NULL ),
mCommandLineOptions( NULL ),
Application::~Application()
{
+ mSingletonService.UnregisterAll();
+
delete mFramework;
delete mCommandLineOptions;
delete mAdaptor;
void Application::CreateWindow()
{
-#ifndef __arm__
- PositionSize windowPosition(0, 0, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
-#else
- PositionSize windowPosition(0, 0, 0, 0); // this will use full screen
-#endif
- if (mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0)
+ PositionSize windowPosition(0, 0, 0, 0); // this will use full screen
+
+ if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
{
// let the command line options over ride
- windowPosition = PositionSize(0,0,mCommandLineOptions->stageWidth,mCommandLineOptions->stageHeight);
+ windowPosition = PositionSize( 0, 0, mCommandLineOptions->stageWidth, mCommandLineOptions->stageHeight );
}
mWindow = Dali::Window::New( windowPosition, mName, mWindowMode == Dali::Application::TRANSPARENT );
mAdaptor = &Dali::Adaptor::New( mWindow, mBaseLayout, mContextLossConfiguration );
- // Allow DPI to be overridden from command line.
- unsigned int hDPI=DEFAULT_HORIZONTAL_DPI;
- unsigned int vDPI=DEFAULT_VERTICAL_DPI;
-
- std::string dpiStr = mCommandLineOptions->stageDPI;
- if(!dpiStr.empty())
- {
- sscanf(dpiStr.c_str(), "%ux%u", &hDPI, &vDPI);
- }
- Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetDpi(hDPI, vDPI);
-
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
}
void Application::Quit()
{
// Actually quit the application.
- AddIdle(boost::bind(&Application::QuitFromMainLoop, this));
+ AddIdle( MakeCallback( this, &Application::QuitFromMainLoop ) );
}
void Application::QuitFromMainLoop()
mAdaptor->Stop();
Dali::Application application(this);
- mTerminateSignalV2.Emit( application );
+ mTerminateSignal.Emit( application );
mFramework->Quit();
// This will trigger OnTerminate(), below, after the main loop has completed.
void Application::OnInit()
{
- mFramework->AddAbortCallback(boost::bind(&Application::QuitFromMainLoop, this));
+ mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
CreateWindow();
CreateAdaptor();
mInitialized = true;
- // in default, auto hide indicator mode
- mWindow.ShowIndicator(Dali::Window::AUTO);
+ // Wire up the LifecycleController
+ Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
+
+ InitSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnInit );
+ TerminateSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnTerminate );
+ PauseSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnPause );
+ ResumeSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnResume );
+ ResetSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnReset );
+ ResizeSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnResize );
+ LanguageChangedSignal().Connect( &GetImplementation( lifecycleController ), &LifecycleController::OnLanguageChanged );
Dali::Application application(this);
- mInitSignalV2.Emit( application );
+ mInitSignal.Emit( application );
+
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetCore().SceneCreated();
}
void Application::OnTerminate()
{
mAdaptor->Pause();
Dali::Application application(this);
- mPauseSignalV2.Emit( application );
+ mPauseSignal.Emit( application );
}
void Application::OnResume()
{
mAdaptor->Resume();
Dali::Application application(this);
- mResumeSignalV2.Emit( application );
+ mResumeSignal.Emit( application );
}
void Application::OnReset()
* because Application class already handled initialization in OnInit(), OnReset do nothing.
*/
Dali::Application application(this);
- mResetSignalV2.Emit( application );
+ mResetSignal.Emit( application );
mWindow.Raise();
}
+void Application::OnAppControl(void *data)
+{
+ Dali::Application application(this);
+ mAppControlSignal.Emit( application , data );
+}
+
void Application::OnLanguageChanged()
{
mAdaptor->NotifyLanguageChanged();
}
+void Application::OnRegionChanged()
+{
+ Dali::Application application(this);
+ mRegionChangedSignal.Emit( application );
+}
+
+void Application::OnBatteryLow()
+{
+ Dali::Application application(this);
+ mBatteryLowSignal.Emit( application );
+}
+
+void Application::OnMemoryLow()
+{
+ Dali::Application application(this);
+ mMemoryLowSignal.Emit( application );
+}
+
void Application::OnResize(Dali::Adaptor& adaptor)
{
Dali::Application application(this);
- mResizeSignalV2.Emit( application );
+ mResizeSignal.Emit( application );
}
-bool Application::AddIdle(boost::function<void(void)> callBack)
+bool Application::AddIdle( CallbackBase* callback )
{
- return mAdaptor->AddIdle(callBack);
+ return mAdaptor->AddIdle( callback );
}
Dali::Adaptor& Application::GetAdaptor()
windowImpl.SetAdaptor(*mAdaptor);
newWindow.ShowIndicator(Dali::Window::INVISIBLE);
Dali::RenderSurface* renderSurface = windowImpl.GetSurface();
- Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(*renderSurface);
+
+ Any nativeWindow = newWindow.GetNativeHandle();
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
mWindow = newWindow;
}