Search in sources :

Example 1 with WWidget

use of mathax.client.gui.widgets.WWidget 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 WWidget

use of mathax.client.gui.widgets.WWidget 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)

Aggregations

WWidget (mathax.client.gui.widgets.WWidget)2 WContainer (mathax.client.gui.widgets.containers.WContainer)2 WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)1 WSection (mathax.client.gui.widgets.containers.WSection)1 WCheckbox (mathax.client.gui.widgets.pressable.WCheckbox)1