bool Component::eventChild(Child& child, const Event& event, bool visible) { assert(child.getComponent() != 0); Event ev = event; if(event.type == Event::MOUSEMOTION || event.type == Event::MOUSEBUTTONDOWN || event.type == Event::MOUSEBUTTONUP) { ev.mousepos -= child.position; if(visible && child.component->opaque(ev.mousepos)) ev.inside = true; else ev.inside = false; } child.component->event(ev); return ev.inside; }
void Component::drawChild(Child& child, Painter& painter) { assert(child.getComponent() != 0); if(child.useClipRect) { painter.setClipRectangle(child.clipRect); } if(child.position != Vector2(0, 0)) { painter.pushTransform(); painter.translate(child.position); } child.component->draw(painter); if(child.position != Vector2(0, 0)) { painter.popTransform(); } if(child.useClipRect) { painter.clearClipRectangle(); } }