Add Wayland support.
[platform/core/uifw/dali-toolkit.git] / automated-tests / TET / dali-toolkit-test-utils / toolkit-application.cpp
1 /*
2  * Copyright (c) 2014 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 #include "toolkit-application.h"
19
20 #include <boost/any.hpp>
21
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/signals/dali-signal-v2.h>
24 #include <dali/public-api/adaptor-framework/common/orientation.h>
25
26 namespace Dali
27 {
28
29 ////////////////////////////////////////////////////////////////////////////////////////////////////
30
31
32 /**
33  * Stub for the Application
34  */
35 class Application
36 {
37 public:
38
39 public:
40
41   Application(ToolkitApplication& toolkitApplication);
42   ~Application();
43
44 public:
45
46   Orientation& GetOrientation();
47
48 public: // static methods
49
50 public:  // Signals
51
52 private:
53
54   // Undefined
55   Application(const Application&);
56   Application& operator=(Application&);
57
58   ToolkitApplication& mToolkitApplication;
59
60   Dali::Orientation* mOrientation;
61 };
62
63 namespace
64 {
65 Application* gApplication = NULL;
66 }
67
68 Application::Application(ToolkitApplication& toolkitApplication)
69 : mToolkitApplication(toolkitApplication),
70   mOrientation( new Dali::Orientation() )
71 {
72 }
73
74 Application::~Application()
75 {
76   delete mOrientation;
77 }
78
79 Orientation& Application::GetOrientation()
80 {
81   return *mOrientation;
82 }
83
84 ////////////////////////////////////////////////////////////////////////////////////////////////////
85
86 ToolkitApplication::ToolkitApplication()
87 : mApplicationStub(new Application(*this))
88 {
89   gApplication = mApplicationStub;
90 }
91
92 ToolkitApplication::~ToolkitApplication()
93 {
94   delete mApplicationStub;
95   gApplication = NULL;
96 }
97
98 Application& ToolkitApplication::GetApplication()
99 {
100   DALI_ASSERT_ALWAYS(gApplication);
101   return *gApplication;
102 }
103
104 } // namespace Dali