remove (unnecessarily) exported signal and action names
[platform/core/uifw/dali-core.git] / dali / public-api / actors / renderable-actor.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/actors/renderable-actor.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/actors/renderable-actor-impl.h>
23 #include <dali/internal/event/effects/shader-effect-impl.h>
24
25 namespace Dali
26 {
27
28 const BlendingMode::Type RenderableActor::DEFAULT_BLENDING_MODE = BlendingMode::AUTO;
29
30 RenderableActor::RenderableActor()
31 {
32 }
33
34 RenderableActor RenderableActor::DownCast( BaseHandle handle )
35 {
36   return RenderableActor( dynamic_cast<Dali::Internal::RenderableActor*>(handle.GetObjectPtr()) );
37 }
38
39 RenderableActor::~RenderableActor()
40 {
41 }
42
43 RenderableActor::RenderableActor(const RenderableActor& copy)
44 : Actor(copy)
45 {
46 }
47
48 RenderableActor& RenderableActor::operator=(const RenderableActor& rhs)
49 {
50   BaseHandle::operator=(rhs);
51   return *this;
52 }
53
54 void RenderableActor::SetSortModifier(float modifier)
55 {
56   GetImplementation(*this).SetSortModifier(modifier);
57 }
58
59 float RenderableActor::GetSortModifier() const
60 {
61   return GetImplementation(*this).GetSortModifier();
62 }
63
64 void RenderableActor::SetCullFace(const CullFaceMode mode)
65 {
66   GetImplementation(*this).SetCullFace(mode);
67 }
68
69 CullFaceMode RenderableActor::GetCullFace() const
70 {
71   return GetImplementation(*this).GetCullFace();
72 }
73
74 void RenderableActor::SetBlendMode( BlendingMode::Type mode )
75 {
76   GetImplementation(*this).SetBlendMode( mode );
77 }
78
79 BlendingMode::Type RenderableActor::GetBlendMode() const
80 {
81   return GetImplementation(*this).GetBlendMode();
82 }
83
84 void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
85 {
86   GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba );
87 }
88
89 void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
90                                     BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha )
91 {
92   GetImplementation(*this).SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
93 }
94
95 void RenderableActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
96                                     BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const
97 {
98   GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
99 }
100
101 void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgba )
102 {
103   GetImplementation(*this).SetBlendEquation( equationRgba );
104 }
105
106 void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha )
107 {
108   GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha );
109 }
110
111 void RenderableActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const
112 {
113   GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha );
114 }
115
116 void RenderableActor::SetBlendColor( const Vector4& color )
117 {
118   GetImplementation(*this).SetBlendColor( color );
119 }
120
121 const Vector4& RenderableActor::GetBlendColor() const
122 {
123   return GetImplementation(*this).GetBlendColor();
124 }
125
126 void RenderableActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
127 {
128   GetImplementation(*this).SetFilterMode( minFilter, magFilter );
129 }
130
131 void RenderableActor::GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const
132 {
133   GetImplementation(*this).GetFilterMode( minFilter, magFilter );
134 }
135
136 void RenderableActor::SetShaderEffect(ShaderEffect effect)
137 {
138   GetImplementation(*this).SetShaderEffect(GetImplementation(effect));
139 }
140
141 ShaderEffect RenderableActor::GetShaderEffect() const
142 {
143   Internal::ShaderEffectPtr internal = GetImplementation(*this).GetShaderEffect();
144
145   return ShaderEffect(internal.Get());
146 }
147
148 void RenderableActor::RemoveShaderEffect()
149 {
150   GetImplementation(*this).RemoveShaderEffect();
151 }
152
153 RenderableActor::RenderableActor(Internal::RenderableActor* internal)
154 : Actor(internal)
155 {
156 }
157
158 void SetShaderEffectRecursively( Actor actor, ShaderEffect effect )
159 {
160   // only do something if the actor and effect are valid
161   if( actor && effect )
162   {
163     // first remove from this actor
164     RenderableActor renderable = RenderableActor::DownCast( actor );
165     if( renderable )
166     {
167       renderable.SetShaderEffect( effect );
168     }
169     // then all children recursively
170     const unsigned int count = actor.GetChildCount();
171     for( unsigned int index = 0; index < count; ++index )
172     {
173       Actor child( actor.GetChildAt( index ) );
174       SetShaderEffectRecursively( child, effect );
175     }
176   }
177 }
178
179 void RemoveShaderEffectRecursively( Actor actor )
180 {
181   // only do something if the actor is valid
182   if( actor )
183   {
184     // first remove from this actor
185     RenderableActor renderable = RenderableActor::DownCast( actor );
186     if( renderable )
187     {
188       renderable.RemoveShaderEffect();
189     }
190     // then all children recursively
191     const unsigned int count = actor.GetChildCount();
192     for( unsigned int index = 0; index < count; ++index )
193     {
194       Actor child( actor.GetChildAt( index ) );
195       RemoveShaderEffectRecursively( child );
196     }
197   }
198 }
199
200 } // namespace Dali