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