Search in sources :

Example 1 with ConfigOptionChangeListenerButton

use of fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton 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)

Example 2 with ConfigOptionChangeListenerButton

use of fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton in project tweakermore by Fallen-Breath.

the class WidgetListConfigOptionMixin method addBooleanAndHotkeyWidgets.

// #if MC < 11800
private void addBooleanAndHotkeyWidgets(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.fallenbreath.tweakermore.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)2 ButtonGeneric (fi.dy.masa.malilib.gui.button.ButtonGeneric)2 ConfigButtonBoolean (fi.dy.masa.malilib.gui.button.ConfigButtonBoolean)2 ConfigButtonKeybind (fi.dy.masa.malilib.gui.button.ConfigButtonKeybind)2 HotkeyedBooleanResetListener (me.fallenbreath.tweakermore.gui.HotkeyedBooleanResetListener)1 HotkeyedBooleanResetListener (me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener)1