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 renderContents(net.minecraft.client.gui.GuiGraphics, 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(char codePoint, int modifiers) protected List<net.minecraft.client.gui.components.AbstractWidget>children()final net.minecraft.client.gui.navigation.ScreenRectanglefinal @Nullable AbstractMultiPanelWidgetgetOwner()final booleanisModal()booleanisMouseOver(double mouseX, double mouseY) final booleanbooleankeyPressed(int keyCode, int scanCode, int modifiers) booleankeyReleased(int keyCode, int scanCode, int modifiers) booleanmouseClicked(double mouseX, double mouseY, int button) booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) voidmouseMoved(double mouseX, double mouseY) booleanmouseReleased(double mouseX, double mouseY, int button) booleanmouseScrolled(double mouseX, double mouseY, double delta) protected voidonHidden()protected voidLay out children here.protected voidonShown()protected voidremoveChild(net.minecraft.client.gui.components.AbstractWidget widget) final voidrender(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) protected abstract voidrenderContents(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) Draws the panel's own contents; children are drawn on top afterwards.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
-
renderContents
protected abstract void renderContents(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) Draws the panel's own contents; children are drawn on top afterwards. -
render
public final void render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) - Specified by:
renderin interfacenet.minecraft.client.gui.components.Renderable
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) -
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) -
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) -
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) -
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double delta) -
mouseMoved
public void mouseMoved(double mouseX, double mouseY) -
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) -
keyReleased
public boolean keyReleased(int keyCode, int scanCode, int modifiers) -
charTyped
public boolean charTyped(char codePoint, int modifiers)
-