License conversion from Flora to Apache 2.0
[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 Stage;
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] stage A reference to the stage.
48    * @return The newly allocated SystemOverlay.
49    */
50   static SystemOverlay* New( Stage& stage );
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::GetOverlayRenderTasks()
69    */
70   RenderTaskList& GetOverlayRenderTasks();
71
72   /**
73    * Forwarded from Stage::SetSize().
74    * @param[in] width  The new width.
75    * @param[in] height The new height.
76    */
77   void SetSize( float width, float height );
78
79   /**
80    * Retrieve the ordered list of system layers.
81    * @return The layer-list.
82    */
83   LayerList& GetLayerList();
84
85   /**
86    * From RenderTaskDefaults.
87    * Retrieve the default SystemOverlay root actor.
88    * @note This is different to the root actor provided by Dali::Stage.
89    */
90   virtual Actor& GetDefaultRootActor();
91
92   /**
93    * From RenderTaskDefaults.
94    * Retrieve the default SystemOverlay camera actor.
95    * @note This is different to the default camera actor provided by Dali::Stage.
96    */
97   virtual CameraActor& GetDefaultCameraActor();
98
99 private:
100
101   /**
102    * Protected constructor; see also SystemOverlay::New().
103    * @param[in] stage A reference to the stage.
104    */
105   SystemOverlay( Stage& stage );
106
107   /**
108    * Second-phase construction.
109    */
110   void Initialize();
111
112   /**
113    * Lazy initialization of the SystemOverlay root actor.
114    */
115   void CreateRootLayer();
116
117   /**
118    * Lazy initialization of the default camera actor.
119    */
120   void CreateDefaultCameraActor();
121
122 private:
123
124   Stage& mStage;
125
126   Vector2 mSize;
127
128   IntrusivePtr<RenderTaskList> mOverlayRenderTaskList;
129
130   LayerPtr mRootLayer;
131
132   CameraActorPtr mDefaultCameraActor;
133
134   // Ordered list of currently on-stage layers
135   OwnerPointer<LayerList> mLayerList;
136 };
137
138 } // namespace Internal
139
140 } // namespace Dali
141
142 #endif // __DALI_INTERNAL_SYSTEM_OVERLAY_H__