Merge branch devel/master (1.0.49) into tizen
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-boolean.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__
3
4 /*
5  * Copyright (c) 2015 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/common/dali-common.h>
23 #include <dali/public-api/object/property.h>
24 #include <dali/public-api/object/property-input.h>
25 #include <dali/public-api/object/property-types.h>
26 #include <dali/internal/common/buffer-index.h>
27 #include <dali/internal/event/common/property-input-impl.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace SceneGraph
36 {
37
38 /**
39  * A Boolean non-animatable property.
40  */
41 class PropertyBoolean : public PropertyInputImpl
42 {
43 public:
44
45   /**
46    * Create an non-animatable property.
47    * @param [in] initialValue The initial value of the property.
48    */
49   PropertyBoolean( bool initialValue )
50   : mValue( initialValue ),
51     mDirtyFlag( true )
52   {
53   }
54
55   /**
56    * Virtual destructor.
57    */
58   virtual ~PropertyBoolean()
59   {
60   }
61
62   /**
63    * Clear the dirty flag
64    */
65   void Clear()
66   {
67     mDirtyFlag = false;
68   }
69
70   /**
71    * @copydoc Dali::Internal::PropertyInputImpl::GetType()
72    */
73   virtual Dali::Property::Type GetType() const
74   {
75     return Dali::PropertyTypes::Get<bool>();
76   }
77
78   /**
79    * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
80    */
81   virtual bool InputInitialized() const
82   {
83     return true;
84   }
85
86   /**
87    * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
88    */
89   virtual bool InputChanged() const
90   {
91     return mDirtyFlag;
92   }
93
94   /**
95    * @copydoc Dali::PropertyInput::GetBoolean()
96    */
97   virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
98   {
99     return mValue;
100   }
101
102   /**
103    * Flag that the property has been Set during the current frame.
104    */
105   void OnSet()
106   {
107     mDirtyFlag = true;
108   }
109
110 private:
111
112   // Undefined
113   PropertyBoolean(const PropertyBoolean& property);
114
115   // Undefined
116   PropertyBoolean& operator=(const PropertyBoolean& rhs);
117
118 public:
119   bool mValue; ///< The property value
120
121 private:
122   bool mDirtyFlag;
123 };
124
125 } // namespace SceneGraph
126
127 } // namespace Internal
128
129 } // namespace Dali
130
131 #endif // __DALI_INTERNAL_SCENE_GRAPH_BOOLEAN_PROPERTY_H__