[dali_1.0.1] Merge branch 'tizen'
[platform/core/uifw/dali-adaptor.git] / adaptors / common / adaptor.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 // CLASS HEADER
19 #include <adaptor.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23 #include <accessibility-manager.h>
24 #include <imf-manager.h>
25 #include <style-monitor.h>
26 #include <window.h>
27
28 // INTERNAL INCLUDES
29 #include <adaptor-impl.h>
30 #include <render-surface-impl.h>
31 #include <window-impl.h>
32
33 namespace Dali
34 {
35
36 Adaptor& Adaptor::New( Window window )
37 {
38   return New( window, DeviceLayout::DEFAULT_BASE_LAYOUT );
39 }
40
41 Adaptor& Adaptor::New( Window window, const DeviceLayout& baseLayout )
42 {
43   Internal::Adaptor::Window& windowImpl = GetImplementation(window);
44   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( windowImpl.GetSurface(), baseLayout );
45   windowImpl.SetAdaptor(*adaptor);
46   return *adaptor;
47 }
48
49 Adaptor::~Adaptor()
50 {
51   delete mImpl;
52 }
53
54 void Adaptor::Start()
55 {
56   mImpl->Start();
57 }
58
59 void Adaptor::Pause()
60 {
61   mImpl->Pause();
62 }
63
64 void Adaptor::Resume()
65 {
66   mImpl->Resume();
67 }
68
69 void Adaptor::Stop()
70 {
71   mImpl->Stop();
72 }
73
74 bool Adaptor::AddIdle( boost::function<void(void)> callBack )
75 {
76   return mImpl->AddIdle(callBack);
77 }
78
79 Adaptor::AdaptorSignalV2& Adaptor::ResizedSignal()
80 {
81   return mImpl->ResizedSignal();
82 }
83
84 Adaptor::AdaptorSignalV2& Adaptor::LanguageChangedSignal()
85 {
86   return mImpl->LanguageChangedSignal();
87 }
88
89 RenderSurface& Adaptor::GetSurface()
90 {
91   return mImpl->GetSurface();
92 }
93
94 Adaptor& Adaptor::Get()
95 {
96   return Internal::Adaptor::Adaptor::Get();
97 }
98
99 bool Adaptor::IsAvailable()
100 {
101   return Internal::Adaptor::Adaptor::IsAvailable();
102 }
103
104 void Adaptor::RegisterSingleton(const std::type_info& info, BaseHandle singleton)
105 {
106   mImpl->RegisterSingleton(info, singleton);
107 }
108
109 BaseHandle Adaptor::GetSingleton(const std::type_info& info) const
110 {
111   return mImpl->GetSingleton(info);
112 }
113
114 void Adaptor::NotifyLanguageChanged()
115 {
116   mImpl->NotifyLanguageChanged();
117 }
118
119 void Adaptor::SetMinimumPinchDistance(float distance)
120 {
121   mImpl->SetMinimumPinchDistance(distance);
122 }
123
124 Adaptor::Adaptor()
125 : mImpl( NULL )
126 {
127 }
128
129 } // namespace Dali