Example usage for com.badlogic.gdx.scenes.scene2d.ui Cell width

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Cell width

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui Cell width.

Prototype

public Cell<T> width(float width) 

Source Link

Document

Sets the minWidth, prefWidth, and maxWidth to the specified value.

Usage

From source file:com.badlogic.gdx.ai.tests.utils.scene2d.TabbedPane.java

License:Apache License

private void initialize() {

    setTouchable(Touchable.enabled);/*w  w w  .  j  a va  2  s  .  c om*/
    tabTitleTable = new Table();
    tabBodyStack = new Stack();
    selectedIndex = -1;

    // Create 1st row
    Cell<?> leftCell = add(new Image(style.titleBegin));
    Cell<?> midCell = add(tabTitleTable);
    Cell<?> rightCell = add(new Image(style.titleEnd));
    switch (tabTitleAlign) {
    case Align.left:
        leftCell.width(((Image) leftCell.getActor()).getWidth()).bottom();
        midCell.left();
        rightCell.expandX().fillX().bottom();
        break;
    case Align.right:
        leftCell.expandX().fillX().bottom();
        midCell.right();
        rightCell.width(((Image) rightCell.getActor()).getWidth()).bottom();
        break;
    case Align.center:
        leftCell.expandX().fillX().bottom();
        midCell.center();
        rightCell.expandX().fillX().bottom();
        break;
    default:
        throw new IllegalArgumentException("TabbedPane align must be one of left, center, right");
    }

    // Create 2nd row
    row();
    Table t = new Table();
    t.setBackground(style.bodyBackground);
    t.add(tabBodyStack);
    add(t).colspan(3).expand().fill();
}

From source file:com.forerunnergames.peril.client.ui.screens.menus.AbstractMenuScreen.java

License:Open Source License

protected final void expandMenuBar(final Runnable completionRunnable) {
    Arguments.checkIsNotNull(completionRunnable, "completionRunnable");

    if (currentMenuBarState.is(MenuBarState.EXPANDED) || menuBarTransitionInProgress.get())
        return;//  w  w  w .  ja v  a2  s  . c  o m

    currentMenuBarState = MenuBarState.EXPANDED;
    menuBarTransitionInProgress.set(true);

    interactionTable.setTouchable(Touchable.disabled);
    interactionTable.setVisible(false);

    titlesTableCell.width(currentMenuBarState.getWidth() - 30);

    for (final Cell<ImageTextButton> menuChoiceCell : menuChoiceCells) {
        menuChoiceCell.width(currentMenuBarState.getWidth() - 2);
    }

    rootStack.invalidate();
    tableL0.invalidate();
    tableL1.invalidate();
    tableL2.invalidate();
    tableL3.invalidate();
    interactionTable.invalidate();
    tableL5.invalidate();
    titleTable.invalidate();
    menuChoicesTable.invalidate();
    buttonTable.invalidate();

    menuBar.addAction(Actions.sizeBy(MenuBarState.EXPANDED.getWidth() - MenuBarState.CONTRACTED.getWidth(),
            0.0f, MENU_BAR_TRANSITION_TIME_SECONDS, MENU_BAR_TRANSITION_INTERPOLATION));

    titleBackground
            .addAction(Actions.sizeBy(MenuBarState.EXPANDED.getWidth() - MenuBarState.CONTRACTED.getWidth(),
                    0.0f, MENU_BAR_TRANSITION_TIME_SECONDS, MENU_BAR_TRANSITION_INTERPOLATION));

    rightMenuBarShadow
            .addAction(Actions.moveBy(MenuBarState.EXPANDED.getWidth() - MenuBarState.CONTRACTED.getWidth(),
                    0.0f, MENU_BAR_TRANSITION_TIME_SECONDS, MENU_BAR_TRANSITION_INTERPOLATION));

    rightBackgroundShadow.addAction(Actions.sequence(
            Actions.moveBy(MenuBarState.EXPANDED.getWidth() - MenuBarState.CONTRACTED.getWidth(), 0.0f,
                    MENU_BAR_TRANSITION_TIME_SECONDS, MENU_BAR_TRANSITION_INTERPOLATION),
            Actions.run(new Runnable() {
                @Override
                public void run() {
                    interactionTable.setVisible(true);
                    interactionTable.setTouchable(Touchable.enabled);
                    menuBarTransitionInProgress.set(false);
                }
            }), Actions.run(completionRunnable)));
}

From source file:com.kotcrab.vis.ui.building.utilities.CellWidget.java

License:Apache License

private void applySizeData(final Cell<?> cell) {
    if (width > IGNORED_SIZE) {
        cell.width(width);
    }//from   www . j a v a 2  s .  c om
    if (height > IGNORED_SIZE) {
        cell.height(height);
    }
    if (minWidth > IGNORED_SIZE) {
        cell.minWidth(minWidth);
    }
    if (minHeight > IGNORED_SIZE) {
        cell.minHeight(minHeight);
    }
}

From source file:com.lyeeedar.UI.TabPanel.java

License:Apache License

private void initialize() {

    setTouchable(Touchable.enabled);//from   w w  w. j ava 2 s.co  m
    tabTitleTable = new Table();
    tabBodyStack = new Stack();
    selectedIndex = -1;

    // Create 1st row
    Cell<?> leftCell = add(new Image(style.titleBegin));
    Cell<?> midCell = add(tabTitleTable);
    Cell<?> rightCell = add(new Image(style.titleEnd));
    switch (tabTitleAlign) {
    case Align.left:
        leftCell.width(leftCell.getActor().getWidth()).bottom();
        midCell.left();
        rightCell.expandX().fillX().bottom();
        break;
    case Align.right:
        leftCell.expandX().fillX().bottom();
        midCell.right();
        rightCell.width(rightCell.getActor().getWidth()).bottom();
        break;
    case Align.center:
        leftCell.expandX().fillX().bottom();
        midCell.center();
        rightCell.expandX().fillX().bottom();
        break;
    default:
        throw new IllegalArgumentException("TabbedPane align must be one of left, center, right");
    }

    // Create 2nd row
    row();
    Table t = new Table();
    t.setBackground(style.bodyBackground);
    t.add(tabBodyStack).expand().fill();
    add(t).colspan(3).expand().fill();
}

From source file:de.bitbrain.craft.ui.ProfessionSelectionView.java

License:Open Source License

private void alignSize(Cell<?> cell, ProfessionElement element) {
    cell.width((Sizes.worldWidth() / 1.2f) / Profession.values().length).height(Sizes.worldHeight() / 1.3f)
            .pad(Sizes.worldWidth() / 70f);
    element.getLabel().setFontScale(element.getWidth() / 270f);
    element.padTop(element.getHeight() / 2.3f);
}

From source file:Roguelike.UI.TabPanel.java

License:Apache License

private void initialize() {

    setTouchable(Touchable.enabled);//from   w  ww  . j  av  a 2 s  .  com
    tabTitleTable = new Table();
    tabBodyStack = new Stack();
    selectedIndex = -1;

    // Create 1st row
    Cell<?> leftCell = add(new Image(style.titleBegin));
    Cell<?> midCell = add(tabTitleTable);
    Cell<?> rightCell = add(new Image(style.titleEnd));
    switch (tabTitleAlign) {
    case Align.left:
        leftCell.width(((Image) leftCell.getActor()).getWidth()).bottom();
        midCell.left();
        rightCell.expandX().fillX().bottom();
        break;
    case Align.right:
        leftCell.expandX().fillX().bottom();
        midCell.right();
        rightCell.width(((Image) rightCell.getActor()).getWidth()).bottom();
        break;
    case Align.center:
        leftCell.expandX().fillX().bottom();
        midCell.center();
        rightCell.expandX().fillX().bottom();
        break;
    default:
        throw new IllegalArgumentException("TabbedPane align must be one of left, center, right");
    }

    // Create 2nd row
    row();
    Table t = new Table();
    t.setBackground(style.bodyBackground);
    t.add(tabBodyStack).expand().fill();
    add(t).colspan(3).expand().fill();
}