Search in sources :

Example 6 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class TaskComponent method addButtons.

private void addButtons() {
    int i = 0;
    int wrap = getPanelHeight() / getButtonMaxHeight();
    String pos = "";
    int x = 0;
    int y = 0;
    int width = getButtonMaxWidth();
    int height = getButtonMaxHeight();
    for (TASK_COMMAND cmd : TASK_COMMAND.values()) {
        if (!task.checkCommandShown(cmd)) {
            continue;
        }
        Image image = cmd.getImage();
        if (image == null) {
            image = ImageManager.getEmptyItemIcon(true).getImage();
        }
        CustomButton btn = new ActionButtonEnum<>(null, image, cmd, this);
        i++;
        y += height;
        if (i >= wrap) {
            y = 0;
            x += width;
            pos = "pos " + x + " " + y;
        }
        mouseMap.put(new Rectangle(x, y, image.getWidth(null), image.getHeight(null)), cmd);
        buttonPanel.add(btn, pos);
    }
}
Also used : CustomButton(eidolons.swing.components.buttons.CustomButton) TASK_COMMAND(main.gui.sub.TaskComponent.TASK_COMMAND) ActionButtonEnum(eidolons.swing.components.buttons.ActionButtonEnum)

Example 7 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class AddRemoveComponent method getAddComp.

protected CustomButton getAddComp(boolean blocked) {
    final AddRemoveComponent arc = this;
    CustomButton comp = new CustomButton((blocked ? VISUALS.ADD_BLOCKED : VISUALS.ADD)) {

        @Override
        public void handleClick() {
            if (!isEnabled()) {
                playDisabledSound();
            } else {
                arc.add();
            }
        }
    };
    comp.setEnabled(!blocked);
    return comp;
}
Also used : CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 8 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class LE_Palette method refresh.

public void refresh() {
    if (workspaceControlTab == null) {
        workspaceControlTab = new G_Panel(VISUALS.H_LIST_2_8);
        workspaceControlTab.setLayout(new MigLayout("fill, insets 5 2 20 0"));
        CustomButton newButton = new CustomButton("New") {

            public void handleClick() {
                newPalette();
            }
        };
        workspaceControlTab.add(newButton);
        CustomButton addButton = new CustomButton("Add") {

            public void handleClick() {
                addWorkspaces();
            }
        };
        workspaceControlTab.add(addButton);
        CustomButton deleteButton = new CustomButton("Delete") {

            public void handleClick() {
                deletePalettes(false);
            }

            public void handleAltClick() {
                deletePalettes(true);
            }
        };
        workspaceControlTab.add(deleteButton);
        paletteTabs.addTab(// PAGE_SIZE - 1, "Custom",
        "Custom", workspaceControlTab);
    }
    paletteTabs.refresh();
}
Also used : G_Panel(main.swing.generic.components.G_Panel) MigLayout(net.miginfocom.swing.MigLayout) CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 9 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class AddRemoveComponent method getRemoveComp.

protected CustomButton getRemoveComp(boolean blocked) {
    final AddRemoveComponent arc = this;
    CustomButton comp = new CustomButton((blocked ? VISUALS.REMOVE_BLOCKED : VISUALS.REMOVE)) {

        @Override
        public void handleClick() {
            if (!isEnabled()) {
                playDisabledSound();
            } else {
                arc.remove();
            }
        }
    };
    comp.setEnabled(!blocked);
    return comp;
}
Also used : CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 10 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class TavernView method addSelectionPages.

@SuppressWarnings("serial")
protected void addSelectionPages() {
    // TODO background, text panel,
    pages = createSelectionComponent();
    pages.setData(data);
    pages.refresh();
    String PAGE_POS = "id pages, pos " + getPagePosX() + " " + getPagePosY();
    TextCompDC patrons = new TextCompDC(VISUALS.PROP_BOX, tavern.getName() + "'s patrons", 18);
    add(patrons, "id patrons, pos " + getPagePosX() + " info.y2");
    CustomButton buyProvisions = new DialogueButton(VISUALS.BUTTON, "Buy Provisions", "How much supplies do you need?", "All you have", "All that " + MacroManager.getActiveParty().getSharedGold() + " can buy", "None, actually") {

        protected void processChoice(Boolean waitForInput) {
            if (waitForInput != null) {
                tavern.buyProvisions(waitForInput);
            }
        }
    };
    add(buyProvisions, "id buyProvisions, pos 0 0");
    CustomButton rentRooms = new DialogueButton(VISUALS.BUTTON, "Rent Rooms", getRentRoomsInfoText(), "Just Tonight", "As needed", "Never mind") {

        protected void processChoice(Boolean waitForInput) {
            if (waitForInput != null) {
                tavern.rentRooms(waitForInput);
            }
        }
    };
    add(rentRooms, "id rentRooms, pos 0 buyProvisions.y2");
    // perhaps a plain list instead?
    add(pages, PAGE_POS);
// add Buy Provisions, Drinks and Rent Rooms
}
Also used : TextCompDC(eidolons.swing.components.panels.page.info.element.TextCompDC) CustomButton(eidolons.swing.components.buttons.CustomButton)

Aggregations

CustomButton (eidolons.swing.components.buttons.CustomButton)17 G_Panel (main.swing.generic.components.G_Panel)6 TextCompDC (eidolons.swing.components.panels.page.info.element.TextCompDC)2 PoolComp (eidolons.client.cc.gui.misc.PoolComp)1 PortraitComp (eidolons.client.cc.gui.neo.header.PortraitComp)1 HT_Node (eidolons.client.cc.gui.neo.tree.HT_Node)1 ActionButtonEnum (eidolons.swing.components.buttons.ActionButtonEnum)1 PhaseAnimation (eidolons.system.graphics.PhaseAnimation)1 ObjType (main.entity.type.ObjType)1 Coordinates (main.game.bf.Coordinates)1 TASK_COMMAND (main.gui.sub.TaskComponent.TASK_COMMAND)1 ImageButton (main.swing.components.ImageButton)1 CompVisuals (main.swing.generic.components.CompVisuals)1 VISUALS (main.swing.generic.components.G_Panel.VISUALS)1 ANIM (main.system.graphics.ANIM)1 LogEntryNode (main.system.text.LogEntryNode)1 MigLayout (net.miginfocom.swing.MigLayout)1