/** * Creates a table with a skin, which enables the {@link #add(String)} and {@link #add(String, * String)} methods to be used. */ public Table(Skin skin) { this.skin = skin; layout = new TableLayout(); layout.setTable(this); setTransform(false); setTouchable(Touchable.childrenOnly); }
public void draw(Batch batch, float parentAlpha) { validate(); drawBackground(batch, parentAlpha); if (isTransform()) { applyTransform(batch, computeTransform()); if (clip) { boolean draw = background == null ? clipBegin(0, 0, getWidth(), getHeight()) : clipBegin( layout.getPadLeft(), layout.getPadBottom(), getWidth() - layout.getPadLeft() - layout.getPadRight(), getHeight() - layout.getPadBottom() - layout.getPadTop()); if (draw) { drawChildren(batch, parentAlpha); clipEnd(); } } else drawChildren(batch, parentAlpha); resetTransform(batch); } else super.draw(batch, parentAlpha); }
/** Padding at the left edge of the table. */ public Table padLeft(float padLeft) { layout.padLeft(padLeft); return this; }
/** If true (the default), positions and sizes are rounded to integers. */ public void setRound(boolean round) { layout.round = round; }
/** Returns {@link #getPadTop()} plus {@link #getPadBottom()}. */ public float getPadY() { return layout.getPadTop() + layout.getPadBottom(); }
public float getPadRight() { return layout.getPadRight(); }
public float getPadBottom() { return layout.getPadBottom(); }
public float getPadLeft() { return layout.getPadLeft(); }
/** * Adds {@link Align#bottom} and clears {@link Align#top} for the alignment of the logical table * within the table widget. */ public Table bottom() { layout.bottom(); return this; }
/** * Adds {@link Align#left} and clears {@link Align#right} for the alignment of the logical table * within the table widget. */ public Table left() { layout.left(); return this; }
/** * Adds {@link Align#top} and clears {@link Align#bottom} for the alignment of the logical table * within the table widget. */ public Table top() { layout.top(); return this; }
/** * Sets the alignment of the logical table within the table widget to {@link Align#center}. This * clears any other alignment. */ public Table center() { layout.center(); return this; }
/** * Sets the alignment of the logical table within the table widget. Set to {@link Align#center}, * {@link Align#top}, {@link Align#bottom} , {@link Align#left} , {@link Align#right}, or any * combination of those. */ public Table align(int align) { layout.align(align); return this; }
/** Padding at the right edge of the table. */ public Table padRight(float padRight) { layout.padRight(padRight); return this; }
/** Padding at the bottom edge of the table. */ public Table padBottom(float padBottom) { layout.padBottom(padBottom); return this; }
public float getPadTop() { return layout.getPadTop(); }
public Value getPadLeftValue() { return layout.getPadLeftValue(); }
/** * Adds {@link Align#right} and clears {@link Align#left} for the alignment of the logical table * within the table widget. */ public Table right() { layout.right(); return this; }
public Value getPadBottomValue() { return layout.getPadBottomValue(); }
/** Turns on table debug lines. */ public Table debugTable() { layout.debugTable(); return this; }
public Value getPadRightValue() { return layout.getPadRightValue(); }
/** Turns on cell debug lines. */ public Table debugCell() { layout.debugCell(); return this; }
/** Returns {@link #getPadLeft()} plus {@link #getPadRight()}. */ public float getPadX() { return layout.getPadLeft() + layout.getPadRight(); }
/** Turns on widget debug lines. */ public Table debugWidget() { layout.debugWidget(); return this; }
public int getAlign() { return layout.getAlign(); }
/** Turns on debug lines. */ public Table debug(Debug debug) { layout.debug(debug); return this; }
public Debug getDebug() { return layout.getDebug(); }
public Value getPadTopValue() { return layout.getPadTopValue(); }
public void addDebugRectangle( TableLayout layout, Debug type, float x, float y, float w, float h) { drawDebug = true; if (layout.debugRects == null) layout.debugRects = new Array(); layout.debugRects.add(new DebugRect(type, x, layout.getTable().getHeight() - y, w, h)); }
/** Padding at the top edge of the table. */ public Table padTop(float padTop) { layout.padTop(padTop); return this; }