Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / light-actor-impl.h
1 #ifndef __DALI_INTERNAL_LIGHT_ACTOR_H__
2 #define __DALI_INTERNAL_LIGHT_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/light-actor.h>
22 #include <dali/internal/event/actors/actor-impl.h>
23 #include <dali/internal/event/actor-attachments/light-attachment-impl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 /**
32  * An actor with a conveniently pre-attached LightAttachment.
33  * This is the simplest way to add lighting.
34  */
35 class LightActor : public Actor
36 {
37 public:
38
39   /**
40    * Create an initialised light actor.
41    * @return A smart-pointer to a newly allocated light actor.
42    */
43   static LightActorPtr New();
44
45   /**
46    * @copydoc Dali::Internal::Actor::OnInitialize
47    */
48   void OnInitialize();
49
50   /**
51    * @copydoc Dali::LightActor::SetLight
52    */
53   void SetLight(Dali::Light light);
54
55   /**
56    * @copydoc Dali::LightActor::GetLight
57    */
58   Dali::Light GetLight() const;
59
60   /**
61    * @copydoc Dali::LightActor::SetActive
62    */
63   void SetActive(bool active);
64
65   /**
66    * @copydoc Dali::LightActor::GetActive
67    */
68   bool GetActive();
69
70 public: // Default property extensions from ProxyObject
71   /**
72    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
73    */
74   virtual unsigned int GetDefaultPropertyCount() const;
75
76   /**
77    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
78    */
79   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
80
81   /**
82    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
83    */
84   virtual const std::string& GetDefaultPropertyName(Property::Index index) const;
85
86   /**
87    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
88    */
89   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
90
91   /**
92    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
93    */
94   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
95
96   /**
97    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
98    */
99   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
100
101   /**
102    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
103    */
104   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
105
106   /**
107    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
108    */
109   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
110
111   /**
112    * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
113    */
114   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
115
116   /**
117    * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
118    */
119   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
120
121 protected:
122
123   /**
124    * Protected constructor; see also LightActor::New()
125    */
126   LightActor();
127
128   /**
129    * A reference counted object may only be deleted by calling Unreference()
130    */
131   virtual ~LightActor();
132
133 private:
134
135   LightAttachmentPtr mLightAttachment;
136   bool mIsActive;
137   static bool mFirstInstance ;
138   static DefaultPropertyLookup* mDefaultLightActorPropertyLookup; ///< Default properties
139 };
140
141 } // namespace Internal
142
143 // Helpers for public-api forwarding methods
144
145 inline Internal::LightActor& GetImplementation(Dali::LightActor& light)
146 {
147   DALI_ASSERT_ALWAYS( light && "LightActor handle is empty" );
148
149   BaseObject& handle = light.GetBaseObject();
150
151   return static_cast<Internal::LightActor&>(handle);
152 }
153
154 inline const Internal::LightActor& GetImplementation(const Dali::LightActor& light)
155 {
156   DALI_ASSERT_ALWAYS( light && "LightActor handle is empty" );
157
158   const BaseObject& handle = light.GetBaseObject();
159
160   return static_cast<const Internal::LightActor&>(handle);
161 }
162
163 } // namespace Dali
164
165 #endif // __DALI_INTERNAL_LIGHT_ACTOR_H__