Search in sources :

Example 11 with WTable

use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.

the class InteractionMenu method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WTable table = theme.table();
    fillTable(theme, table);
    return table;
}
Also used : WTable(mathax.client.gui.widgets.containers.WTable)

Example 12 with WTable

use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.

the class WCurrentTracksView method add.

@Override
public void add(WTable parent, MusicTab.MusicScreen screen, GuiTheme theme) {
    currentTrack = Music.player.getPlayingTrack();
    parent.row();
    WTable currentTracks = parent.add(theme.section("Current tracks")).expandX().widget().add(theme.table()).expandX().widget();
    super.add(currentTracks, screen, theme);
}
Also used : WTable(mathax.client.gui.widgets.containers.WTable)

Example 13 with WTable

use of mathax.client.gui.widgets.containers.WTable 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);
}
Also used : PlaylistViewScreen(mathax.client.gui.screens.music.PlaylistViewScreen) WTable(mathax.client.gui.widgets.containers.WTable) MusicTab(mathax.client.gui.tabs.builtin.MusicTab) WTextBox(mathax.client.gui.widgets.input.WTextBox) GuiTheme(mathax.client.gui.GuiTheme) SearchUtils(mathax.client.utils.music.SearchUtils) MatHax.mc(mathax.client.MatHax.mc) WTextBox(mathax.client.gui.widgets.input.WTextBox) PlaylistViewScreen(mathax.client.gui.screens.music.PlaylistViewScreen)

Example 14 with WTable

use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.

the class Notebot method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WTable table = theme.table();
    // Label
    status = table.add(theme.label(getStatus())).expandCellX().widget();
    // Pause
    WButton pauseBtn = table.add(theme.button(isPlaying ? "Pause" : "Resume")).right().widget();
    pauseBtn.action = () -> {
        pause();
        pauseBtn.set(isPlaying ? "Pause" : "Resume");
        status.set(getStatus());
    };
    // Stop
    WButton stop = table.add(theme.button("Stop")).right().widget();
    stop.action = this::stop;
    table.row();
    noSongsFound = true;
    try {
        Files.list(MatHax.FOLDER.toPath().resolve("Notebot")).forEach(path -> {
            if (isValidFile(path)) {
                noSongsFound = false;
                table.add(theme.label(getFileLabel(path))).expandCellX();
                WButton load = table.add(theme.button("Load")).right().widget();
                load.action = () -> {
                    loadSong(path.toFile());
                    status.set(getStatus());
                };
                WButton preview = table.add(theme.button("Preview")).right().widget();
                preview.action = () -> {
                    previewSong(path.toFile());
                    status.set(getStatus());
                };
                table.row();
            }
        });
    } catch (IOException e) {
        table.add(theme.label("Missing \"Notebot\" folder.")).expandCellX();
        table.row();
    }
    if (noSongsFound) {
        table.add(theme.label("No songs found.")).expandCellX();
        table.row();
        WButton guide = table.add(theme.button("Guide")).expandX().widget();
        guide.action = () -> Util.getOperatingSystem().open("https://mathaxclient.xyz/Notebot-Guide");
    }
    return table;
}
Also used : WTable(mathax.client.gui.widgets.containers.WTable) IOException(java.io.IOException) WButton(mathax.client.gui.widgets.pressable.WButton)

Aggregations

WTable (mathax.client.gui.widgets.containers.WTable)14 WTextBox (mathax.client.gui.widgets.input.WTextBox)6 ArrayList (java.util.ArrayList)4 WButton (mathax.client.gui.widgets.pressable.WButton)4 GuiTheme (mathax.client.gui.GuiTheme)3 Collection (java.util.Collection)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 WindowScreen (mathax.client.gui.WindowScreen)2 Cell (mathax.client.gui.utils.Cell)2 WWidget (mathax.client.gui.widgets.WWidget)2 WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)2 WPressable (mathax.client.gui.widgets.pressable.WPressable)2 Setting (mathax.client.settings.Setting)2 Utils (mathax.client.utils.Utils)2 Pair (net.minecraft.util.Pair)2 Registry (net.minecraft.util.registry.Registry)2 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 File (java.io.File)1