use of mathax.client.gui.utils.Cell in project Client by MatHax.
the class ModulesScreen method createFavorites.
// Favorites
protected Cell<WWindow> createFavorites(WContainer c) {
boolean hasFavorites = Modules.get().getAll().stream().anyMatch(module -> module.favorite);
if (!hasFavorites)
return null;
WWindow w = theme.window("Favorites");
w.id = "favorites";
w.padding = 0;
w.spacing = 0;
if (theme.categoryIcons())
w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(Items.NETHER_STAR.getDefaultStack())).pad(2);
Cell<WWindow> cell = c.add(w);
w.view.scrollOnlyWhenMouseOver = true;
w.view.hasScrollBar = false;
w.view.spacing = 0;
createFavoritesW(w);
return cell;
}
use of mathax.client.gui.utils.Cell in project Client by MatHax.
the class LeftRightListSettingScreen method abc.
private WTable abc(Consumer<List<Pair<T, Integer>>> addValues, boolean isLeft, Consumer<T> buttonAction) {
// Create
Cell<WTable> cell = this.table.add(theme.table()).top();
WTable table = cell.widget();
Consumer<T> forEach = t -> {
if (!includeValue(t))
return;
table.add(getValueWidget(t));
WPressable button = table.add(isLeft ? theme.plus() : theme.minus()).expandCellX().right().widget();
button.action = () -> buttonAction.accept(t);
table.row();
};
// Sort
List<Pair<T, Integer>> values = new ArrayList<>();
addValues.accept(values);
if (!filterText.isEmpty())
values.sort(Comparator.comparingInt(value -> -value.getRight()));
for (Pair<T, Integer> pair : values) forEach.accept(pair.getLeft());
if (table.cells.size() > 0)
cell.expandX();
return table;
}
Aggregations