X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fpublic-api%2Fadaptor-framework%2Fapplication.cpp;h=1db99e3e55de676dd409a6b3b6d9f08d1ecaf1fc;hb=3735e8b0ab7959c919c4f0f699bb4607e1807afd;hp=5e87bac34fbdb8d47b94f2fbc0729c39b6fee0fd;hpb=6ea848e5b8561680360328d6d3885b43b45cc2a4;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/public-api/adaptor-framework/application.cpp b/adaptors/public-api/adaptor-framework/application.cpp index 5e87bac..1db99e3 100644 --- a/adaptors/public-api/adaptor-framework/application.cpp +++ b/adaptors/public-api/adaptor-framework/application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 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. @@ -19,50 +19,115 @@ #include "application.h" // EXTERNAL INCLUDES -#include #include // INTERNAL INCLUDES #include -#include namespace Dali { -Application Application::New( int* argc, char **argv[] ) +Application Application::New() { - Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE ); - return Application(internal.Get()); + return New( NULL, NULL ); } -Application Application::New( int* argc, char **argv[], const std::string& name ) +Application Application::New( int* argc, char **argv[] ) { - Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE ); - return Application(internal.Get()); + Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication(); + if( internal ) + { + if( argc && ( *argc > 0 ) ) + { + internal->GetWindow().SetClass( (*argv)[0], "" ); + } + + return Application( internal.Get() ); + } + else + { + internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(), + Internal::Adaptor::Framework::NORMAL); + return Application(internal.Get()); + } } -Application Application::New( int* argc, char **argv[], const std::string& name, WINDOW_MODE windowMode ) +Application Application::New( int* argc, char **argv[], const std::string& stylesheet ) { - Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, windowMode ); - return Application(internal.Get()); + Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication(); + if( internal ) + { + if( argc && ( *argc > 0 ) ) + { + internal->GetWindow().SetClass( (*argv)[0], "" ); + } + internal->SetStyleSheet( stylesheet ); + + return Application( internal.Get() ); + } + else + { + internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(), + Internal::Adaptor::Framework::NORMAL); + return Application(internal.Get()); + } } -Application Application::New(int* argc, char **argv[], const DeviceLayout& baseLayout) +Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode ) { - Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", baseLayout, OPAQUE ); - return Application(internal.Get()); + Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication(); + if( internal ) + { + if( argc && ( *argc > 0 ) ) + { + internal->GetWindow().SetClass( (*argv)[0], "" ); + } + internal->SetStyleSheet( stylesheet ); + + internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) ); + + return Application( internal.Get() ); + } + else + { + internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(), + Internal::Adaptor::Framework::NORMAL); + return Application(internal.Get()); + } } -Application Application::New(int* argc, char **argv[], const std::string& name, const DeviceLayout& baseLayout) +Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize ) { - Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, baseLayout, OPAQUE ); - return Application(internal.Get()); + Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication(); + if( internal ) + { + if( argc && ( *argc > 0 ) ) + { + internal->GetWindow().SetClass( (*argv)[0], "" ); + } + internal->SetStyleSheet( stylesheet ); + + internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) ); + internal->GetWindow().SetSize( Window::WindowSize( positionSize.width, positionSize.height ) ); + internal->GetWindow().SetPosition( Window::WindowPosition( positionSize.x, positionSize.y ) ); + + return Application( internal.Get() ); + } + else + { + internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL ); + return Application( internal.Get() ); + } } Application::~Application() { } +Application::Application() +{ +} + Application::Application(const Application& application) : BaseHandle(application) { @@ -79,7 +144,12 @@ Application& Application::operator=(const Application& application) void Application::MainLoop() { - Internal::Adaptor::GetImplementation(*this).MainLoop(); + Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS); +} + +void Application::MainLoop(Configuration::ContextLoss configuration) +{ + Internal::Adaptor::GetImplementation(*this).MainLoop(configuration); } void Application::Lower() @@ -92,29 +162,34 @@ void Application::Quit() Internal::Adaptor::GetImplementation(*this).Quit(); } -Orientation Application::GetOrientation() +bool Application::AddIdle( CallbackBase* callback ) { - Window window = GetWindow(); - if( window ) - { - return window.GetOrientation(); - } - return Orientation(); + return Internal::Adaptor::GetImplementation(*this).AddIdle( callback ); } -bool Application::AddIdle(boost::function callBack) +Window Application::GetWindow() { - return Internal::Adaptor::GetImplementation(*this).AddIdle(callBack); + return Internal::Adaptor::GetImplementation(*this).GetWindow(); } -Window Application::GetWindow() +void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name) { - return Internal::Adaptor::GetImplementation(*this).GetWindow(); + Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name); +} + +std::string Application::GetResourcePath() +{ + return Internal::Adaptor::Application::GetResourcePath(); } -Application Application::Get() +std::string Application::GetRegion() const { - return Internal::Adaptor::Application::Get(); + return Internal::Adaptor::GetImplementation(*this).GetRegion(); +} + +std::string Application::GetLanguage() const +{ + return Internal::Adaptor::GetImplementation(*this).GetLanguage(); } void Application::SetViewMode( ViewMode viewMode ) @@ -137,41 +212,75 @@ float Application::GetStereoBase() const return Internal::Adaptor::GetImplementation(*this).GetStereoBase(); } -Application::AppSignalV2& Application::InitSignal() +Application::AppSignalType& Application::InitSignal() { return Internal::Adaptor::GetImplementation(*this).InitSignal(); } -Application::AppSignalV2& Application::TerminateSignal() +Application::AppSignalType& Application::TerminateSignal() { return Internal::Adaptor::GetImplementation(*this).TerminateSignal(); } -Application::AppSignalV2& Application::PauseSignal() +Application::AppSignalType& Application::PauseSignal() { return Internal::Adaptor::GetImplementation(*this).PauseSignal(); } -Application::AppSignalV2& Application::ResumeSignal() +Application::AppSignalType& Application::ResumeSignal() { return Internal::Adaptor::GetImplementation(*this).ResumeSignal(); } -Application::AppSignalV2& Application::ResetSignal() +Application::AppSignalType& Application::ResetSignal() { return Internal::Adaptor::GetImplementation(*this).ResetSignal(); } -Application::AppSignalV2& Application::ResizeSignal() +Application::AppSignalType& Application::ResizeSignal() { + DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" ); + return Internal::Adaptor::GetImplementation(*this).ResizeSignal(); } -Application::AppSignalV2& Application::LanguageChangedSignal() +Application::AppControlSignalType & Application::AppControlSignal() +{ + return Internal::Adaptor::GetImplementation(*this).AppControlSignal(); +} + +Application::AppSignalType& Application::LanguageChangedSignal() { return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal(); } +Application::AppSignalType& Application::RegionChangedSignal() +{ + return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal(); +} + +Application::AppSignalType& Application::BatteryLowSignal() +{ + DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" ); + return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal(); +} + +Application::AppSignalType& Application::MemoryLowSignal() +{ + DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" ); + return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal(); +} + +Application::LowBatterySignalType& Application::LowBatterySignal() +{ + return Internal::Adaptor::GetImplementation(*this).LowBatterySignal(); +} + +Application::LowMemorySignalType& Application::LowMemorySignal() +{ + return Internal::Adaptor::GetImplementation(*this).LowMemorySignal(); +} + Application::Application(Internal::Adaptor::Application* application) : BaseHandle(application) {