use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class Marker method fillList.
protected void fillList(GuiTheme theme, WVerticalList list) {
// Marker List
for (BaseMarker marker : markers) {
WHorizontalList hList = list.add(theme.horizontalList()).expandX().widget();
// Name
WLabel label = hList.add(theme.label(marker.name.get())).widget();
label.tooltip = marker.description.get();
// Dimension
hList.add(theme.label(" - " + marker.getDimension().toString())).expandX().widget().color = theme.textSecondaryColor();
// Toggle
WCheckbox checkbox = hList.add(theme.checkbox(marker.isActive())).widget();
checkbox.action = () -> {
if (marker.isActive() != checkbox.checked)
marker.toggle();
};
// Edit
WButton edit = hList.add(theme.button(GuiRenderer.EDIT)).widget();
edit.action = () -> mc.setScreen(marker.getScreen(theme));
// Remove
WMinus remove = hList.add(theme.minus()).widget();
remove.action = () -> {
markers.remove(marker);
marker.settings.unregisterColorSettings();
list.clear();
fillList(theme, list);
};
}
// Bottom
WHorizontalList bottom = list.add(theme.horizontalList()).expandX().widget();
WDropdown<String> newMarker = bottom.add(theme.dropdown(factory.getNames(), factory.getNames()[0])).widget();
WButton add = bottom.add(theme.button("Add")).expandX().widget();
add.action = () -> {
String name = newMarker.get();
markers.add(factory.createMarker(name));
list.clear();
fillList(theme, list);
};
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class Timer method getWidget.
// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
if (Modules.get().get(TPSSync.class).isActive()) {
WHorizontalList list = theme.horizontalList();
list.add(theme.label("Multiplier is overwritten by TPSSync."));
WButton disableBtn = list.add(theme.button("Disable TPSSync")).widget();
disableBtn.action = () -> {
TPSSync tpsSync = Modules.get().get(TPSSync.class);
if (tpsSync.isActive())
tpsSync.toggle();
list.visible = false;
};
return list;
}
return null;
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class HudElementScreen method initWidgets.
@Override
public void initWidgets() {
// Description
add(theme.label(element.description, Utils.getWindowWidth() / 2.0));
// Settings
if (element.settings.sizeGroups() > 0) {
settings = add(theme.verticalList()).expandX().widget();
settings.add(theme.settings(element.settings)).expandX();
add(theme.horizontalSeparator()).expandX();
}
// Bottom
WHorizontalList bottomList = add(theme.horizontalList()).expandX().widget();
// Active
bottomList.add(theme.label("Active:"));
WCheckbox active = bottomList.add(theme.checkbox(element.active)).widget();
active.action = () -> {
if (element.active != active.checked)
element.toggle();
};
WButton reset = bottomList.add(theme.button(GuiRenderer.RESET)).expandCellX().right().widget();
reset.action = () -> {
if (element.active != element.defaultActive)
element.active = active.checked = element.defaultActive;
};
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class ProxiesScreen method initWidgets.
@Override
public void initWidgets() {
// Proxies
WTable table = add(theme.table()).expandX().widget();
for (Proxy proxy : Proxies.get()) {
// Enabled
WCheckbox enabled = table.add(theme.checkbox(proxy.enabled)).widget();
checkboxes.add(enabled);
enabled.action = () -> {
boolean checked = enabled.checked;
Proxies.get().setEnabled(proxy, checked);
for (WCheckbox checkbox : checkboxes) checkbox.checked = false;
enabled.checked = checked;
};
// Name
WLabel name = table.add(theme.label(proxy.name)).widget();
name.color = theme.textColor();
// Type
WLabel type = table.add(theme.label("(" + proxy.type + ")")).widget();
type.color = theme.textSecondaryColor();
// IP + Port
WHorizontalList ipList = table.add(theme.horizontalList()).expandCellX().widget();
ipList.spacing = 0;
ipList.add(theme.label(proxy.address));
ipList.add(theme.label(":")).widget().color = theme.textSecondaryColor();
ipList.add(theme.label(Integer.toString(proxy.port)));
// Edit
WButton edit = table.add(theme.button(GuiRenderer.EDIT)).widget();
edit.action = () -> openEditProxyScreen(proxy);
// Remove
WMinus remove = table.add(theme.minus()).widget();
remove.action = () -> {
Proxies.get().remove(proxy);
reload();
};
table.row();
}
WHorizontalList l = add(theme.horizontalList()).expandX().widget();
// New
WButton newBtn = l.add(theme.button("New")).expandX().widget();
newBtn.action = () -> openEditProxyScreen(null);
// Import
PointerBuffer filters = BufferUtils.createPointerBuffer(1);
ByteBuffer txtFilter = MemoryUtil.memASCII("*.txt");
filters.put(txtFilter);
filters.rewind();
WButton importBtn = l.add(theme.button("Import")).expandX().widget();
importBtn.action = () -> {
String selectedFile = TinyFileDialogs.tinyfd_openFileDialog("Import Proxies", null, filters, null, false);
if (selectedFile != null) {
File file = new File(selectedFile);
mc.setScreen(new ProxiesImportScreen(theme, file));
}
};
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class ItemSettingScreen method initTable.
public void initTable() {
for (Item item : Registry.ITEM) {
if (setting.filter != null && !setting.filter.test(item))
continue;
if (item == Items.AIR)
continue;
WItemWithLabel itemLabel = theme.itemWithLabel(item.getDefaultStack(), Names.get(item));
if (!filterText.isEmpty() && !StringUtils.containsIgnoreCase(itemLabel.getLabelText(), filterText))
continue;
table.add(itemLabel);
WButton select = table.add(theme.button("Select")).expandCellX().right().widget();
select.action = () -> {
setting.set(item);
close();
};
table.row();
}
}
Aggregations