Revert "[Tizen] Not execute the remove callback"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / multi-point-event-util.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #if defined(DEBUG_ENABLED)
19 #include <sstream>
20 #endif
21
22 // CLASS HEADER
23 #include <dali/internal/event/common/stage-impl.h>
24 #include <dali/internal/event/events/multi-point-event-util.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 #if defined(DEBUG_ENABLED)
31
32 static bool HIERARCHY_GEOMETRY(true);
33 static bool HIERARCHY_SENSITIVITY(true);
34 static bool HIERARCHY_TOUCH_REQUIRED(true);
35 static bool HIERARCHY_HOVER_REQUIRED(true);
36 static bool HIERARCHY_HITTABLE(true);
37
38 static const Debug::LogLevel HIERARCHY_DEBUG_LOG_LEVEL(Debug::Verbose);
39
40 void PrintChildren(Debug::Filter* logFilter, Dali::Actor actor, int level)
41 {
42   std::ostringstream output;
43
44   for(int t = 0; t < level; ++t)
45   {
46     output << " | ";
47   }
48
49   output << actor.GetProperty<std::string>(Dali::Actor::Property::NAME) << "(" << actor.GetTypeName() << ", " << actor.GetObjectPtr() << ")";
50
51   if(HIERARCHY_GEOMETRY)
52   {
53     output << " Pos: " << actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::WORLD_POSITION) << " Size: " << actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::SIZE) << " Scale: " << actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::WORLD_SCALE);
54   }
55
56   if(HIERARCHY_SENSITIVITY)
57   {
58     output << " Sensitivity: " << (IsActuallySensitive(&GetImplementation(actor)) ? "True " : "False ");
59   }
60
61   if(HIERARCHY_TOUCH_REQUIRED)
62   {
63     output << " TouchRequired: " << (GetImplementation(actor).GetTouchRequired() ? "True " : "False ");
64   }
65
66   if(HIERARCHY_HOVER_REQUIRED)
67   {
68     output << " HoverRequired: " << (GetImplementation(actor).GetHoverRequired() ? "True " : "False ");
69   }
70
71   if(HIERARCHY_HITTABLE)
72   {
73     output << " Hittable: " << (GetImplementation(actor).IsHittable() ? "True " : "False ");
74   }
75
76   output << std::endl;
77
78   if(logFilter)
79   {
80     DALI_LOG_INFO(logFilter, HIERARCHY_DEBUG_LOG_LEVEL, output.str().c_str());
81   }
82
83   ++level;
84   unsigned int numChildren = actor.GetChildCount();
85   for(unsigned int i = 0; i < numChildren; ++i)
86   {
87     PrintChildren(logFilter, actor.GetChildAt(i), level);
88   }
89   --level;
90 }
91
92 void PrintHierarchy(Debug::Filter* logFilter)
93 {
94   if(logFilter && logFilter->IsEnabledFor(HIERARCHY_DEBUG_LOG_LEVEL))
95   {
96     PrintChildren(logFilter, Dali::Stage().GetCurrent().GetRootLayer(), 0);
97   }
98 }
99
100 #endif // defined(DEBUG_ENABLED)
101
102 bool IsActuallySensitive(Actor* actor)
103 {
104   bool sensitive = true;
105
106   while(actor && sensitive)
107   {
108     sensitive = actor->IsSensitive();
109     actor     = actor->GetParent();
110   }
111
112   return sensitive;
113 }
114
115 } // namespace Internal
116
117 } // namespace Dali