Class ScrollPanel

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Widget, NarratableEntry, NarrationSupplier
Direct Known Subclasses:
ModListScreen.InfoPanel

public abstract class ScrollPanel extends AbstractContainerEventHandler implements Widget, NarratableEntry
Abstract scroll panel class.
  • Field Details

    • client

      private final Minecraft client
    • width

      protected final int width
    • height

      protected final int height
    • top

      protected final int top
    • bottom

      protected final int bottom
    • left

      protected final int left
    • scrolling

      private boolean scrolling
    • scrollDistance

      protected float scrollDistance
    • captureMouse

      protected boolean captureMouse
    • border

      protected final int border
    • barWidth

      private final int barWidth
    • barLeft

      private final int barLeft
    • bgColorFrom

      private final int bgColorFrom
    • bgColorTo

      private final int bgColorTo
    • barBgColor

      private final int barBgColor
    • barColor

      private final int barColor
    • barBorderColor

      private final int barBorderColor
  • Constructor Details

    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColor)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
      bgColor - the color for the background
    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
      bgColorFrom - the start color for the background gradient
      bgColorTo - the end color for the background gradient
    • ScrollPanel

      public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo, int barBgColor, int barColor, int barBorderColor)
      Base constructor
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
      bgColorFrom - the start color for the background gradient
      bgColorTo - the end color for the background gradient
      barBgColor - the color for the scroll bar background
      barColor - the color for the scroll bar handle
      barBorderColor - the border color for the scroll bar handle
  • Method Details

    • getContentHeight

      protected abstract int getContentHeight()
    • drawBackground

      protected void drawBackground()
    • drawBackground

      protected void drawBackground(PoseStack matrix, Tesselator tess, float partialTicks)
      Draws the background of the scroll panel. This runs AFTER Scissors are enabled.
    • drawPanel

      protected abstract void drawPanel(PoseStack mStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY)
      Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled for anything that is rendered outside the view box. Do not mess with Scissor unless you support this.
    • clickPanel

      protected boolean clickPanel(double mouseX, double mouseY, int button)
    • getMaxScroll

      private int getMaxScroll()
    • applyScrollLimits

      private void applyScrollLimits()
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scroll)
      Specified by:
      mouseScrolled in interface ContainerEventHandler
      Specified by:
      mouseScrolled in interface GuiEventListener
    • getScrollAmount

      protected int getScrollAmount()
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
      Specified by:
      isMouseOver in interface GuiEventListener
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface ContainerEventHandler
      Specified by:
      mouseClicked in interface GuiEventListener
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
      Specified by:
      mouseReleased in interface ContainerEventHandler
      Specified by:
      mouseReleased in interface GuiEventListener
    • getBarHeight

      private int getBarHeight()
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
      Specified by:
      mouseDragged in interface ContainerEventHandler
      Specified by:
      mouseDragged in interface GuiEventListener
    • render

      public void render(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
      Specified by:
      render in interface Widget
    • drawGradientRect

      protected void drawGradientRect(PoseStack mStack, int left, int top, int right, int bottom, int color1, int color2)
    • children

      public List<? extends GuiEventListener> children()
      Specified by:
      children in interface ContainerEventHandler