Class Panel
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.gui.components.widgets.panel.Panel
- All Implemented Interfaces:
net.minecraft.client.gui.components.Renderable
- Direct Known Subclasses:
ScrollPanel, ViewportPanel
@Experimental
public abstract class Panel
extends Object
implements net.minecraft.client.gui.components.Renderable
One layer of an
AbstractMultiPanelWidget. Panels are stacked in the order they are added:
the topmost visible panel gets input first, and a modal panel blocks
input to (and dims) the panels below it.
A panel can own plain widgets (buttons, edit boxes...) through addChild(AbstractWidget); they are
drawn after extractContents(GuiGraphicsExtractor, int, int, float) and receive mouse input before the panel itself. Lay them out in
onResized().
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <W extends net.minecraft.client.gui.components.AbstractWidget>
WaddChild(W widget) final voidattach(AbstractMultiPanelWidget owner) Called by the owning widget; a panel belongs to one widget.booleancharTyped(net.minecraft.client.input.CharacterEvent event) protected List<net.minecraft.client.gui.components.AbstractWidget> children()protected abstract voidextractContents(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) Draws the panel's own contents; children are drawn on top afterwards.final voidextractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) final net.minecraft.client.gui.navigation.ScreenRectanglefinal @Nullable AbstractMultiPanelWidgetgetOwner()final booleanisModal()booleanisMouseOver(double mouseX, double mouseY) final booleanbooleankeyPressed(net.minecraft.client.input.KeyEvent event) booleankeyReleased(net.minecraft.client.input.KeyEvent event) booleanmouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick) booleanmouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) voidmouseMoved(double mouseX, double mouseY) booleanmouseReleased(net.minecraft.client.input.MouseButtonEvent event) booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidonHidden()protected voidLay out children here.protected voidonShown()protected voidremoveChild(net.minecraft.client.gui.components.AbstractWidget widget) final voidsetBounds(net.minecraft.client.gui.navigation.ScreenRectangle bounds) Sets the panel's screen-space bounds;onResized()runs only when they change.final PanelsetModal(boolean modal) A modal panel dims the panels below it and swallows input that would reach them.final voidsetVisible(boolean visible)
-
Field Details
-
minecraft
protected final net.minecraft.client.Minecraft minecraft -
font
protected final net.minecraft.client.gui.Font font
-
-
Constructor Details
-
Panel
public Panel()
-
-
Method Details
-
attach
Called by the owning widget; a panel belongs to one widget. -
getOwner
-
getBounds
public final net.minecraft.client.gui.navigation.ScreenRectangle getBounds() -
onResized
protected void onResized()Lay out children here. -
onShown
protected void onShown() -
onHidden
protected void onHidden() -
isVisible
public final boolean isVisible() -
setVisible
public final void setVisible(boolean visible) -
isModal
public final boolean isModal() -
setModal
A modal panel dims the panels below it and swallows input that would reach them. -
addChild
protected <W extends net.minecraft.client.gui.components.AbstractWidget> W addChild(W widget) -
removeChild
protected void removeChild(net.minecraft.client.gui.components.AbstractWidget widget) -
children
-
extractContents
protected abstract void extractContents(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) Draws the panel's own contents; children are drawn on top afterwards. -
extractRenderState
public final void extractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) - Specified by:
extractRenderStatein interfacenet.minecraft.client.gui.components.Renderable
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) -
mouseClicked
public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick) -
mouseReleased
public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent event) -
mouseDragged
public boolean mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) -
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) -
mouseMoved
public void mouseMoved(double mouseX, double mouseY) -
keyPressed
public boolean keyPressed(net.minecraft.client.input.KeyEvent event) -
keyReleased
public boolean keyReleased(net.minecraft.client.input.KeyEvent event) -
charTyped
public boolean charTyped(net.minecraft.client.input.CharacterEvent event)
-