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
A panel whose contents scroll vertically inside
getScrollArea() (by default the whole panel;
override it to leave room for a header/footer drawn in renderFrame(net.minecraft.client.gui.GuiGraphics, int, int, float)).
A thin scrollbar is drawn at the right edge of the scroll area when the content overflows.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected abstract intTotal height of the scrolled content.protected intWidth available to content.intdoubleprotected net.minecraft.client.gui.navigation.ScreenRectangleprotected booleanisInScrollArea(double mouseX, double mouseY) Whether a screen position is inside the (visible part of the) scroll area.booleanmouseClicked(double mouseX, double mouseY, int button) booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) booleanmouseReleased(double mouseX, double mouseY, int button) booleanmouseScrolled(double mouseX, double mouseY, double delta) protected voidonHidden()protected 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.protected voidrenderFrame(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) Unclipped drawing around the scroll area (background, header, footer).protected abstract voidrenderScrolled(net.minecraft.client.gui.GuiGraphics graphics, int left, int top, int width, int mouseX, int mouseY, float partialTick) Draws the scrolled content;topis where content y = 0 lands on screen.voidsetScroll(double scroll) setScrollbarColors(int bar, int track) setScrollStep(int step) Methods inherited from class net.ixdarklord.coolcatcanvas.api.client.gui.components.widgets.panel.Panel
addChild, attach, charTyped, children, getBounds, getOwner, isModal, isMouseOver, isVisible, keyPressed, keyReleased, mouseMoved, onResized, onShown, removeChild, render, setBounds, setModal, setVisible
-
Field Details
-
SCROLLBAR_WIDTH
protected static final int SCROLLBAR_WIDTH- See Also:
-
-
Constructor Details
-
ScrollPanel
public ScrollPanel()
-
-
Method Details
-
getContentHeight
protected abstract int getContentHeight()Total height of the scrolled content. -
renderScrolled
protected abstract void renderScrolled(net.minecraft.client.gui.GuiGraphics graphics, int left, int top, int width, int mouseX, int mouseY, float partialTick) Draws the scrolled content;topis where content y = 0 lands on screen. Already clipped. -
renderFrame
protected void renderFrame(net.minecraft.client.gui.GuiGraphics 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
-
setScrollbarColors
-
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. -
renderContents
protected void renderContents(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick) Description copied from class:PanelDraws the panel's own contents; children are drawn on top afterwards.- Specified by:
renderContentsin classPanel
-
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(double mouseX, double mouseY, int button) - Overrides:
mouseClickedin classPanel
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) - Overrides:
mouseDraggedin classPanel
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) - Overrides:
mouseReleasedin classPanel
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double delta) - Overrides:
mouseScrolledin classPanel
-
onHidden
protected void onHidden()
-