@Override public void onEvent(ConsoleState state, Event.Key kev) { // System.out.println("WindowChildren OnEvent.Key " + kev.key); super.onEvent(state, kev); if (active_ != null) active_.onEvent(state, kev); if (kev.state == Event.State.RELEASED) { switch (kev.key) { case TAB: if (children_.isEmpty()) { setActive(state, null); } else { Window current = active_; boolean found = false; int i = active_ != null ? children_.indexOf(active_) + 1 : 0; while (!found) { if (i >= children_.size()) { if (current == null) break; else i = 0; } Window active = children_.get(i); found = setActive(state, active); if (active == current) break; ++i; } } break; } } }
@Override public void onEvent(ConsoleState state, Event.MouseButton mbev) { super.onEvent(state, mbev); // System.err.println("WindowChildren::OnEvent " + mbev); // TODO only send if in box, unless captured if (capture_ != null) capture_.onEvent(state, mbev); else { // for (Window d : children_) // Should be in reverse order java.util.ListIterator<Window> itr = children_.listIterator(children_.size()); while (itr.hasPrevious()) { Window d = itr.previous(); if (d.inside(mbev.mx, mbev.my)) { d.onEvent(state, mbev); break; } } } }
@Override public void onEvent(ConsoleState state, Event.MouseMoved mev) { super.onEvent(state, mev); // TODO only send if in box, unless captured if (capture_ != null) capture_.onEvent(state, mev); else { for (Window d : children_) { if (d.inside(mev.mx, mev.my)) { if (last_ != d) { if (last_ != null) last_.onMouseLeave(state); d.onMouseEnter(state); } last_ = d; d.onEvent(state, mev); break; } else if (d == last_) { d.onMouseLeave(state); last_ = null; } } } }