OverlayElement* OverlayContainer::findElementAt(Real x, Real y) // relative to parent { OverlayElement* ret = NULL; int currZ = -1; if (mVisible) { ret = OverlayElement::findElementAt(x,y); //default to the current container if no others are found if (ret && mChildrenProcessEvents) { ChildIterator it = getChildIterator(); while (it.hasMoreElements()) { OverlayElement* currentOverlayElement = it.getNext(); if (currentOverlayElement->isVisible() && currentOverlayElement->isEnabled()) { int z = currentOverlayElement->getZOrder(); if (z > currZ) { OverlayElement* elementFound = currentOverlayElement->findElementAt(x ,y ); if (elementFound) { currZ = z; ret = elementFound; } } } } } } return ret; }
//--------------------------------------------------------------------- OverlayElement* Overlay::findElementAt(Real x, Real y) { OverlayElement* ret = NULL; int currZ = -1; OverlayContainerList::iterator i, iend; iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { int z = (*i)->getZOrder(); if (z > currZ) { OverlayElement* elementFound = (*i)->findElementAt(x,y); if(elementFound) { currZ = elementFound->getZOrder(); ret = elementFound; } } } return ret; }