[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-adaptor-impl.h
1 #ifndef DALI_TOOLKIT_ADAPTOR_IMPL_H
2 #define DALI_TOOLKIT_ADAPTOR_IMPL_H
3
4 /*
5  * Copyright (c) 2024 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
22
23 namespace Dali
24 {
25 class EglInterface;
26 class DisplayConnection;
27 class ThreadSynchronizationInterface;
28 class Window;
29 class TestApplication;
30
31 namespace Integration
32 {
33 class Scene;
34 }
35
36 using WindowContainer = std::vector<Window>;
37
38 namespace Internal
39 {
40 namespace Adaptor
41 {
42 class GraphicsInterface;
43 class SceneHolder;
44
45 } // namespace Adaptor
46
47 } // namespace Internal
48
49 namespace Integration
50 {
51 class GlAbstraction;
52
53 } // namespace Integration
54
55 namespace Internal
56 {
57 namespace Adaptor
58 {
59 class Adaptor
60 {
61 public:
62   static Dali::Adaptor& New();
63   static Dali::Adaptor& Get();
64   Adaptor();
65   ~Adaptor();
66
67   void Start(Dali::Window window);
68   void Stop();
69
70   bool AddIdle(CallbackBase* callback, bool hasReturnValue);
71   void RemoveIdle(CallbackBase* callback);
72   void RunIdles();
73
74   static Integration::Scene GetScene(Dali::Window window);
75
76   Dali::RenderSurfaceInterface& GetSurface();
77   Dali::WindowContainer         GetWindows();
78   Dali::SceneHolderList         GetSceneHolders();
79
80   Dali::Internal::Adaptor::SceneHolder* GetWindow(Dali::Actor& actor);
81   void                                  AddWindow(Internal::Adaptor::SceneHolder* window);
82   void                                  RemoveWindow(Internal::Adaptor::SceneHolder* window);
83
84   void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
85   void UnregisterProcessor(Integration::Processor& processor, bool postProcessor = false);
86
87   void SetApplication(Dali::TestApplication& testApplication);
88
89   bool IsStopped() const
90   {
91     return mStopped;
92   }
93
94   Dali::Adaptor::AdaptorSignalType&       ResizedSignal();
95   Dali::Adaptor::AdaptorSignalType&       LanguageChangedSignal();
96   Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
97   Dali::Adaptor::LocaleChangedSignalType& LocaleChangedSignal();
98
99   static Adaptor& GetImpl(Dali::Adaptor& adaptor)
100   {
101     return *adaptor.mImpl;
102   }
103   static const Adaptor& GetImpl(const Dali::Adaptor& adaptor)
104   {
105     return *adaptor.mImpl;
106   }
107
108 private:
109   Vector<CallbackBase*>                        mCallbacks;
110   Vector<CallbackBase*>                        mReturnCallbacks;
111   std::vector<Internal::Adaptor::SceneHolder*> mWindows;
112   Dali::Adaptor::AdaptorSignalType             mResizedSignal;
113   Dali::Adaptor::AdaptorSignalType             mLanguageChangedSignal;
114   Dali::Adaptor::WindowCreatedSignalType       mWindowCreatedSignal;
115   Dali::Adaptor::LocaleChangedSignalType       mLocaleChangedSignal;
116   TestApplication*                             mTestApplication;
117   bool                                         mStopped{false};
118 };
119
120 } // namespace Adaptor
121 } // namespace Internal
122 } // namespace Dali
123
124 #endif // DALI_TOOLKIT_ADAPTOR_IMPL_H