Search in sources :

Example 11 with VisTable

use of com.kotcrab.vis.ui.widget.VisTable in project gdx-graph by MarcinSc.

the class ValueColorBoxProducer method createValuePart.

private GraphBoxPartImpl createValuePart(String value) {
    Color color = Color.valueOf(value);
    final TextureRegionDrawable drawable = new TextureRegionDrawable(WhitePixel.sharedInstance.texture);
    BaseDrawable baseDrawable = new BaseDrawable(drawable) {

        @Override
        public void draw(Batch batch, float x, float y, float width, float height) {
            drawable.draw(batch, x, y, width, height);
        }
    };
    baseDrawable.setMinSize(20, 20);
    final VisImage image = new VisImage(baseDrawable);
    image.setColor(color);
    final ColorPicker picker = new ColorPicker(new ColorPickerAdapter() {

        @Override
        public void finished(Color newColor) {
            image.setColor(newColor);
            image.fire(new GraphChangedEvent(false, true));
        }
    });
    picker.setColor(color);
    image.addListener(new ClickListener(Input.Buttons.LEFT) {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            // displaying picker with fade in animation
            image.getStage().addActor(picker.fadeIn());
        }
    });
    VisTable table = new VisTable();
    table.add(new VisLabel("Color")).growX();
    table.add(image);
    table.row();
    GraphBoxPartImpl colorPart = new GraphBoxPartImpl(table, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            object.addChild("color", new JsonValue(image.getColor().toString()));
        }
    }) {

        @Override
        public void dispose() {
            picker.dispose();
        }
    };
    colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
    return colorPart;
}
Also used : ColorPicker(com.kotcrab.vis.ui.widget.color.ColorPicker) Color(com.badlogic.gdx.graphics.Color) BaseDrawable(com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable) JsonValue(com.badlogic.gdx.utils.JsonValue) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) VisImage(com.kotcrab.vis.ui.widget.VisImage) VisTable(com.kotcrab.vis.ui.widget.VisTable) Batch(com.badlogic.gdx.graphics.g2d.Batch) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ColorPickerAdapter(com.kotcrab.vis.ui.widget.color.ColorPickerAdapter) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 12 with VisTable

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

the class ExtendedColorPicker method createUI.

@Override
protected void createUI() {
    super.createUI();
    // displayed next to mainTable
    VisTable extendedTable = new VisTable(true);
    extendedTable.add(hBar).row();
    extendedTable.add(sBar).row();
    extendedTable.add(vBar).row();
    extendedTable.add();
    extendedTable.row();
    extendedTable.add(rBar).row();
    extendedTable.add(gBar).row();
    extendedTable.add(bBar).row();
    extendedTable.add();
    extendedTable.row();
    extendedTable.add(aBar).row();
    add(extendedTable).expand().left().top().pad(0, 9, 4, 4);
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable)

Example 13 with VisTable

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

the class ToastManager method show.

/**
 * Displays basic toast with provided text as message. Toast will be displayed for given amount of seconds.
 */
public void show(String text, float timeSec) {
    VisTable table = new VisTable();
    table.add(text).grow();
    show(table, timeSec);
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable)

Example 14 with VisTable

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

the class TestSplitPane method addNormalWidgets.

private void addNormalWidgets() {
    Skin skin = VisUI.getSkin();
    Label label = new Label("Lorem \nipsum \ndolor \nsit \namet", skin);
    Label label2 = new Label("Consectetur \nadipiscing \nelit", skin);
    VisTable table = new VisTable(true);
    VisTable table2 = new VisTable(true);
    table.add(label);
    table2.add(label2);
    SplitPane splitPane = new SplitPane(table, table2, false, skin);
    add(splitPane).fill().expand();
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) SplitPane(com.badlogic.gdx.scenes.scene2d.ui.SplitPane) VisSplitPane(com.kotcrab.vis.ui.widget.VisSplitPane)

Example 15 with VisTable

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

the class TestVertical method addNormalWidgets.

private void addNormalWidgets() {
    ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin());
    Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin());
    Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin());
    progressbar.setValue(50);
    slider.setValue(50);
    sliderDisabled.setValue(50);
    sliderDisabled.setDisabled(true);
    VisTable progressbarTable = new VisTable(true);
    progressbarTable.add(progressbar);
    progressbarTable.add(slider);
    progressbarTable.add(sliderDisabled);
    add(progressbarTable);
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable) VisSlider(com.kotcrab.vis.ui.widget.VisSlider) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) VisProgressBar(com.kotcrab.vis.ui.widget.VisProgressBar) ProgressBar(com.badlogic.gdx.scenes.scene2d.ui.ProgressBar)

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