Search in sources :

Example 1 with HotkeyedBooleanResetListener

use of me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener in project tweakerplus by Ivan-1F.

the class WidgetListConfigOptionMixin method addBooleanAndHotkeyWidgets$tweakerplus.

private void addBooleanAndHotkeyWidgets$tweakerplus(int x, int y, int configWidth, IHotkeyTogglable config) {
    IKeybind keybind = config.getKeybind();
    int booleanBtnWidth = (configWidth - 24) / 2;
    ConfigButtonBoolean booleanButton = new ConfigButtonBoolean(x, y, booleanBtnWidth, 20, config);
    x += booleanBtnWidth + 2;
    configWidth -= booleanBtnWidth + 2 + 22;
    ConfigButtonKeybind keybindButton = new ConfigButtonKeybind(x, y, configWidth, 20, keybind, this.host);
    x += configWidth + 2;
    this.addWidget(new WidgetKeybindSettings(x, y, 20, 20, keybind, config.getName(), this.parent, this.host.getDialogHandler()));
    x += 24;
    ButtonGeneric resetButton = this.createResetButton(x, y, config);
    ConfigOptionChangeListenerButton booleanChangeListener = new ConfigOptionChangeListenerButton(config, resetButton, null);
    HotkeyedBooleanResetListener resetListener = new HotkeyedBooleanResetListener(config, booleanButton, keybindButton, resetButton, this.host);
    this.host.addKeybindChangeListener(resetListener);
    this.addButton(booleanButton, booleanChangeListener);
    this.addButton(keybindButton, this.host.getButtonPressListener());
    this.addButton(resetButton, resetListener);
}
Also used : ConfigButtonBoolean(fi.dy.masa.malilib.gui.button.ConfigButtonBoolean) HotkeyedBooleanResetListener(me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener) ConfigOptionChangeListenerButton(fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton) ConfigButtonKeybind(fi.dy.masa.malilib.gui.button.ConfigButtonKeybind) ButtonGeneric(fi.dy.masa.malilib.gui.button.ButtonGeneric)

Aggregations

ConfigOptionChangeListenerButton (fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton)1 ButtonGeneric (fi.dy.masa.malilib.gui.button.ButtonGeneric)1 ConfigButtonBoolean (fi.dy.masa.malilib.gui.button.ConfigButtonBoolean)1 ConfigButtonKeybind (fi.dy.masa.malilib.gui.button.ConfigButtonKeybind)1 HotkeyedBooleanResetListener (me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener)1