Search in sources :

Example 1 with Tooltips

use of com.mobidevelop.maps.editor.ui.utils.Tooltips in project gdx-skineditor by cobolfoo.

the class WidgetsBar method initializeButtons.

/**
 */
public void initializeButtons() {
    group = new ButtonGroup();
    Tooltips.TooltipStyle styleTooltip = new Tooltips.TooltipStyle(game.skin.getFont("default-font"), game.skin.getDrawable("default-round"), game.skin.getColor("white"));
    String[] widgets = SkinEditorGame.widgets;
    for (String widget : widgets) {
        ImageButtonStyle style = new ImageButtonStyle();
        style.checked = game.skin.getDrawable("default-round-down");
        style.down = game.skin.getDrawable("default-round-down");
        style.up = game.skin.getDrawable("default-round");
        style.imageUp = game.skin.getDrawable("widgets/" + widget);
        ImageButton button = new ImageButton(style);
        button.setUserObject(widget);
        Tooltips tooltip = new Tooltips(styleTooltip, getStage());
        tooltip.registerTooltip(button, (String) button.getUserObject());
        button.addListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                game.screenMain.panePreview.refresh();
                game.screenMain.paneOptions.refresh();
            }
        });
        group.add(button);
        add(button).pad(5);
    }
}
Also used : ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) ButtonGroup(com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup) Tooltips(com.mobidevelop.maps.editor.ui.utils.Tooltips) ImageButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ButtonGroup (com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup)1 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)1 ImageButtonStyle (com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 Tooltips (com.mobidevelop.maps.editor.ui.utils.Tooltips)1