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 extractFrame(GuiGraphicsExtractor, 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 voidextractContents(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) Draws the panel's own contents; children are drawn on top afterwards.protected voidextractFrame(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) Unclipped drawing around the scroll area (background, header, footer).protected abstract voidextractScrolled(net.minecraft.client.gui.GuiGraphicsExtractor 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.protected 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(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick) booleanmouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) booleanmouseReleased(net.minecraft.client.input.MouseButtonEvent event) booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidonHidden()voidsetScroll(double scroll) setScrollbarColors(int bar, int track) setScrollStep(int step) Methods inherited from class Panel
addChild, attach, charTyped, children, extractRenderState, getBounds, getOwner, isModal, isMouseOver, isVisible, keyPressed, keyReleased, mouseMoved, onResized, onShown, removeChild, 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. -
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;topis 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
-
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. -
extractContents
protected void extractContents(net.minecraft.client.gui.GuiGraphicsExtractor 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:
extractContentsin 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(net.minecraft.client.input.MouseButtonEvent event, boolean doubleClick) - Overrides:
mouseClickedin classPanel
-
mouseDragged
public boolean mouseDragged(net.minecraft.client.input.MouseButtonEvent event, double dragX, double dragY) - Overrides:
mouseDraggedin classPanel
-
mouseReleased
public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent event) - Overrides:
mouseReleasedin classPanel
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) - Overrides:
mouseScrolledin classPanel
-
onHidden
-