Exemplo n.º 1
0
void RenderContainer::handleMouseMove(int button, int x, int y)
{
    bool isabovesomething = false;
    std::list<RenderObject *>::const_iterator itr = _objlist.begin();
    for (;itr != _objlist.end() ; ++itr) {
        RenderObject * current = *itr;

        if (!current->getVisible()) continue;

        if (!current->hitTest(x, y)) {
            continue;
        }
        if (_lasthoverobj!=current) {
            if (_lasthoverobj) _lasthoverobj->handleMouseLeave(button);
            current->handleMouseEnter(button);
            _lasthoverobj = current;
        }


        isabovesomething = true;
        if (current->handleMouseMove(button, x, y)) break;   
    }
    if (!isabovesomething) {
        if (_lasthoverobj) _lasthoverobj->handleMouseLeave(button);
        _lasthoverobj = NULL;
    }
}