62 template<
class T,
class argType =
int,
class arg2Type =
int>
71 if( dynamic_cast<T*>( obj ) )
73 if( findThis == NULL )
75 else if( findThis == obj )
79 if( dynamic_cast<Group*>( obj ) )
83 for(
unsigned int i = 0; i < grp->
Count(); i++ )
85 if( Contained( ( *grp )[ i ], findThis ) )
97 for(
unsigned int i = 0; i < grp->
Count(); i++ )
99 T* specific =
dynamic_cast<T*
>( ( *grp )[ i ] );
102 if( findThis == NULL )
104 else if( findThis == specific )
114 static Group* AllMatchingNoChildren(
Group* grp )
116 Group* newGrp = NULL;
119 for(
unsigned int i = 0; i < grp->
Count(); i++ )
121 T* specific =
dynamic_cast<T*
>( ( *grp )[ i ] );
125 newGrp =
new Group();
141 return GetNthRecurse( obj, temp );
145 if( dynamic_cast<T*>( obj ) && n > 0 )
147 T* specific =
dynamic_cast<T*
>( obj );
151 else if( dynamic_cast<Group*>( obj ) )
155 for(
unsigned int i = 0; i < grp->
Count(); i++ )
157 T* specific = GetNthRecurse( ( *grp )[ i ], n );
167 static Traverse::ResultEnum GetValue(
DisplayObject* obj, argType T::*variablePtr, argType& foundValue )
169 Traverse::ResultEnum foundOne = Traverse::NOT_FOUND;
171 if( dynamic_cast<T*>( obj ) )
173 T* specific =
dynamic_cast<T*
>( obj );
174 foundValue = specific->*variablePtr;
175 foundOne = Traverse::FOUND_EQUAL;
178 if( dynamic_cast<Group*>( obj ) )
183 for(
unsigned int i = 0; i < grp->
Count(); i++ )
185 Traverse::ResultEnum result = GetValue( ( *grp )[ i ], variablePtr, tempVal );
186 if( result != Traverse::NOT_FOUND )
188 if( result == Traverse::FOUND_EQUAL )
190 if( tempVal == foundValue )
192 foundOne = Traverse::FOUND_EQUAL;
196 foundOne = Traverse::FOUND_NOT_EQUAL;
200 foundOne = Traverse::FOUND_NOT_EQUAL;
203 foundValue = tempVal;
212 typedef void ( T::*void_CallMethod_void )( void );
213 static bool Call(
DisplayObject* obj, void_CallMethod_void method )
215 bool foundOne =
false;
217 if( dynamic_cast<T*>( obj ) )
219 T* specific =
dynamic_cast<T*
>( obj );
220 ( specific->*method )();
224 if( dynamic_cast<Group*>( obj ) )
228 for(
unsigned int i = 0; i < grp->
Count(); i++ )
230 if( Call( ( *grp )[ i ], method ) )
239 typedef void ( T::*void_CallMethod_argType )( argType );
240 static bool Call(
DisplayObject* obj, void_CallMethod_argType method,
const argType arg1 )
242 bool foundOne =
false;
244 if( dynamic_cast<T*>( obj ) )
246 T* specific =
dynamic_cast<T*
>( obj );
247 ( specific->*method )( arg1 );
251 if( dynamic_cast<Group*>( obj ) )
255 for(
unsigned int i = 0; i < grp->
Count(); i++ )
257 if( Call( ( *grp )[ i ], method, arg1 ) )
266 typedef void ( T::*void_CallMethod_argType_arg2Type )( argType, arg2Type );
267 static bool Call(
DisplayObject* obj, void_CallMethod_argType_arg2Type method, argType arg1, arg2Type arg2 )
269 bool foundOne =
false;
271 if( dynamic_cast<T*>( obj ) )
273 T* specific =
dynamic_cast<T*
>( obj );
274 ( specific->*method )( arg1, arg2 );
278 if( dynamic_cast<Group*>( obj ) )
282 for(
unsigned int i = 0; i < grp->
Count(); i++ )
284 if( Call( ( *grp )[ i ], method, arg1, arg2 ) )
293 typedef void ( T::*void_CallMethod_argTypeRef )( argType& );
296 void_CallMethod_argTypeRef method,
299 bool foundOne =
false;
301 if( dynamic_cast<T*>( obj ) )
303 T* specific =
dynamic_cast<T*
>( obj );
304 ( specific->*method )( arg1 );
308 if( dynamic_cast<Group*>( obj ) )
312 for(
unsigned int i = 0; i < grp->
Count(); i++ )
314 if( Call( ( *grp )[ i ], method, arg1 ) )
325 typedef argType ( T::*argType_CallMethod_void )();
326 static argType ReturnCall(
DisplayObject* obj, argType_CallMethod_void method,
const argType notFoundValue = argType( 0 ),
const argType multipleValue = argType( -1 ),
bool* rvalFoundOne = NULL )
328 argType rval = notFoundValue;
329 bool weFoundOne =
false;
332 if( dynamic_cast<T*>( obj ) )
334 T* specific =
dynamic_cast<T*
>( obj );
336 rval = ( specific->*method )();
340 if( dynamic_cast<Group*>( obj ) )
345 for(
unsigned int i = 0; i < grp->
Count(); i++ )
347 bool foundOneThisIndex;
348 temp = ReturnCall( ( *grp )[ i ], method, notFoundValue, multipleValue, &foundOneThisIndex );
350 if( foundOneThisIndex )
358 rval = multipleValue;
374 *rvalFoundOne = weFoundOne;
384 typedef GlsColor ( T::*GlsColor_CallMethod_void )();
389 if( dynamic_cast<Group*>( obj ) )
395 for(
unsigned int i = 0; i < grp->
Count(); i++ )
397 temp = Call( ( *grp )[ i ], method, tempColor );
408 foundColor = tempColor;
414 if( foundColor != tempColor )
422 else if( dynamic_cast<T*>( obj ) )
424 T* specific =
dynamic_cast<T*
>( obj );
425 foundColor = ( specific->*method )();
unsigned int Count(void) const
Definition: group.h:163
virtual void InsertObject(DisplayObject *obj, bool reparent=true, bool recalculateBoundingbox=true, int loc=-1)
The disti::Group class. Implements groups of objects.
Definition: traverser.h:63
The Color class: Implements a 4 component RGBA color.
The disti::DisplayObject class and global enumerations.
Definition: gls_color.h:53
Definition: bmpimage.h:46