LayoutNodeFocusAdapter¶
class LayoutNodeFocusAdapter(val node: LayoutNode) : GuiEventListener
Bridges one FocusableModifier-carrying LayoutNode into vanilla Minecraft's GuiEventListener focus graph, so vanilla's Tab/Shift-Tab and arrow-key navigation - and anything else that walks GuiEventListener, e.g. Controlify's controller navigation - reaches Compose content the same way it reaches an ordinary AbstractWidget.
ComposeScreen/ComposeContainerScreen rebuild a fresh list of adapters on every children() call, since the LayoutNode tree can change between frames. Vanilla's own ContainerEventHandler.handleTabNavigation looks up the previously-focused GuiEventListener by indexOf in that freshly rebuilt list, so equals/hashCode are keyed on the wrapped node's identity rather than the adapter's - two adapters wrapping the same node must compare equal across separate children() calls, or Tab would never be able to tell "the currently focused thing" apart from "a brand new list entry" and always restart from the beginning.
Constructors¶
LayoutNodeFocusAdapter¶
constructor(node: LayoutNode)
Properties¶
currentFocusPath¶
@get:
Nullable
open val currentFocusPath: ComponentPath?
isFocused¶
node¶
val node: LayoutNode
rectangle¶
open override val rectangle: ScreenRectangle
tabOrderGroup¶
open val tabOrderGroup: Int
Functions¶
charTyped¶
Forwards to node's own OnCharTypedModifier chain - the same one the broadcast char dispatch uses.
equals¶
getRectangle¶
open override fun getRectangle(): ScreenRectangle
hashCode¶
isMouseOver¶
open fun isMouseOver(mouseX: Double, mouseY: Double): Boolean
keyPressed¶
open override fun keyPressed(
keyCode: Int,
scanCode: Int,
modifiers: Int
): Boolean
Forwards to node's own OnKeyEventModifier chain - the same one the broadcast key dispatch uses.
keyReleased¶
open fun keyReleased(
keyCode: Int,
scanCode: Int,
modifiers: Int
): Boolean
mouseClicked¶
open fun mouseClicked(
mouseX: Double,
mouseY: Double,
button: Int
): Boolean
mouseDragged¶
mouseMoved¶
open fun mouseMoved(mouseX: Double, mouseY: Double)
mouseReleased¶
open fun mouseReleased(
mouseX: Double,
mouseY: Double,
button: Int
): Boolean
mouseScrolled¶
nextFocusPath¶
open override fun nextFocusPath(event: FocusNavigationEvent): ComponentPath?
setFocused¶
open override fun setFocused(focused: Boolean)