Search in sources :

Example 11 with VisImageButton

use of com.kotcrab.vis.ui.widget.VisImageButton in project vis-ui by kotcrab.

the class TestGenerateDisabledImage method addVisWidgets.

private void addVisWidgets() {
    Drawable icon = VisUI.getSkin().getDrawable("icon-folder");
    VisImageButton normal = new VisImageButton(icon);
    VisImageButton disabled = new VisImageButton(icon);
    disabled.setGenerateDisabledImage(true);
    disabled.setDisabled(true);
    add(new VisLabel("VisImageButton normal"));
    add(normal).row();
    add(new VisLabel("VisImageButton disabled"));
    add(disabled).row();
    VisImageTextButton normalText = new VisImageTextButton("text", icon);
    VisImageTextButton disabledText = new VisImageTextButton("text", icon);
    disabledText.setGenerateDisabledImage(true);
    disabledText.setDisabled(true);
    add(new VisLabel("VisImageTextButton normal"));
    add(normalText).row();
    add(new VisLabel("VisImageTextButton disabled"));
    add(disabledText).padBottom(3f).row();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisImageTextButton(com.kotcrab.vis.ui.widget.VisImageTextButton) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) VisLabel(com.kotcrab.vis.ui.widget.VisLabel)

Example 12 with VisImageButton

use of com.kotcrab.vis.ui.widget.VisImageButton in project HyperLap2D by rednblackgames.

the class UIToolBox method addToolButton.

public void addToolButton(String name, VisImageButton.VisImageButtonStyle btnStyle, Tool tool) {
    VisImageButton button = createButton(btnStyle, name);
    String toolTip = tool.getTitle() + (tool.getShortcut() != null ? " (" + tool.getShortcut() + ")" : "");
    StandardWidgetsFactory.addTooltip(button, toolTip);
    buttonMap.put(name, button);
    add(button).width(31).height(31).row();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton)

Example 13 with VisImageButton

use of com.kotcrab.vis.ui.widget.VisImageButton in project HyperLap2D by rednblackgames.

the class UIAlignBox method createAlignButton.

private VisImageButton createAlignButton(String styleName, int alignment, String title) {
    VisImageButton visImageButton = new VisImageButton(styleName);
    visImageButton.addListener(new AlignmentButtonClickListener(alignment));
    StandardWidgetsFactory.addTooltip(visImageButton, title);
    return visImageButton;
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton)

Example 14 with VisImageButton

use of com.kotcrab.vis.ui.widget.VisImageButton in project HyperLap2D by rednblackgames.

the class UIItemCollapsibleProperties method crateHeaderTable.

public Table crateHeaderTable() {
    header = new VisTable();
    header.setTouchable(Touchable.enabled);
    header.setBackground(VisUI.getSkin().getDrawable("expandable-properties-active-bg"));
    header.add(StandardWidgetsFactory.createLabel(title)).left().expandX().padRight(6).padLeft(8);
    VisImageButton button = StandardWidgetsFactory.createImageButton("expandable-properties-button");
    header.add(button).padRight(8);
    header.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            collapse(header);
        }
    });
    return header;
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 15 with VisImageButton

use of com.kotcrab.vis.ui.widget.VisImageButton in project HyperLap2D by rednblackgames.

the class AlternativeAutoTileDialog method updateVisImageButton.

/**
 * Updates the given button with the given image.
 *
 * @param button The button to update.
 * @param regionName The name of the new image.
 */
private void updateVisImageButton(VisImageButton button, String regionName) {
    VisImageButton.VisImageButtonStyle imageBoxStyle = button.getStyle();
    Drawable tileDrawable = null;
    if (!"".equals(regionName)) {
        tileDrawable = new TextureRegionDrawable(tiledPlugin.pluginRM.getTextureRegion(regionName, EntityFactory.IMAGE_TYPE));
    }
    imageBoxStyle.imageUp = tileDrawable;
    imageBoxStyle.imageDown = tileDrawable;
    imageBoxStyle.imageChecked = tileDrawable;
    imageBoxStyle.imageOver = tileDrawable;
    button.setStyle(imageBoxStyle);
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)

Aggregations

VisImageButton (com.kotcrab.vis.ui.widget.VisImageButton)21 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)7 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)7 VisTable (com.kotcrab.vis.ui.widget.VisTable)6 Actor (com.badlogic.gdx.scenes.scene2d.Actor)5 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)4 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)4 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)4 VisLabel (com.kotcrab.vis.ui.widget.VisLabel)2 NinePatch (com.badlogic.gdx.graphics.g2d.NinePatch)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Touchable (com.badlogic.gdx.scenes.scene2d.Touchable)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 VisUI (com.kotcrab.vis.ui.VisUI)1 FloatValidator (com.kotcrab.vis.ui.util.Validators.FloatValidator)1 Dialogs (com.kotcrab.vis.ui.util.dialog.Dialogs)1 VisImageTextButton (com.kotcrab.vis.ui.widget.VisImageTextButton)1