88 lines
2.6 KiB
Java
88 lines
2.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.gui.components;
|
|
|
|
import net.minecraft.client.gui.ComponentPath;
|
|
import net.minecraft.client.gui.components.AbstractScrollArea;
|
|
import net.minecraft.client.gui.components.events.ContainerEventHandler;
|
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
|
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
|
|
import net.minecraft.client.input.MouseButtonEvent;
|
|
import net.minecraft.network.chat.Component;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public abstract class AbstractContainerWidget
|
|
extends AbstractScrollArea
|
|
implements ContainerEventHandler {
|
|
private @Nullable GuiEventListener focused;
|
|
private boolean isDragging;
|
|
|
|
public AbstractContainerWidget(int x, int y, int width, int height, Component message) {
|
|
super(x, y, width, height, message);
|
|
}
|
|
|
|
@Override
|
|
public final boolean isDragging() {
|
|
return this.isDragging;
|
|
}
|
|
|
|
@Override
|
|
public final void setDragging(boolean dragging) {
|
|
this.isDragging = dragging;
|
|
}
|
|
|
|
@Override
|
|
public @Nullable GuiEventListener getFocused() {
|
|
return this.focused;
|
|
}
|
|
|
|
@Override
|
|
public void setFocused(@Nullable GuiEventListener focused) {
|
|
if (this.focused != null) {
|
|
this.focused.setFocused(false);
|
|
}
|
|
if (focused != null) {
|
|
focused.setFocused(true);
|
|
}
|
|
this.focused = focused;
|
|
}
|
|
|
|
@Override
|
|
public @Nullable ComponentPath nextFocusPath(FocusNavigationEvent navigationEvent) {
|
|
return ContainerEventHandler.super.nextFocusPath(navigationEvent);
|
|
}
|
|
|
|
@Override
|
|
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
|
|
boolean scrolling = this.updateScrolling(event);
|
|
return ContainerEventHandler.super.mouseClicked(event, doubleClick) || scrolling;
|
|
}
|
|
|
|
@Override
|
|
public boolean mouseReleased(MouseButtonEvent event) {
|
|
super.mouseReleased(event);
|
|
return ContainerEventHandler.super.mouseReleased(event);
|
|
}
|
|
|
|
@Override
|
|
public boolean mouseDragged(MouseButtonEvent event, double dx, double dy) {
|
|
super.mouseDragged(event, dx, dy);
|
|
return ContainerEventHandler.super.mouseDragged(event, dx, dy);
|
|
}
|
|
|
|
@Override
|
|
public boolean isFocused() {
|
|
return ContainerEventHandler.super.isFocused();
|
|
}
|
|
|
|
@Override
|
|
public void setFocused(boolean focused) {
|
|
ContainerEventHandler.super.setFocused(focused);
|
|
}
|
|
}
|
|
|