@Override public Widget mouseClick(int x, int y, int button) { super.mouseClick(x, y, button); x -= bounds.x; y -= bounds.y; for (Widget child : children) { if (child.getBounds().contains(x, y)) { focus = child.mouseClick(x, y, button); return this; } } return null; }
@Override public void draw(int x, int y) { super.draw(x, y); int xx = x + bounds.x; int yy = y + bounds.y; // drawBox(xx, yy, 0xffff0000); if (isDirty()) { layout.doLayout(children, bounds.width, bounds.height); markClean(); } for (Widget child : children) { child.draw(xx, yy); } }
@Override public void mouseMove(int x, int y) { super.mouseMove(x, y); x -= bounds.x; y -= bounds.y; if (focus != null) { focus.mouseMove(x, y); } else { for (Widget child : children) { if (child.getBounds().contains(x, y)) { child.mouseMove(x, y); return; } } } }