(Properties) Added ability to add non-animatable event-thread only properties via...
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-notifier.h
1 #ifndef __DALI_INTERNAL_PROPERTY_NOTIFIER_H__
2 #define __DALI_INTERNAL_PROPERTY_NOTIFIER_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/internal/common/message.h>
22
23 namespace Dali
24 {
25
26 namespace Internal
27 {
28
29 namespace SceneGraph
30 {
31
32 class PropertyNotification;
33
34 } //namespace SceneGraph
35
36 /**
37  * Interface used by the update-thread to trigger property changed notification signals.
38  */
39 class PropertyNotifier
40 {
41 public:
42
43   /**
44    * Virtual destructor.
45    */
46   virtual ~PropertyNotifier()
47   {
48   }
49
50   /**
51    * Provide notification signals for a changed property.
52    * This method should be called in the event-thread; the update-thread must use PropertyChangedMessage.
53    * @param[in] propertyNotification A pointer to the SceneGraph::PropertyNotification that has been mnodified.
54    * @param[in] validity Passes in whether the notification was triggered by a true or false condition result
55    */
56   virtual void NotifyProperty( SceneGraph::PropertyNotification* propertyNotification, bool validity ) = 0;
57 };
58
59 /**
60  * Notification message for when a property has been modified
61  * @param[in] notifier This will provide the notification signal.
62  */
63 inline MessageBase* PropertyChangedMessage( PropertyNotifier& notifier, SceneGraph::PropertyNotification* propertyNotification, bool validity )
64 {
65   return new MessageValue2< PropertyNotifier, SceneGraph::PropertyNotification*, bool >( &notifier,
66                                                                                    &PropertyNotifier::NotifyProperty,
67                                                                                    propertyNotification, validity);
68 }
69
70 } // namespace Internal
71
72 } // namespace Dali
73
74 #endif // __DALI_INTERNAL_PROPERTY_NOTIFIER_H__