Align data members, pointers first, classes then, next built in types and flags last...
[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 Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/public-api/actors/renderable-actor.h>
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/internal/event/actors/actor-impl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class RenderableAttachment;
32
33 /**
34  * An abstract base class for renderable actors
35  */
36 class RenderableActor : public Actor
37 {
38 public:
39
40   /**
41    * @copydoc Dali::RenderableActor::SetSortModifier()
42    */
43   void SetSortModifier(float modifier);
44
45   /**
46    * @copydoc Dali::RenderableActor::GetSortModifier()
47    */
48   float GetSortModifier() const;
49
50   /**
51    * @copydoc Dali::RenderableActor::SetCullFace()
52    */
53   void SetCullFace(CullFaceMode mode);
54
55   /**
56    * @copydoc Dali::RenderableActor::GetCullFace()
57    */
58   CullFaceMode GetCullFace() const;
59
60   /**
61    * @copydoc Dali::RenderableActor::SetBlendMode()
62    */
63   void SetBlendMode( BlendingMode::Type mode );
64
65   /**
66    * @copydoc Dali::RenderableActor::GetBlendMode()
67    */
68   BlendingMode::Type GetBlendMode() const;
69
70   /**
71    * @copydoc Dali::RenderableActor::SetBlendFunc()
72    */
73   void SetBlendFunc( BlendingFactor::Type srcFactorRgba,   BlendingFactor::Type destFactorRgba );
74
75   /**
76    * @copydoc Dali::RenderableActor::SetBlendFunc()
77    */
78   void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
79                      BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
80
81   /**
82    * @copydoc Dali::RenderableActor::GetBlendFunc()
83    */
84   void GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
85                      BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
86
87   /**
88    * @copydoc Dali::RenderableActor::SetBlendEquation()
89    */
90   void SetBlendEquation( BlendingEquation::Type equationRgba );
91
92   /**
93    * @copydoc Dali::RenderableActor::SetBlendEquation()
94    */
95   void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
96
97   /**
98    * @copydoc Dali::RenderableActor::GetBlendEquation()
99    */
100   void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
101
102   /**
103    * @copydoc Dali::RenderableActor::SetBlendColor()
104    */
105   void SetBlendColor( const Vector4& color );
106
107   /**
108    * @copydoc Dali::RenderableActor::GetBlendColor()
109    */
110   const Vector4& GetBlendColor() const;
111
112 protected:
113
114   /**
115    * Protected constructor; only derived classes are instantiatable.
116    */
117   RenderableActor();
118
119   /**
120    * A reference counted object may only be deleted by calling Unreference()
121    */
122   virtual ~RenderableActor();
123
124 private:
125
126   /**
127    * @return a reference to the renderable attachment
128    */
129   virtual RenderableAttachment& GetRenderableAttachment() const = 0;
130
131   // Undefined
132   RenderableActor(const RenderableActor&);
133   // Undefined
134   RenderableActor& operator=(const RenderableActor& rhs);
135 };
136
137 } // namespace Internal
138
139 // Helpers for public-api forwarding methods
140
141 inline Internal::RenderableActor& GetImplementation(Dali::RenderableActor& renderable)
142 {
143   DALI_ASSERT_ALWAYS( renderable && "RenderableActor handle is empty" );
144
145   BaseObject& handle = renderable.GetBaseObject();
146
147   return static_cast<Internal::RenderableActor&>(handle);
148 }
149
150 inline const Internal::RenderableActor& GetImplementation(const Dali::RenderableActor& renderable)
151 {
152   DALI_ASSERT_ALWAYS(renderable && "RenderableActor handle is empty" );
153
154   const BaseObject& handle = renderable.GetBaseObject();
155
156   return static_cast<const Internal::RenderableActor&>(handle);
157 }
158
159 } // namespace Dali
160
161 #endif // __DALI_INTERNAL_RENDERABLE_ACTOR_H__