Revert "UTC tests; PropertyValue, Vector2/3/4, Matrix"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / multi-point-event-util.cpp
1 /*
2  * Copyright (c) 2014 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
29 namespace Internal
30 {
31
32 #if defined(DEBUG_ENABLED)
33
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);
39
40 static const Debug::LogLevel HIERARCHY_DEBUG_LOG_LEVEL( Debug::Verbose );
41
42 void PrintChildren( Debug::Filter* logFilter, Dali::Actor actor, int level )
43 {
44   std::ostringstream output;
45
46   for ( int t = 0; t < level; ++t )
47   {
48     output << " | ";
49   }
50
51   output << actor.GetName() << "(" << actor.GetTypeName() << ", " << actor.GetObjectPtr() << ")";
52
53   if ( HIERARCHY_GEOMETRY )
54   {
55     output << " Pos: " << actor.GetCurrentWorldPosition() << " Size: " << actor.GetCurrentSize() << " Scale: " << actor.GetCurrentWorldScale();
56   }
57
58   if ( HIERARCHY_SENSITIVITY )
59   {
60     output << " Sensitivity: " << ( IsActuallySensitive( &GetImplementation( actor ) ) ? "True " : "False " );
61   }
62
63   if ( HIERARCHY_TOUCH_REQUIRED )
64   {
65     output << " TouchRequired: " << ( GetImplementation(actor).GetTouchRequired() ? "True " : "False " );
66   }
67
68   if ( HIERARCHY_HOVER_REQUIRED )
69   {
70     output << " HoverRequired: " << ( GetImplementation(actor).GetHoverRequired() ? "True " : "False " );
71   }
72
73   if ( HIERARCHY_HITTABLE )
74   {
75     output << " Hittable: " << ( GetImplementation(actor).IsHittable() ? "True " : "False " );
76   }
77
78   output << std::endl;
79
80   if( logFilter )
81   {
82     DALI_LOG_INFO( logFilter, HIERARCHY_DEBUG_LOG_LEVEL, output.str().c_str() );
83   }
84
85   ++level;
86   unsigned int numChildren=actor.GetChildCount();
87   for ( unsigned int i=0; i<numChildren; ++i )
88   {
89     PrintChildren( logFilter, actor.GetChildAt(i), level );
90   }
91   --level;
92 }
93
94 void PrintHierarchy( Debug::Filter* logFilter )
95 {
96   if ( logFilter && logFilter->IsEnabledFor( HIERARCHY_DEBUG_LOG_LEVEL ) )
97   {
98     PrintChildren( logFilter, Dali::Stage().GetCurrent().GetRootLayer(), 0 );
99   }
100 }
101
102 #endif // defined(DEBUG_ENABLED)
103
104 bool IsActuallySensitive( Actor* actor )
105 {
106   bool sensitive = true;
107
108   while ( actor && sensitive )
109   {
110     sensitive = actor->IsSensitive();
111     actor = actor->GetParent();
112   }
113
114   return sensitive;
115 }
116
117 } // namespace Internal
118
119 } // namespace Dali
120