Search in sources :

Example 1 with VisTable

use of com.kotcrab.vis.ui.widget.VisTable 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 2 with VisTable

use of com.kotcrab.vis.ui.widget.VisTable 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 3 with VisTable

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

the class TagsPanel method updateView.

public void updateView() {
    mainTable.clear();
    tagTable = new VisTable();
    VisTable inputTable = new VisTable();
    List<String> sorted = new LinkedList<>(tags);
    Collections.sort(sorted);
    for (String tag : sorted) {
        tagTable.add(new TagItem(tag, tagItemListener)).pad(5).left().expandX().fillX();
        tagTable.row();
    }
    VisTextField newTagField = StandardWidgetsFactory.createTextField();
    VisTextButton createTagBtn = new VisTextButton("add");
    inputTable.add(newTagField).width(200);
    inputTable.add(createTagBtn).padLeft(5);
    createTagBtn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            String tag = newTagField.getText();
            if (!tagExists(tag)) {
                newTagField.setText("");
                addTag(tag);
                facade.sendNotification(ITEM_ADD, tag);
            }
        }
    });
    mainTable.add(inputTable);
    mainTable.row();
    mainTable.add(tagTable).expandX().fillX();
    invalidateHeight();
}
Also used : VisTextField(com.kotcrab.vis.ui.widget.VisTextField) VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 4 with VisTable

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

the class BoxItemResourceSelectionUIMediator method clearSelection.

/**
 * Clears the selection.
 */
private void clearSelection() {
    for (VisTable boxesTable : boxesTableSet) {
        for (Cell<BoxItemResource> cell : boxesTable.getCells()) {
            BoxItemResource imgResource = cell.getActor();
            setSelected(imgResource, false);
        }
    }
    boxResourceSelectedSet.clear();
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable) BoxItemResource(games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.BoxItemResource)

Example 5 with VisTable

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

the class UIMainTable method initToolsPanel.

private void initToolsPanel() {
    VisTable toolsPanel = new VisTable();
    toolsPanel.background("toolbar-bg");
    // 
    UIToolBoxMediator uiToolBoxMediator = facade.retrieveMediator(UIToolBoxMediator.NAME);
    UIToolBox uiToolBox = uiToolBoxMediator.getViewComponent();
    toolsPanel.add(uiToolBox).top().expandY().padTop(4);
    // 
    middleTable.add(toolsPanel).top().left().width(40).fillY().expandY();
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable)

Aggregations

VisTable (com.kotcrab.vis.ui.widget.VisTable)35 VisLabel (com.kotcrab.vis.ui.widget.VisLabel)11 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)7 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)7 Actor (com.badlogic.gdx.scenes.scene2d.Actor)6 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)6 VisImageButton (com.kotcrab.vis.ui.widget.VisImageButton)6 JsonValue (com.badlogic.gdx.utils.JsonValue)4 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)3 GraphBoxImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl)3 GraphBoxPartImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxPartImpl)3 VisSelectBox (com.kotcrab.vis.ui.widget.VisSelectBox)3 Color (com.badlogic.gdx.graphics.Color)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 ClampMethod (com.gempukku.libgdx.graph.shader.ClampMethod)2 GraphChangedEvent (com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent)2 VisProgressBar (com.kotcrab.vis.ui.widget.VisProgressBar)2 VisSlider (com.kotcrab.vis.ui.widget.VisSlider)2 VisSplitPane (com.kotcrab.vis.ui.widget.VisSplitPane)2 VisTextButton (com.kotcrab.vis.ui.widget.VisTextButton)2