Change RenderTaskList to behave like any other SceneGraph object
[platform/core/uifw/dali-core.git] / dali / internal / event / common / system-overlay-impl.h
1 #ifndef __DALI_INTERNAL_SYSTEM_OVERLAY_H__
2 #define __DALI_INTERNAL_SYSTEM_OVERLAY_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/public-api/math/vector2.h>
23 #include <dali/integration-api/system-overlay.h>
24 #include <dali/internal/common/owner-pointer.h>
25 #include <dali/internal/event/actors/actor-declarations.h>
26 #include <dali/internal/event/render-tasks/render-task-defaults.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 class LayerList;
35 class RenderTaskList;
36 class EventThreadServices;
37
38 /**
39  * Implementation of Dali::Integration::SystemOverlay
40  */
41 class SystemOverlay : public RenderTaskDefaults
42 {
43 public:
44
45   /**
46    * Create the SystemOverlay; This should only be done once for each Dali core.
47    * @param[in] eventThreadServices to send messaged to scene graph.
48    * @return The newly allocated SystemOverlay.
49    */
50   static SystemOverlay* New( EventThreadServices& eventThreadServices );
51
52   /**
53    * Non-virtual destructor; not intended as a base class.
54    */
55   ~SystemOverlay();
56
57   /**
58    * @copydoc Dali::Integration::SystemOverlay::Add()
59    */
60   void Add( Actor& actor );
61
62   /**
63    * @copydoc Dali::Integration::SystemOverlay::Remove()
64    */
65   void Remove( Actor& actor );
66
67   /**
68    * @copydoc Dali::Integration::SystemOverlay::SetOverlayRenderTasks()
69    */
70   void SetOverlayRenderTasks(RenderTaskList& taskList);
71
72   /**
73    * @copydoc Dali::Integration::SystemOverlay::GetOverlayRenderTasks()
74    */
75   RenderTaskList& GetOverlayRenderTasks();
76
77   /**
78    * Forwarded from Stage::SetSize().
79    * @param[in] width  The new width.
80    * @param[in] height The new height.
81    */
82   void SetSize( float width, float height );
83
84   /**
85    * Retrieve the ordered list of system layers.
86    * @return The layer-list.
87    */
88   LayerList& GetLayerList();
89
90   /**
91    * From RenderTaskDefaults.
92    * Retrieve the default SystemOverlay root actor.
93    * @note This is different to the root actor provided by Dali::Stage.
94    */
95   virtual Actor& GetDefaultRootActor();
96
97   /**
98    * From RenderTaskDefaults.
99    * Retrieve the default SystemOverlay camera actor.
100    * @note This is different to the default camera actor provided by Dali::Stage.
101    */
102   virtual CameraActor& GetDefaultCameraActor();
103
104 private:
105
106   /**
107    * Protected constructor; see also SystemOverlay::New().
108    * @param[in] eventThreadServices to send messaged to the scene graph.
109    */
110   SystemOverlay( EventThreadServices& eventThreadServices );
111
112   /**
113    * Second-phase construction.
114    */
115   void Initialize();
116
117   /**
118    * Lazy initialization of the SystemOverlay root actor.
119    */
120   void CreateRootLayer();
121
122   /**
123    * Lazy initialization of the default camera actor.
124    */
125   void CreateDefaultCameraActor();
126
127 private:
128
129   EventThreadServices& mEventThreadServices;
130
131   Vector2 mSize;
132
133   IntrusivePtr<RenderTaskList> mOverlayRenderTaskList;
134
135   LayerPtr mRootLayer;
136
137   CameraActorPtr mDefaultCameraActor;
138
139   // Ordered list of currently on-stage layers
140   OwnerPointer<LayerList> mLayerList;
141 };
142
143 } // namespace Internal
144
145 } // namespace Dali
146
147 #endif // __DALI_INTERNAL_SYSTEM_OVERLAY_H__