Example usage for com.badlogic.gdx.scenes.scene2d.ui Widget getPrefHeight

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Widget getPrefHeight

Introduction

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

Prototype

public float getPrefHeight() 

Source Link

Usage

From source file:com.kotcrab.vis.ui.util.value.PrefHeightIfVisibleValue.java

License:Apache License

@Override
public float get(Actor actor) {
    if (actor instanceof Widget) {
        Widget widget = (Widget) actor;
        return widget.isVisible() ? widget.getPrefHeight() : 0;
    }//from  w w  w .jav  a2s  .  c o  m

    if (actor instanceof Table) {
        Table table = (Table) actor;
        return table.isVisible() ? table.getPrefHeight() : 0;
    }

    throw new IllegalStateException("Unsupported actor type for PrefHeightIfVisibleValue: " + actor.getClass());
}

From source file:net.dermetfan.gdx.scenes.scene2d.ui.UIUtils.java

License:Apache License

/** @param widget the Widget to resize according to its min, pref and max size
 *  @deprecated seems unnecessary and with no known use case */
@Deprecated/*from   w  w  w.  j  ava2 s. c om*/
public static void layoutSize(Widget widget) {
    widget.setSize(
            MathUtils.clamp(widget.getPrefWidth(), widget.getMinWidth(),
                    widget.getMaxWidth() == 0 ? Float.POSITIVE_INFINITY : widget.getMaxWidth()),
            MathUtils.clamp(widget.getPrefHeight(), widget.getMinHeight(),
                    widget.getMaxHeight() == 0 ? Float.POSITIVE_INFINITY : widget.getMaxHeight()));
}