Module technology.sola.engine
Class BaseInputGuiElement<Style extends BaseStyles,ElementType extends GuiElement<Style,ElementType>>
java.lang.Object
technology.sola.engine.graphics.gui.GuiElement<Style,ElementType>
technology.sola.engine.graphics.gui.elements.input.BaseInputGuiElement<Style,ElementType>
- Type Parameters:
Style
- the style typeElementType
- this element's type, so it can be used for method chaining
- Direct Known Subclasses:
ButtonGuiElement
,TextInputGuiElement
@NullMarked
public abstract class BaseInputGuiElement<Style extends BaseStyles,ElementType extends GuiElement<Style,ElementType>>
extends GuiElement<Style,ElementType>
BaseInputGuiElement provides basic functionality for
GuiElement
s that allow users to interact with them via
keyboard or mouse events.-
Field Summary
Fields inherited from class technology.sola.engine.graphics.gui.GuiElement
children, contentBounds, styleContainer
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new BaseInputGuiElement instance registering a mouse event for focussing the element when pressed. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isActive()
The active state is for when an element is being interacted with (space key press or mouse pressed).boolean
A disabled input cannot be focussed, hovered or active.boolean
boolean
setDisabled
(boolean disabled) Updates the disabled state of the input.Methods inherited from class technology.sola.engine.graphics.gui.GuiElement
addStyle, addStyle, addStyles, appendChildren, calculateContentDimensions, events, findElementById, findElementsByType, findFocussedChildIndex, getAssetLoaderProvider, getBounds, getChildren, getContentBounds, getFocusableChildren, getId, getParent, invalidateLayout, isFocussed, isLayoutChanged, removeChild, render, renderChildren, renderContent, requestFocus, setId, styles
-
Constructor Details
-
BaseInputGuiElement
public BaseInputGuiElement()Creates a new BaseInputGuiElement instance registering a mouse event for focussing the element when pressed.
-
-
Method Details
-
isDisabled
public boolean isDisabled()A disabled input cannot be focussed, hovered or active.- Returns:
- true if the input is disabled
-
setDisabled
Updates the disabled state of the input. If the input is currently focussed then focus will return to its parent.- Parameters:
disabled
- the new disabled state- Returns:
- this
-
isFocusable
public boolean isFocusable()- Overrides:
isFocusable
in classGuiElement<Style extends BaseStyles,
ElementType extends GuiElement<Style, ElementType>> - Returns:
- true if the element is currently focusable
-
isHovered
public boolean isHovered()- Overrides:
isHovered
in classGuiElement<Style extends BaseStyles,
ElementType extends GuiElement<Style, ElementType>> - Returns:
- true if the element is currently hovered
-
isActive
public boolean isActive()Description copied from class:GuiElement
The active state is for when an element is being interacted with (space key press or mouse pressed).- Overrides:
isActive
in classGuiElement<Style extends BaseStyles,
ElementType extends GuiElement<Style, ElementType>> - Returns:
- true if element is currently active
-