use of mathax.client.gui.widgets.containers.WWindow 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.widgets.containers.WWindow in project Client by MatHax.
the class ModulesScreen method createCategory.
// Category
protected WWindow createCategory(WContainer c, Category category) {
WWindow w = theme.window(category.name);
w.id = category.name;
w.padding = 0;
w.spacing = 0;
if (theme.categoryIcons())
w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(category.icon.getDefaultStack())).pad(2);
c.add(w);
w.view.scrollOnlyWhenMouseOver = true;
w.view.hasScrollBar = false;
w.view.spacing = 0;
for (Module module : Modules.get().getGroup(category)) {
w.add(theme.module(module)).expandX();
}
return w;
}
use of mathax.client.gui.widgets.containers.WWindow in project Client by MatHax.
the class ModulesScreen method createSearch.
protected WWindow createSearch(WContainer c) {
WWindow w = theme.window("Search");
w.id = "search";
if (theme.categoryIcons())
w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(Items.COMPASS.getDefaultStack())).pad(2);
c.add(w);
w.view.scrollOnlyWhenMouseOver = true;
w.view.hasScrollBar = false;
w.view.maxHeight -= 20;
WVerticalList l = theme.verticalList();
WTextBox text = w.add(theme.textBox("")).minWidth(140).expandX().widget();
text.setFocused(true);
text.action = () -> {
l.clear();
createSearchW(l, text.get());
};
text.actionOnEnter = () -> {
Set<Module> modules = Modules.get().searchTitles(text.get());
if (modules.size() != 1)
return;
Module target = modules.iterator().next();
target.toggle();
};
w.add(l).expandX();
createSearchW(l, text.get());
return w;
}
Aggregations