Merge remote-tracking branch 'origin/tizen' into new_text
[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
24 // INTERNAL INCLUDES
25 #include <accessibility-manager.h>
26 #include <imf-manager.h>
27 #include <style-monitor.h>
28 #include <window.h>
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, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
39 }
40
41 Adaptor& Adaptor::New( Window window, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration )
42 {
43   Internal::Adaptor::Window& windowImpl = GetImplementation(window);
44   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( windowImpl.GetSurface(), baseLayout, configuration );
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( CallbackBase* callback )
75 {
76   return mImpl->AddIdle( callback );
77 }
78
79 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
80 {
81   return mImpl->ResizedSignal();
82 }
83
84 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
85 {
86   return mImpl->LanguageChangedSignal();
87 }
88
89 RenderSurface& Adaptor::GetSurface()
90 {
91   return mImpl->GetSurface();
92 }
93
94 void Adaptor::ReleaseSurfaceLock()
95 {
96   mImpl->ReleaseSurfaceLock();
97 }
98
99 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
100 {
101   mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
102 }
103
104 void Adaptor::SetUseHardwareVSync(bool useHardware)
105 {
106   mImpl->SetUseHardwareVSync( useHardware );
107 }
108
109 Adaptor& Adaptor::Get()
110 {
111   return Internal::Adaptor::Adaptor::Get();
112 }
113
114 bool Adaptor::IsAvailable()
115 {
116   return Internal::Adaptor::Adaptor::IsAvailable();
117 }
118
119 void Adaptor::NotifyLanguageChanged()
120 {
121   mImpl->NotifyLanguageChanged();
122 }
123
124 void Adaptor::SetMinimumPinchDistance(float distance)
125 {
126   mImpl->SetMinimumPinchDistance(distance);
127 }
128
129 Adaptor::Adaptor()
130 : mImpl( NULL )
131 {
132 }
133
134 } // namespace Dali