c59735445ba1db7d82f97406591870d33eee8f41
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / application-devel.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // INTERNAL INCLUDES
19 #include <adaptors/devel-api/adaptor-framework/application-devel.h>
20 #include <adaptors/devel-api/adaptor-framework/window-devel.h>
21 #include <adaptors/common/application-impl.h>
22
23 namespace Dali
24 {
25
26 namespace DevelApplication
27 {
28
29 Application New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
30 {
31   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
32   if( internal )
33   {
34     if( argc && ( *argc > 0 ) )
35     {
36       internal->GetWindow().SetClass( (*argv)[0], "" );
37     }
38     internal->SetStyleSheet( stylesheet );
39
40     DevelWindow::SetTransparency( internal->GetWindow(), ( windowMode == Application::OPAQUE ? false : true ) );
41     DevelWindow::SetSize( internal->GetWindow(), DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
42     DevelWindow::SetPosition( internal->GetWindow(), DevelWindow::WindowPosition( positionSize.x, positionSize.y ) );
43
44     return Application( internal.Get() );
45   }
46   else
47   {
48     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
49     return Application( internal.Get() );
50   }
51 }
52
53 void PreInitialize( int* argc, char** argv[] )
54 {
55   Internal::Adaptor::Application::PreInitialize( argc, argv );
56 }
57
58 std::string GetRegion( Application application )
59 {
60   return Internal::Adaptor::GetImplementation( application ).GetRegion();
61 }
62
63 std::string GetLanguage( Application application )
64 {
65   return Internal::Adaptor::GetImplementation( application ).GetLanguage();
66 }
67
68 LowBatterySignalType& LowBatterySignal( Application application )
69 {
70   return Internal::Adaptor::GetImplementation( application ).LowBatterySignal();
71 }
72
73 LowMemorySignalType& LowMemorySignal( Application application )
74 {
75   return Internal::Adaptor::GetImplementation( application ).LowMemorySignal();
76 }
77
78 } // namespace DevelApplication
79
80 } // namespace Dali