Search in sources :

Example 1 with VisImageButton

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

the class ConsoleDialog method addCloseButton.

@Override
public void addCloseButton() {
    VisImageButton closeButton = new VisImageButton("close-properties");
    this.getTitleTable().add(closeButton).padRight(0).padTop(0);
    closeButton.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            close();
        }
    });
    closeButton.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            event.cancel();
            return true;
        }
    });
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 2 with VisImageButton

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

the class UIRemovableProperties method crateHeaderTable.

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

        @Override
        public void clicked(InputEvent event, float x, float y) {
            collapse(header);
        }
    });
    closeButton.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            Dialogs.showConfirmDialog(Sandbox.getInstance().getUIStage(), "Delete Component", "Do you want to delete this component?", new String[] { "Cancel", "Delete" }, new Integer[] { 0, 1 }, r -> {
                if (r == 1) {
                    onRemove();
                    remove();
                }
            }).padBottom(20).pack();
        }
    });
    closeButton.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            event.cancel();
            return true;
        }
    });
    return header;
}
Also used : ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) VisUI(com.kotcrab.vis.ui.VisUI) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sandbox(games.rednblack.editor.view.stage.Sandbox) StandardWidgetsFactory(games.rednblack.h2d.common.view.ui.StandardWidgetsFactory) Dialogs(com.kotcrab.vis.ui.util.dialog.Dialogs) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Touchable(com.badlogic.gdx.scenes.scene2d.Touchable) VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with VisImageButton

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

the class EditSpriteAnimationPanel method updateView.

public void updateView(Map<String, FrameRange> frameRangeMap) {
    createNewAnimationTable(frameRangeMap.get("Default").endFrame);
    animationsList.clear();
    for (Map.Entry<String, FrameRange> entry : frameRangeMap.entrySet()) {
        String animationName = entry.getKey();
        FrameRange range = entry.getValue();
        VisTable row = new VisTable();
        VisImageButton trashBtn = new VisImageButton("trash-button");
        row.add(StandardWidgetsFactory.createLabel(animationName)).width(120).left();
        row.add(StandardWidgetsFactory.createLabel(range.startFrame + "")).width(50).left();
        row.add(StandardWidgetsFactory.createLabel(range.endFrame + "")).width(50).left();
        if (!animationName.equals("Default"))
            row.add(trashBtn).padLeft(10);
        row.row();
        animationsList.add(row).left();
        animationsList.row();
        trashBtn.addListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                facade.sendNotification(DELETE_BUTTON_PRESSED, animationName);
            }
        });
    }
    invalidateHeight();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) FrameRange(games.rednblack.editor.renderer.data.FrameRange) VisTable(com.kotcrab.vis.ui.widget.VisTable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Map(java.util.Map) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 4 with VisImageButton

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

the class UIResourcesTab method createFilterButton.

protected VisImageButton createFilterButton() {
    VisImageButton button = StandardWidgetsFactory.createImageButton("filter-button");
    button.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            HyperLap2DFacade facade = HyperLap2DFacade.getInstance();
            Vector2 pos = Pools.obtain(Vector2.class);
            pos.set(0, 0);
            button.localToStageCoordinates(pos);
            Object[] payload = new Object[] { pos.x, pos.y, getTabTitle() };
            facade.sendNotification(UIFilterMenu.SHOW_FILTER_MENU, payload);
            Pools.free(pos);
        }
    });
    return button;
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) Vector2(com.badlogic.gdx.math.Vector2) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) HyperLap2DFacade(games.rednblack.editor.HyperLap2DFacade)

Example 5 with VisImageButton

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

the class UIToolBox method createButton.

private VisImageButton createButton(VisImageButton.VisImageButtonStyle btnStyle, String toolId) {
    VisImageButton visImageButton = new VisImageButton(btnStyle);
    toolsButtonGroup.add(visImageButton);
    visImageButton.addListener(new ToolboxButtonClickListener(toolId));
    return visImageButton;
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton)

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