java.lang.Object
technology.sola.engine.graphics.gui.GuiDocument
GuiDocument is a container for
GuiElement that also handles passing various key and mouse events to the
currently active root element set via setRootElement(GuiElement).-
Constructor Summary
ConstructorsConstructorDescriptionGuiDocument(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse-related events. -
Method Summary
Modifier and TypeMethodDescription<T extends GuiElement<?,?>>
@Nullable TfindElementById(String id, Class<T> elementClass) Searches the document for aGuiElementwith the desired id.booleanisFocussed(GuiElement<?, ?> guiElement) Checks to see if aGuiElementcurrently has focus.booleanvoidRenders the root element to theRenderer.voidrequestFocus(GuiElement<?, ?> guiElement) Gives the desiredGuiElementfocus.voidsetRootElement(GuiElement<?, ?> rootEle) Sets the current root element used for rendering and receiving events to the desiredGuiElement.voidsetVirtualKeyboardVisible(boolean visible) Sets the visibility of the virtual keyboard.voidsetVisible(boolean isVisible) Sets whether theGuiDocumentwill render or not.voidupdate()Updates the GuiDocument's layout state.
-
Constructor Details
-
GuiDocument
public GuiDocument(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse-related events.- Parameters:
platform- theSolaPlatformassetLoaderProvider- theAssetLoaderProvidermouseInput- theMouseInput
-
-
Method Details
-
isVisible
public boolean isVisible()- Returns:
- Whether the
GuiDocumentwill render or not
-
setVisible
public void setVisible(boolean isVisible) Sets whether theGuiDocumentwill render or not.- Parameters:
isVisible- the new visible state
-
setRootElement
Sets the current root element used for rendering and receiving events to the desiredGuiElement. Also updates the currently focused element.- Parameters:
rootEle- the new root element
-
findElementById
Searches the document for aGuiElementwith the desired id.- Type Parameters:
T- the type of the element- Parameters:
id- the id of the elementelementClass- the class of the element- Returns:
- the element
-
isFocussed
Checks to see if aGuiElementcurrently has focus.- Parameters:
guiElement- the element to check- Returns:
- true if the element is currently focussed
-
requestFocus
Gives the desiredGuiElementfocus.- Parameters:
guiElement- the new element to be focussed
-
setVirtualKeyboardVisible
public void setVirtualKeyboardVisible(boolean visible) Sets the visibility of the virtual keyboard.- Parameters:
visible- whether the virtual keyboard should be visible or not
-
update
public void update()Updates the GuiDocument's layout state. This is usually called viaGuiDocumentSystemand should not be called manually. -
render
Renders the root element to theRenderer.- Parameters:
renderer- the renderer
-