Base* Base::GetControlAt(int x, int y, bool bOnlyIfMouseEnabled) { if (Hidden()) return NULL; if (x < 0 || y < 0 || x >= Width() || y >= Height()) return NULL; Base::List::reverse_iterator iter; for (iter = Children.rbegin(); iter != Children.rend(); ++iter) { Base* pChild = *iter; Base* pFound = NULL; pFound = pChild->GetControlAt(x-pChild->X(), y-pChild->Y(), bOnlyIfMouseEnabled); if (pFound) return pFound; } if (bOnlyIfMouseEnabled && !GetMouseInputEnabled()) return NULL; return this; }