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