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);
}
}
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;
}
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();
}
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;
}
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
}
Aggregations