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
GuiElements 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 TypeMethodDescriptionbooleanisActive()The active state is for when an element is being interacted with (space key press or mouse pressed).booleanA disabled input cannot be focused, hovered or active.booleanbooleansetDisabled(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, getContentBounds, getFocusableChildren, getId, getParent, invalidateLayout, isAttached, isFocussed, isLayoutChanged, removeChild, render, renderChildren, renderContent, requestFocus, self, setId, setVirtualKeyboardVisible, 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 focused, hovered or active.- Returns:
- true if the input is disabled
-
setDisabled
Updates the disabled state of the input. If the input is currently focused, then focus will return to its parent.- Parameters:
disabled- the new disabled state- Returns:
- this
-
isFocusable
public boolean isFocusable()- Overrides:
isFocusablein classGuiElement<Style extends BaseStyles,ElementType extends GuiElement<Style, ElementType>> - Returns:
- true if the element is currently focusable
-
isHovered
public boolean isHovered()- Overrides:
isHoveredin 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:GuiElementThe active state is for when an element is being interacted with (space key press or mouse pressed).- Overrides:
isActivein classGuiElement<Style extends BaseStyles,ElementType extends GuiElement<Style, ElementType>> - Returns:
- true if this element is currently active
-