Class ScrollPanel

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.gui.components.widgets.panel.Panel
net.ixdarklord.coolcatcanvas.api.client.gui.components.widgets.panel.ScrollPanel
All Implemented Interfaces:
net.minecraft.client.gui.components.Renderable

@Experimental public abstract class ScrollPanel extends Panel
A panel whose contents scroll vertically inside getScrollArea() (by default the whole panel; override it to leave room for a header/footer drawn in extractFrame(GuiGraphicsExtractor, int, int, float)). A thin scrollbar is drawn at the right edge of the scroll area when the content overflows.
  • Field Details

  • Constructor Details

    • ScrollPanel

      public ScrollPanel()
  • Method Details

    • getContentHeight

      protected abstract int getContentHeight()
      Total height of the scrolled content.
    • extractScrolled

      protected abstract void extractScrolled(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int left, int top, int width, int mouseX, int mouseY, float partialTick)
      Draws the scrolled content; top is where content y = 0 lands on screen. Already clipped.
    • extractFrame

      protected void extractFrame(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick)
      Unclipped drawing around the scroll area (background, header, footer).
    • getScrollArea

      protected net.minecraft.client.gui.navigation.ScreenRectangle getScrollArea()
    • setScrollStep

      public ScrollPanel setScrollStep(int step)
    • setScrollbarColors

      public ScrollPanel setScrollbarColors(int bar, int track)
    • getScroll

      public double getScroll()
    • setScroll

      public void setScroll(double scroll)
    • getMaxScroll

      public int getMaxScroll()
    • canScroll

      public boolean canScroll()
    • getContentWidth

      protected int getContentWidth()
      Width available to content. Room for the scrollbar is always reserved: whether it shows depends on the content height, which usually depends on this width.
    • extractContents

      protected void extractContents(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick)
      Description copied from class: Panel
      Draws the panel's own contents; children are drawn on top afterwards.
      Specified by:
      extractContents in class Panel
    • isInScrollArea

      protected boolean isInScrollArea(double mouseX, double mouseY)
      Whether a screen position is inside the (visible part of the) scroll area.
    • mouseClicked

      public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick)
      Overrides:
      mouseClicked in class Panel
    • mouseDragged

      public boolean mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY)
      Overrides:
      mouseDragged in class Panel
    • mouseReleased

      public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent event)
      Overrides:
      mouseReleased in class Panel
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
      Overrides:
      mouseScrolled in class Panel
    • onHidden

      protected void onHidden()
      Overrides:
      onHidden in class Panel