@Override
public void draw(Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX(), y = getY(), width = getWidth(), height = getHeight();
float itemY = height;
Drawable background = style.background;
if (background != null) {
background.draw(batch, x, y, width, height);
float leftWidth = background.getLeftWidth();
x += leftWidth;
itemY -= background.getTopHeight();
width -= leftWidth + background.getRightWidth();
}
for (int i = 0; i < items.size; i++) {
if (cullingArea == null || (itemY - cellRenderer.getItemHeight() <= cullingArea.y + cullingArea.height
&& itemY >= cullingArea.y)) {
T item = items.get(i);
boolean selected = selection.contains(item);
cellRenderer.draw(batch, parentAlpha, item, selected, x, y + itemY, width,
cellRenderer.getItemHeight());
} else if (itemY < cullingArea.y) {
break;
}
itemY -= cellRenderer.getItemHeight();
}
}