2 * Copyright (c) 2014 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>
32 #if defined(DEBUG_ENABLED)
34 static bool HIERARCHY_GEOMETRY(false);
35 static bool HIERARCHY_SENSITIVITY(false);
36 static bool HIERARCHY_TOUCH_REQUIRED(false);
37 static bool HIERARCHY_HOVER_REQUIRED(false);
38 static bool HIERARCHY_HITTABLE(false);
40 static const Debug::LogLevel HIERARCHY_DEBUG_LOG_LEVEL( Debug::Verbose );
42 void PrintChildren( Debug::Filter* logFilter, Dali::Actor actor, int level )
44 std::ostringstream output;
46 for ( int t = 0; t < level; ++t )
51 output << actor.GetName() << "(" << actor.GetTypeName() << ", " << actor.GetObjectPtr() << ")";
53 if ( HIERARCHY_GEOMETRY )
55 output << " Pos: " << actor.GetCurrentWorldPosition() << " Size: " << actor.GetCurrentSize() << " Scale: " << actor.GetCurrentWorldScale();
58 if ( HIERARCHY_SENSITIVITY )
60 output << " Sensitivity: " << ( IsActuallySensitive( &GetImplementation( actor ) ) ? "True " : "False " );
63 if ( HIERARCHY_TOUCH_REQUIRED )
65 output << " TouchRequired: " << ( GetImplementation(actor).GetTouchRequired() ? "True " : "False " );
68 if ( HIERARCHY_HOVER_REQUIRED )
70 output << " HoverRequired: " << ( GetImplementation(actor).GetHoverRequired() ? "True " : "False " );
73 if ( HIERARCHY_HITTABLE )
75 output << " Hittable: " << ( GetImplementation(actor).IsHittable() ? "True " : "False " );
82 DALI_LOG_INFO( logFilter, HIERARCHY_DEBUG_LOG_LEVEL, output.str().c_str() );
86 unsigned int numChildren=actor.GetChildCount();
87 for ( unsigned int i=0; i<numChildren; ++i )
89 PrintChildren( logFilter, actor.GetChildAt(i), level );
94 void PrintHierarchy( Debug::Filter* logFilter )
96 if ( logFilter && logFilter->IsEnabledFor( HIERARCHY_DEBUG_LOG_LEVEL ) )
98 PrintChildren( logFilter, Dali::Stage().GetCurrent().GetRootLayer(), 0 );
102 #endif // defined(DEBUG_ENABLED)
104 bool IsActuallySensitive( Actor* actor )
106 bool sensitive = true;
108 while ( actor && sensitive )
110 sensitive = actor->IsSensitive();
111 actor = actor->GetParent();
117 } // namespace Internal