1 #ifndef __DALI_PROPERTY_NOTIFICATION_H__
2 #define __DALI_PROPERTY_NOTIFICATION_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/object/property-notification-declarations.h>
24 #include <dali/public-api/object/property-conditions.h>
25 #include <dali/public-api/object/property.h>
30 * @addtogroup dali_core_object
34 namespace Internal DALI_INTERNAL
36 class PropertyNotification;
40 * @brief This is used to issue a notification upon a condition of the property being met.
42 * For example checking if Actor::POSITION_X > 100.0.
43 * @see Dali::PropertyCondition
45 class DALI_IMPORT_API PropertyNotification : public BaseHandle
49 * @brief Enumeration to describe how to check condition
53 Disabled, ///< Don't notify, regardless of result of Condition
54 NotifyOnTrue, ///< Notify whenever condition changes from false to true.
55 NotifyOnFalse, ///< Notify whenever condition changes from true to false.
56 NotifyOnChanged ///< Notify whenever condition changes (false to true, and true to false)
62 * @brief Create an uninitialized PropertyNotification; this can be initialized with PropertyNotification::New().
64 * Calling member functions with an uninitialized Dali::Object is not allowed.
66 PropertyNotification();
69 * @brief Downcast an Object handle to PropertyNotification.
71 * If handle points to an PropertyNotification object the downcast
72 * produces valid handle. If not the returned handle is left
75 * @param[in] handle to An object
76 * @return handle to a PropertyNotification object or an uninitialized handle
78 static PropertyNotification DownCast( BaseHandle handle );
83 * This is non-virtual since derived Handle types must not contain data or virtual methods.
85 ~PropertyNotification();
88 * @brief This copy constructor is required for (smart) pointer semantics.
90 * @param [in] handle A reference to the copied handle
92 PropertyNotification(const PropertyNotification& handle);
95 * @brief This assignment operator is required for (smart) pointer semantics.
97 * @param [in] rhs A reference to the copied handle
98 * @return A reference to this
100 PropertyNotification& operator=(const PropertyNotification& rhs);
103 * @brief Get the condition of this notification
105 * @return The condition is returned
107 PropertyCondition GetCondition();
110 * @brief Get the condition of this notification
112 * @return The condition is returned
114 const PropertyCondition& GetCondition() const;
117 * @brief Get the target handle that this notification is observing.
119 Dali::Handle GetTarget() const;
122 * @brief Get the target handle's property index that this notification
125 * @return The target property.
127 Property::Index GetTargetProperty() const;
130 * @brief Sets the Notification mode. This determines how the property
131 * notification should respond to the result of a condition.
133 * @param[in] mode Notification mode (Default is PropertyNotification::NotifyOnTrue)
135 void SetNotifyMode( NotifyMode mode );
138 * @brief Retrieves the current Notification mode.
140 * @return Notification mode.
142 NotifyMode GetNotifyMode();
145 * @brief Gets the result of the last condition check that caused a signal emit,
146 * useful when using NotifyOnChanged mode and need to know what it changed to.
148 * @return whether condition result that triggered last emit was true or false
150 bool GetNotifyResult() const;
153 * @brief Connect to this signal to be notified when the notification has occurred.
155 * @return A signal object to Connect() with.
157 PropertyNotifySignalType& NotifySignal();
159 public: // Not intended for use by Application developers
162 * @brief This constructor is used by Dali New() methods.
164 * @param [in] propertyNotification A pointer to a newly allocated Dali resource
166 explicit DALI_INTERNAL PropertyNotification(Internal::PropertyNotification* propertyNotification);
174 #endif // __DALI_PROPERTY_NOTIFICATION_H__