2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #if defined(DEBUG_ENABLED)
23 #include <dali/internal/event/common/stage-impl.h>
24 #include <dali/internal/event/events/multi-point-event-util.h>
30 #if defined(DEBUG_ENABLED)
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);
38 static const Debug::LogLevel HIERARCHY_DEBUG_LOG_LEVEL(Debug::Verbose);
40 void PrintChildren(Debug::Filter* logFilter, Dali::Actor actor, int level)
42 std::ostringstream output;
44 for(int t = 0; t < level; ++t)
49 output << actor.GetProperty<std::string>(Dali::Actor::Property::NAME) << "(" << actor.GetTypeName() << ", " << actor.GetObjectPtr() << ")";
51 if(HIERARCHY_GEOMETRY)
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);
56 if(HIERARCHY_SENSITIVITY)
58 output << " Sensitivity: " << (IsActuallySensitive(&GetImplementation(actor)) ? "True " : "False ");
61 if(HIERARCHY_TOUCH_REQUIRED)
63 output << " TouchRequired: " << (GetImplementation(actor).GetTouchRequired() ? "True " : "False ");
66 if(HIERARCHY_HOVER_REQUIRED)
68 output << " HoverRequired: " << (GetImplementation(actor).GetHoverRequired() ? "True " : "False ");
71 if(HIERARCHY_HITTABLE)
73 output << " Hittable: " << (GetImplementation(actor).IsHittable() ? "True " : "False ");
80 DALI_LOG_INFO(logFilter, HIERARCHY_DEBUG_LOG_LEVEL, output.str().c_str());
84 unsigned int numChildren = actor.GetChildCount();
85 for(unsigned int i = 0; i < numChildren; ++i)
87 PrintChildren(logFilter, actor.GetChildAt(i), level);
92 void PrintHierarchy(Debug::Filter* logFilter)
94 if(logFilter && logFilter->IsEnabledFor(HIERARCHY_DEBUG_LOG_LEVEL))
96 PrintChildren(logFilter, Dali::Stage().GetCurrent().GetRootLayer(), 0);
100 #endif // defined(DEBUG_ENABLED)
102 bool IsActuallySensitive(Actor* actor)
104 bool sensitive = true;
106 while(actor && sensitive)
108 sensitive = actor->IsSensitive();
109 actor = actor->GetParent();
115 } // namespace Internal