Class TContextMenu
java.lang.Object
com.thecsdev.common.scene.Node<TElement>
com.thecsdev.commonmc.api.client.gui.TElement
com.thecsdev.commonmc.api.client.gui.ctxmenu.TContextMenu
- All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>
A
TContextMenu is a specialized TElement that represents a context menu
GUI. It is designed to handle focus, input events, and screen management to ensure proper
behavior when interacting with other GUI elements.
This element's parent must be either a TScreen or another TContextMenu.
Attempting to add this element to any other type of parent will throw!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for creating a simpleTContextMenuinstance. -
Field Summary
Fields inherited from class TElement
eInitialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleaninputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull TInputContext context) A callback method that is invoked when the user makes an input.final booleanReturnstrueifTElement.isFocused()or if one thisTElement's children or grandchildrenTElement.isFocused().final booleanReturnstrueifTElement.isHovered()or if one thisTElement's children or grandchildrenTElement.isHovered().voidrenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked when thisNodeis being rendered.protected voidrenderShadow(@NotNull TGuiGraphics pencil) Renders a shadow effect for this context menu.final NotNullProperty<TContextMenu> The top-mostTContextMenuin the hierarchy of thisTElement.final voidSnaps this context menu to be fully visible within the bounds of its parent context menu or viewport.Methods inherited from class TElement
addRel, boundsProperty, clearAndInit, clipsDescendantsProperty, contextMenuProperty, dragEndCallback, dragStartCallback, findElementAt, focusableProperty, focusGainedCallback, focusLostCallback, forEachVisible, getBaseType, getBounds, getClient, getContentBounds, getCursor, getSelf, getTooltip, hoverableProperty, hoverGainedCallback, hoverLostCallback, initCallback, invalidateTooltipCache, isFocusable, isFocused, isHoverable, isHovered, isHoveredOrFocused, isVisible, move, moveChildren, moveTo, postRenderCallback, removeRel, screenProperty, setBounds, setBounds, setBounds, showContextMenu, tickCallback, tooltipProperty, toString, visiblePropertyMethods inherited from class Node
add, addAll, childAddedCallback, childRemovedCallback, clear, contains, containsAll, equals, findChild, findParent, findSibling, forEach, get, getFirst, getLast, getParent, hashCode, indexOf, isEmpty, iterator, parentProperty, remove, remove, remove, removeAll, retainAll, rootProperty, size, toArray, toArray
-
Constructor Details
-
TContextMenu
public TContextMenu()
-
-
Method Details
-
rootContextMenuProperty
The top-mostTContextMenuin the hierarchy of thisTElement. If this element has no parent context menu, this property will reference this element itself.- API Note:
- Owned by
TContextMenu.PropertyAccessor.
-
inputCallback
public final boolean inputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull @NotNull TInputContext context) Description copied from class:TElementA callback method that is invoked when the user makes an input.- Overrides:
inputCallbackin classTElement- Parameters:
phase- The input discovery phase.context- Information about the user's input.- Returns:
trueif thisTElementhandled the input.
-
renderShadow
Renders a shadow effect for this context menu.- Parameters:
pencil- TheTGuiGraphicsinstance used for rendering.
-
renderCallback
Description copied from interface:INodeRenderableCallback method that is invoked when thisNodeis being rendered.- Specified by:
renderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
renderCallbackin classTElement- Parameters:
pencil- The rendering context.
-
isFocusAncestor
public final boolean isFocusAncestor()ReturnstrueifTElement.isFocused()or if one thisTElement's children or grandchildrenTElement.isFocused(). -
isHoverAncestor
public final boolean isHoverAncestor()ReturnstrueifTElement.isHovered()or if one thisTElement's children or grandchildrenTElement.isHovered(). -
snapToParent
public final void snapToParent()Snaps this context menu to be fully visible within the bounds of its parent context menu or viewport.- See Also:
-