Search in sources :

Example 1 with WContainer

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

the class MarkerScreen method initWidgets.

@Override
public void initWidgets() {
    // Settings
    if (marker.settings.groups.size() > 0) {
        settingsContainer = add(theme.verticalList()).expandX().widget();
        settingsContainer.add(theme.settings(marker.settings)).expandX();
    }
    // Custom widget
    WWidget widget = getWidget(theme);
    if (widget != null) {
        add(theme.horizontalSeparator()).expandX();
        Cell<WWidget> cell = add(widget);
        if (widget instanceof WContainer)
            cell.expandX();
    }
}
Also used : WWidget(mathax.client.gui.widgets.WWidget) WContainer(mathax.client.gui.widgets.containers.WContainer)

Example 2 with WContainer

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

the class ModuleScreen method initWidgets.

@Override
public void initWidgets() {
    // Description
    add(theme.label(module.description, Utils.getWindowWidth() / 2.0));
    // Settings
    if (module.settings.groups.size() > 0) {
        settingsContainer = add(theme.verticalList()).expandX().widget();
        settingsContainer.add(theme.settings(module.settings)).expandX();
    }
    // Custom widget
    WWidget widget = module.getWidget(theme);
    if (widget != null) {
        add(theme.horizontalSeparator()).expandX();
        Cell<WWidget> cell = add(widget);
        if (widget instanceof WContainer)
            cell.expandX();
    }
    // Bind
    WSection section = add(theme.section("Bind", true)).expandX().widget();
    keybind = section.add(theme.keybind(module.keybind)).expandX().widget();
    keybind.actionOnSet = () -> Modules.get().setModuleToBind(module);
    // Toggle on bind release
    WHorizontalList tobr = section.add(theme.horizontalList()).widget();
    tobr.add(theme.label("Toggle on bind release: "));
    WCheckbox tobrC = tobr.add(theme.checkbox(module.toggleOnBindRelease)).widget();
    tobrC.action = () -> module.toggleOnBindRelease = tobrC.checked;
    // Module
    add(theme.section("Module", true)).expandX().widget();
    // Bottom
    WHorizontalList bottom = add(theme.horizontalList()).expandX().widget();
    // Messages
    bottom.add(theme.label("Toggle message: "));
    WCheckbox messageToggle = bottom.add(theme.checkbox(module.isMessageEnabled())).expandCellX().widget();
    messageToggle.action = () -> {
        if (module.isMessageEnabled() != messageToggle.checked)
            module.setToggleMessage(messageToggle.checked);
    };
    // Toasts
    bottom.add(theme.label("Toggle toast: "));
    WCheckbox toastToggle = bottom.add(theme.checkbox(module.isToastEnabled())).widget();
    toastToggle.action = () -> {
        if (module.isToastEnabled() != toastToggle.checked)
            module.setToggleToast(toastToggle.checked);
    };
    // Bottom 2
    WHorizontalList bottom2 = add(theme.horizontalList()).expandX().widget();
    // Active
    bottom2.add(theme.label("Active: "));
    WCheckbox active = bottom2.add(theme.checkbox(module.isActive())).expandCellX().widget();
    active.action = () -> {
        if (module.isActive() != active.checked)
            module.toggle();
    };
    // Visible
    bottom2.add(theme.label("Visible: "));
    WCheckbox visible = bottom2.add(theme.checkbox(module.isVisible())).widget();
    visible.action = () -> {
        if (module.isVisible() != visible.checked)
            module.setVisible(visible.checked);
    };
}
Also used : WSection(mathax.client.gui.widgets.containers.WSection) WWidget(mathax.client.gui.widgets.WWidget) WContainer(mathax.client.gui.widgets.containers.WContainer) WCheckbox(mathax.client.gui.widgets.pressable.WCheckbox) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 3 with WContainer

use of mathax.client.gui.widgets.containers.WContainer 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;
}
Also used : Utils(mathax.client.utils.Utils) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList) WWindow(mathax.client.gui.widgets.containers.WWindow) GuiTheme(mathax.client.gui.GuiTheme) Set(java.util.Set) Items(net.minecraft.item.Items) WContainer(mathax.client.gui.widgets.containers.WContainer) WSection(mathax.client.gui.widgets.containers.WSection) Tabs(mathax.client.gui.tabs.Tabs) ArrayList(java.util.ArrayList) Cell(mathax.client.gui.utils.Cell) List(java.util.List) WTextBox(mathax.client.gui.widgets.input.WTextBox) TabScreen(mathax.client.gui.tabs.TabScreen) NbtUtils(mathax.client.utils.misc.NbtUtils) Category(mathax.client.systems.modules.Category) Modules(mathax.client.systems.modules.Modules) Module(mathax.client.systems.modules.Module) WWindow(mathax.client.gui.widgets.containers.WWindow)

Example 4 with WContainer

use of mathax.client.gui.widgets.containers.WContainer 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;
}
Also used : Utils(mathax.client.utils.Utils) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList) WWindow(mathax.client.gui.widgets.containers.WWindow) GuiTheme(mathax.client.gui.GuiTheme) Set(java.util.Set) Items(net.minecraft.item.Items) WContainer(mathax.client.gui.widgets.containers.WContainer) WSection(mathax.client.gui.widgets.containers.WSection) Tabs(mathax.client.gui.tabs.Tabs) ArrayList(java.util.ArrayList) Cell(mathax.client.gui.utils.Cell) List(java.util.List) WTextBox(mathax.client.gui.widgets.input.WTextBox) TabScreen(mathax.client.gui.tabs.TabScreen) NbtUtils(mathax.client.utils.misc.NbtUtils) Category(mathax.client.systems.modules.Category) Modules(mathax.client.systems.modules.Modules) Module(mathax.client.systems.modules.Module) WWindow(mathax.client.gui.widgets.containers.WWindow) Module(mathax.client.systems.modules.Module)

Example 5 with WContainer

use of mathax.client.gui.widgets.containers.WContainer 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;
}
Also used : Utils(mathax.client.utils.Utils) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList) WWindow(mathax.client.gui.widgets.containers.WWindow) GuiTheme(mathax.client.gui.GuiTheme) Set(java.util.Set) Items(net.minecraft.item.Items) WContainer(mathax.client.gui.widgets.containers.WContainer) WSection(mathax.client.gui.widgets.containers.WSection) Tabs(mathax.client.gui.tabs.Tabs) ArrayList(java.util.ArrayList) Cell(mathax.client.gui.utils.Cell) List(java.util.List) WTextBox(mathax.client.gui.widgets.input.WTextBox) TabScreen(mathax.client.gui.tabs.TabScreen) NbtUtils(mathax.client.utils.misc.NbtUtils) Category(mathax.client.systems.modules.Category) Modules(mathax.client.systems.modules.Modules) Module(mathax.client.systems.modules.Module) WWindow(mathax.client.gui.widgets.containers.WWindow) WTextBox(mathax.client.gui.widgets.input.WTextBox) Module(mathax.client.systems.modules.Module) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList)

Aggregations

WContainer (mathax.client.gui.widgets.containers.WContainer)5 WSection (mathax.client.gui.widgets.containers.WSection)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Set (java.util.Set)3 GuiTheme (mathax.client.gui.GuiTheme)3 TabScreen (mathax.client.gui.tabs.TabScreen)3 Tabs (mathax.client.gui.tabs.Tabs)3 Cell (mathax.client.gui.utils.Cell)3 WVerticalList (mathax.client.gui.widgets.containers.WVerticalList)3 WWindow (mathax.client.gui.widgets.containers.WWindow)3 WTextBox (mathax.client.gui.widgets.input.WTextBox)3 Category (mathax.client.systems.modules.Category)3 Module (mathax.client.systems.modules.Module)3 Modules (mathax.client.systems.modules.Modules)3 Utils (mathax.client.utils.Utils)3 NbtUtils (mathax.client.utils.misc.NbtUtils)3 Items (net.minecraft.item.Items)3 WWidget (mathax.client.gui.widgets.WWidget)2 WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)1