63 template<
class T,
class argType =
int,
class arg2Type =
int>
72 if (dynamic_cast<T*>(obj))
76 else if (findThis == obj)
80 if (dynamic_cast<Group*>(obj))
84 for (
unsigned int i = 0; i < grp->
Count(); i++)
86 if (Contained((*grp)[i],findThis))
98 for (
unsigned int i = 0; i < grp->
Count(); i++)
100 T* specific =
dynamic_cast<T*
>((*grp)[i]);
103 if (findThis == NULL)
105 else if (findThis == specific)
115 static Group *AllMatchingNoChildren(
Group* grp)
117 Group *newGrp = NULL;
120 for (
unsigned int i = 0; i < grp->
Count(); i++)
122 T* specific =
dynamic_cast<T*
>((*grp)[i]);
126 newGrp =
new Group();
142 return GetNthRecurse(obj,temp);
146 if (dynamic_cast<T*>(obj) && n >0 )
148 T* specific =
dynamic_cast<T*
>(obj);
152 else if (dynamic_cast<Group*>(obj))
156 for (
unsigned int i = 0; i < grp->
Count(); i++)
158 T* specific = GetNthRecurse((*grp)[i],n);
168 static Traverse::ResultEnum GetValue(
DisplayObject* obj, argType T::* variablePtr, argType& foundValue)
170 Traverse::ResultEnum foundOne = Traverse::NOT_FOUND;
172 if (dynamic_cast<T*>(obj))
174 T* specific =
dynamic_cast<T*
>(obj);
175 foundValue = specific->*variablePtr;
176 foundOne = Traverse::FOUND_EQUAL;
179 if (dynamic_cast<Group*>(obj))
184 for (
unsigned int i = 0; i < grp->
Count(); i++)
186 Traverse::ResultEnum result = GetValue((*grp)[i], variablePtr, tempVal);
187 if (result != Traverse::NOT_FOUND)
189 if (result == Traverse::FOUND_EQUAL)
191 if (tempVal == foundValue)
193 foundOne = Traverse::FOUND_EQUAL;
197 foundOne = Traverse::FOUND_NOT_EQUAL;
201 foundOne = Traverse::FOUND_NOT_EQUAL;
204 foundValue = tempVal;
213 typedef void (T::*void_CallMethod_void)(void);
214 static bool Call(
DisplayObject* obj, void_CallMethod_void method)
216 bool foundOne =
false;
218 if (dynamic_cast<T*>(obj))
220 T* specific =
dynamic_cast<T*
>(obj);
221 (specific->*method)();
225 if (dynamic_cast<Group*>(obj))
229 for (
unsigned int i = 0; i < grp->
Count(); i++)
231 if (Call((*grp)[i], method))
240 typedef void (T::*void_CallMethod_argType)(argType);
241 static bool Call(
DisplayObject* obj, void_CallMethod_argType method,
const argType arg1)
243 bool foundOne =
false;
245 if (dynamic_cast<T*>(obj))
247 T* specific =
dynamic_cast<T*
>(obj);
248 (specific->*method)(arg1);
252 if (dynamic_cast<Group*>(obj))
256 for (
unsigned int i = 0; i < grp->
Count(); i++)
258 if (Call((*grp)[i], method, arg1))
267 typedef void (T::*void_CallMethod_argType_arg2Type)(argType, arg2Type);
268 static bool Call(
DisplayObject* obj, void_CallMethod_argType_arg2Type method, argType arg1, arg2Type arg2)
270 bool foundOne =
false;
272 if (dynamic_cast<T*>(obj))
274 T* specific =
dynamic_cast<T*
>(obj);
275 (specific->*method)(arg1,arg2);
279 if (dynamic_cast<Group*>(obj))
283 for (
unsigned int i = 0; i < grp->
Count(); i++)
285 if (Call((*grp)[i], method, arg1,arg2))
294 typedef void (T::*void_CallMethod_argTypeRef)(argType&);
297 void_CallMethod_argTypeRef method,
301 bool foundOne =
false;
303 if (dynamic_cast<T*>(obj))
305 T* specific =
dynamic_cast<T*
>(obj);
306 (specific->*method)(arg1);
310 if (dynamic_cast<Group*>(obj))
314 for (
unsigned int i = 0; i < grp->
Count(); i++)
316 if (Call((*grp)[i], method, arg1))
327 typedef argType (T::*argType_CallMethod_void)();
328 static argType ReturnCall(
DisplayObject* obj, argType_CallMethod_void method,
const argType notFoundValue = argType(0),
const argType multipleValue = argType(-1),
bool* rvalFoundOne = NULL)
330 argType rval = notFoundValue;
331 bool weFoundOne =
false;
334 if (dynamic_cast<T*>(obj))
336 T* specific =
dynamic_cast<T*
>(obj);
338 rval = (specific->*method)();
342 if (dynamic_cast<Group*>(obj))
347 for (
unsigned int i = 0; i < grp->
Count(); i++)
349 bool foundOneThisIndex;
350 temp = ReturnCall((*grp)[i], method, notFoundValue, multipleValue, &foundOneThisIndex);
352 if (foundOneThisIndex)
360 rval = multipleValue;
376 *rvalFoundOne = weFoundOne;
386 typedef glsColor (T::*glsColor_CallMethod_void)();
391 if (dynamic_cast<Group*>(obj))
397 for (
unsigned int i = 0; i < grp->
Count(); i++)
399 temp = Call((*grp)[i], method, tempColor);
410 foundColor = tempColor;
416 if (foundColor != tempColor)
424 else if (dynamic_cast<T*>(obj))
426 T* specific =
dynamic_cast<T*
>(obj);
427 foundColor = (specific->*method)();
unsigned int Count(void) const
Definition: group.h:166
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:64
The Color class: Implements a 4 component RGBA color.
The disti::DisplayObject class and global enumerations.
Definition: gls_color.h:54
Definition: bmpimage.h:46