[Tizen] Property Notify for orientation changes
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-step-functions.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
3
4 /*
5  * Copyright (c) 2021 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/internal/update/common/scene-graph-property-notification.h>
23 #include <dali/public-api/object/property-value.h>
24
25 namespace Dali
26 {
27 namespace Internal
28 {
29 class Object;
30 class PropertyNotification;
31
32 namespace SceneGraph
33 {
34 /**
35  * Step condition class,
36  * Checks if a Property has stepped a certain amount from the reference point
37  *
38  * float      => value has stepped arg1 amount from arg0.
39  * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
40  * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
41  * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
42  * Quaternion => sum of rotation angle and axis changes has stepped arg1 amount from arg0
43  * Default    => return false.
44  */
45 class Step
46 {
47 public:
48   /**
49    * @return function pointer to the correct condition function, based on
50    * the type of value being examined.
51    */
52   static ConditionFunction GetFunction(Property::Type valueType);
53
54   /**
55    * @return function pointer to the correct condition function, based on
56    * the type of value being examined.
57    *
58    * This function pointer is to compare previous and current components for the swapping case.
59    */
60   static ConditionFunction GetCompareFunction(Property::Type valueType);
61
62 private:
63   static bool Evaluate(const float propertyValue, PropertyNotification::RawArgumentContainer& arg);
64
65   /**
66    * Checks if integer is Outside
67    * @param[in] value The value being examined.
68    * @param[in] arg The supplied arguments for the condition.
69    * @return Condition result (true if condition met, false if not)
70    */
71   static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
72
73   /**
74    * Checks if float is Outside
75    * @param[in] value The value being examined.
76    * @param[in] arg The supplied arguments for the condition.
77    * @return Condition result (true if condition met, false if not)
78    */
79   static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
80
81   /**
82    * Checks if Vector2.Length() is Outside
83    * @param[in] value The value being examined.
84    * @param[in] arg The supplied arguments for the condition.
85    * @return Condition result (true if condition met, false if not)
86    */
87   static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
88
89   /**
90    * Checks if Vector3.Length() is Outside
91    * @param[in] value The value being examined.
92    * @param[in] arg The supplied arguments for the condition.
93    * @return Condition result (true if condition met, false if not)
94    */
95   static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
96
97   /**
98    * Checks if Vector3.Length() is Outside
99    *
100    * If previous Vector3.Lenght() and current are same, the raw datas are checked with comparing these values.
101    *
102    * @param[in] value The value being examined.
103    * @param[in] arg The supplied arguments for the condition.
104    * @return Condition result (true if condition met, false if not)
105    */
106   static bool EvalAndCompareVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
107
108   /**
109    * Checks if Vector4.Length() is Outside
110    * @param[in] value The value being examined.
111    * @param[in] arg The supplied arguments for the condition.
112    * @return Condition result (true if condition met, false if not)
113    */
114   static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
115
116   /**
117    * Checks if Quaternion is Outside
118    * @param[in] value The value being examined.
119    * @param[in] arg The supplied arguments for the condition.
120    * @return Condition result (true if condition met, false if not)
121    */
122   static bool EvalQuaternion(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
123
124   /**
125    * Default check for other types.
126    * @param[in] value The value being examined.
127    * @param[in] arg The supplied arguments for the condition.
128    * @return Condition result (true if condition met, false if not)
129    */
130   static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
131 };
132
133 } // namespace SceneGraph
134
135 } // namespace Internal
136
137 } // namespace Dali
138
139 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H