use of mathax.client.gui.widgets.input.WTextBox 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;
}
use of mathax.client.gui.widgets.input.WTextBox in project Client by MatHax.
the class PlaylistsScreen method construct.
public void construct() {
pagination.setMaxPage(PlaylistUtils.count() / MusicTab.MusicScreen.pageSize);
table.clear();
WTextBox box = table.add(theme.textBox("")).expandX().widget();
table.add(theme.plus()).widget().action = () -> SearchUtils.search(box.get(), playlist -> {
PlaylistUtils.add(box.get());
construct();
});
table.row();
table.add(theme.button("Reset")).expandX().widget().action = () -> {
PlaylistUtils.reset();
construct();
};
List<Map.Entry<String, AudioPlaylist>> keys = PlaylistUtils.getEntriesOrdered();
for (int i = 0; i < keys.size(); i++) {
int j = i + pagination.getPageOffset();
table.row();
AudioPlaylist playlist = keys.get(j).getValue();
table.add(theme.button(playlist.getName())).expandX().widget().action = () -> mc.setScreen(new PlaylistViewScreen(theme, playlist, musicScreen).setParent(this));
table.add(theme.minus()).right().widget().action = () -> {
PlaylistUtils.remove(keys.get(j).getKey());
construct();
};
}
for (WMusicWidget wMusicWidget : childWidgets) {
wMusicWidget.add(table, musicScreen, theme);
}
}
use of mathax.client.gui.widgets.input.WTextBox in project Client by MatHax.
the class EditBookTitleAndAuthorScreen method initWidgets.
@Override
public void initWidgets() {
WTable t = add(theme.table()).expandX().widget();
t.add(theme.label("Title"));
WTextBox title = t.add(theme.textBox(itemStack.getOrCreateNbt().getString("title"))).minWidth(220).expandX().widget();
t.row();
t.add(theme.label("Author"));
WTextBox author = t.add(theme.textBox(itemStack.getNbt().getString("author"))).minWidth(220).expandX().widget();
t.row();
t.add(theme.button("Done")).expandX().widget().action = () -> {
itemStack.getNbt().putString("author", author.get());
itemStack.getNbt().putString("title", title.get());
BookScreen.Contents contents = new BookScreen.WrittenBookContents(itemStack);
List<String> pages = new ArrayList<>(contents.getPageCount());
for (int i = 0; i < contents.getPageCount(); i++) pages.add(contents.getPage(i).getString());
mc.getNetworkHandler().sendPacket(new BookUpdateC2SPacket(hand == Hand.MAIN_HAND ? mc.player.getInventory().selectedSlot : 40, pages, Optional.of(title.get())));
close();
};
}
use of mathax.client.gui.widgets.input.WTextBox in project Client by MatHax.
the class WSearchBar method add.
@Override
public void add(WTable parent, MusicTab.MusicScreen screen, GuiTheme theme) {
WTextBox box = parent.add(theme.textBox("")).expandX().widget();
parent.add(theme.button("Search")).widget().action = () -> SearchUtils.search(box.get(), playlist -> mc.setScreen(new PlaylistViewScreen(theme, playlist, screen)));
super.add(parent, screen, theme);
}
Aggregations