Bug fix which makes applications crash when adding a renderer to an on stage actor
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / renderable-actor-impl.h
1 #ifndef __DALI_INTERNAL_RENDERABLE_ACTOR_H__
2 #define __DALI_INTERNAL_RENDERABLE_ACTOR_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/actors/renderable-actor.h>
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/internal/event/actors/actor-impl.h>
25 #include <dali/internal/event/effects/shader-declarations.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 class RenderableAttachment;
34
35 /**
36  * An abstract base class for renderable actors
37  */
38 class RenderableActor : public Actor
39 {
40 protected:
41   /**
42    * Protected constructor; only derived classes are instantiatable.
43    */
44   RenderableActor();
45
46   /**
47    * A reference counted object may only be deleted by calling Unreference()
48    */
49   virtual ~RenderableActor();
50
51 private:
52
53   /**
54    * @return a reference to the renderable attachment
55    */
56   virtual RenderableAttachment& GetRenderableAttachment() const = 0;
57
58   // Undefined
59   RenderableActor(const RenderableActor&);
60   // Undefined
61   RenderableActor& operator=(const RenderableActor& rhs);
62
63 };
64
65 } // namespace Internal
66
67 // Helpers for public-api forwarding methods
68
69 inline Internal::RenderableActor& GetImplementation(Dali::RenderableActor& renderable)
70 {
71   DALI_ASSERT_ALWAYS( renderable && "RenderableActor handle is empty" );
72
73   BaseObject& handle = renderable.GetBaseObject();
74
75   return static_cast<Internal::RenderableActor&>(handle);
76 }
77
78 inline const Internal::RenderableActor& GetImplementation(const Dali::RenderableActor& renderable)
79 {
80   DALI_ASSERT_ALWAYS(renderable && "RenderableActor handle is empty" );
81
82   const BaseObject& handle = renderable.GetBaseObject();
83
84   return static_cast<const Internal::RenderableActor&>(handle);
85 }
86
87 } // namespace Dali
88
89 #endif // __DALI_INTERNAL_RENDERABLE_ACTOR_H__