package de.geolykt.starloader.api.gui.screen; import org.jetbrains.annotations.NotNull; import de.geolykt.starloader.api.gui.Renderable; /** * A graphical component that can be added as a child object of a implementation of the {@link Screen} interface. * Due to how galimulator's component hierarchy works, not everything that looks like a component can be used, though * the SLAPI will lead efforts into making those available via this interface. */ public interface ScreenComponent extends Renderable { /** * Obtains the expected height of this component. * *
Depending on the screen implementation, this method may be called very, very frequently. * To reduce issues with both content within the screen and performance, it is best to implement * this method by returning a final field. * * @return The height of the component */ public int getHeight(); /** * Obtains the line wrapping metadata information that is assigned to this screen. * It should be honoured by the screen implementation unless the screen implementation is * making use of galimulator's dialog API at which time this method will be ignored * due to technical limitations. * * @return The assigned {@link LineWrappingInfo}. */ public @NotNull LineWrappingInfo getLineWrappingInfo(); /** * Obtains the most parent screen that this component belongs to. * As a rule of thumb, this should return the parent screen of the parent * component, unless they are located on two different screens for whatever reason. * * @return The parent screen */ public @NotNull Screen getParentScreen(); /** * Obtains the expected width of this component. * *
Depending on the screen implementation, this method may be called very, very frequently. * To reduce issues with both content within the screen and performance, it is best to implement * this method by returning a final field. * * @return The width of the component */ public int getWidth(); /** * Returns false if the other screen component is of another type as this component, otherwise true. * This is used for the {@link LineWrappingInfo#isWrapDifferentType()} method among other display-related things. * The implementation of this method should follow following guidelines: *