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
    Modifier and Type
    Field
    Description
    protected final net.minecraft.client.gui.Font
     
    protected final net.minecraft.client.Minecraft
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <W extends net.minecraft.client.gui.components.AbstractWidget>
    W
    addChild(W widget)
     
    final void
    Called by the owning widget; a panel belongs to one widget.
    boolean
    charTyped(net.minecraft.client.input.CharacterEvent event)
     
    protected List<net.minecraft.client.gui.components.AbstractWidget>
     
    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.
    final void
    extractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick)
     
    final net.minecraft.client.gui.navigation.ScreenRectangle
     
    final @Nullable AbstractMultiPanelWidget
     
    final boolean
     
    boolean
    isMouseOver(double mouseX, double mouseY)
     
    final boolean
     
    boolean
    keyPressed(net.minecraft.client.input.KeyEvent event)
     
    boolean
    keyReleased(net.minecraft.client.input.KeyEvent event)
     
    boolean
    mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick)
     
    boolean
    mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY)
     
    void
    mouseMoved(double mouseX, double mouseY)
     
    boolean
    mouseReleased(net.minecraft.client.input.MouseButtonEvent event)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
     
    protected void
     
    protected void
    Lay out children here.
    protected void
     
    protected void
    removeChild(net.minecraft.client.gui.components.AbstractWidget widget)
     
    final void
    setBounds(net.minecraft.client.gui.navigation.ScreenRectangle bounds)
    Sets the panel's screen-space bounds; onResized() runs only when they change.
    final Panel
    setModal(boolean modal)
    A modal panel dims the panels below it and swallows input that would reach them.
    final void
    setVisible(boolean visible)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      @Internal public final void attach(AbstractMultiPanelWidget owner)
      Called by the owning widget; a panel belongs to one widget.
    • getOwner

      @Nullable public final @Nullable AbstractMultiPanelWidget getOwner()
    • setBounds

      public final void setBounds(net.minecraft.client.gui.navigation.ScreenRectangle bounds)
      Sets the panel's screen-space bounds; onResized() runs only when they change.
    • 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

      public final Panel setModal(boolean modal)
      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

      protected List<net.minecraft.client.gui.components.AbstractWidget> 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:
      extractRenderState in interface net.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)