Class OUI
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Item states as returned byGetState
.static final int
Enum values:static final int
Child layout flags to pass toSetLayout
.static final int
Event flags.static final int
Event flags.static final int
Event flags.static final int
Event flags.static final int
Event flags.static final int
Child layout flags to pass toSetLayout
.static final int
Event flags.static final int
Item states as returned byGetState
.static final int
Container flags to pass toSetBox
.static final int
Child layout flags to pass toSetLayout
.static final int
Container flags to pass toSetBox
.static final int
Child layout flags to pass toSetLayout
.static final int
Container flags to pass toSetBox
.static final int
Item states as returned byGetState
.static final int
Child layout flags to pass toSetLayout
.static final int
Child layout flags to pass toSetLayout
.static final int
Item states as returned byGetState
.static final int
Container flags to pass toSetBox
.static final int
Event flags.static final int
Event flags.static final int
Container flags to pass toSetBox
.static final int
Child layout flags to pass toSetLayout
.static final int
Container flags to pass toSetBox
.static final int
Container flags to pass toSetBox
.static final int
Child layout flags to pass toSetLayout
.static final int
Container flags to pass toSetBox
.static final int
Event flags.static final int
Container flags to pass toSetBox
.static final int
Child layout flags to pass toSetLayout
.static final int
Enum values:static final int
Child layout flags to pass toSetLayout
.static final int
Child layout flags to pass toSetLayout
.static final int
Container flags to pass toSetBox
. -
Method Summary
Modifier and TypeMethodDescriptionstatic long
nuiAllocHandle
(int item, int size) Unsafe version of:AllocHandle
static int
nuiContains
(int item, int x, int y) Unsafe version of:Contains
static void
nuiDestroyContext
(long ctx) Unsafe version of:DestroyContext
static int
nuiGetButton
(int button) Unsafe version of:GetButton
static void
nuiGetCursor
(long __result) Unsafe version of:GetCursor
static void
nuiGetCursorDelta
(long __result) Unsafe version of:GetCursorDelta
static void
nuiGetCursorStart
(long __result) Unsafe version of:GetCursorStart
static void
nuiGetCursorStartDelta
(long __result) Unsafe version of:GetCursorStartDelta
static long
Unsafe version of:GetHandler
static void
nuiGetRect
(int item, long __result) Unsafe version of:GetRect
static void
nuiGetScroll
(long __result) Unsafe version of:GetScroll
static void
nuiSetButton
(int button, int mod, int enabled) Unsafe version of:SetButton
static void
nuiSetFrozen
(int item, int enable) Unsafe version of:SetFrozen
static void
nuiSetHandler
(long handler) Unsafe version of:SetHandler
static void
nuiSetKey
(int key, int mod, int enabled) Unsafe version of:SetKey
static void
nuiSetMargins
(int item, short l, short t, short r, short b) Unsafe version of:SetMargins
static ByteBuffer
uiAllocHandle
(int item, int size) Allocates space for application-dependent context data and assign it as the handle to the item.static int
uiAppend
(int item, int sibling) Assigns an item to the same container as another item.static void
Clears the item buffer.static void
Resets the currently stored hot/active etc.static boolean
uiContains
(int item, int x, int y) Returns 1 if an items absolute rectangle contains a given coordinate, otherwise 0.static long
uiCreateContext
(int item_capacity, int buffer_capacity) Creates a new UI context; callMakeCurrent
to make this context the current context.static void
uiDestroyContext
(long ctx) Releases the memory of an UI context created withCreateContext
; if the context is the current context, the current context will be set toNULL
.static void
Layout all added items starting from the root item 0.static int
uiFindItem
(int item, int x, int y, int flags, int mask) Returns the topmost item containing absolute location(x,y)
, starting withitem
as parent, using a set of flags and masks as filter.static int
uiFirstChild
(int item) Returns the first child item of a container item.static void
uiFocus
(int item) Sets item as recipient of all keyboard events.static int
Returns the total bytes that have been allocated byAllocHandle
static int
uiGetBox
(int item) Returns the box model as set bySetBox
.static boolean
uiGetButton
(int button) Returns the current state of an application dependent input button as set bySetButton
.static int
Returns the number of chained clicks; 1 is a single click, 2 is a double click, etc.static long
Returns the currently selected context orNULL
.static UIVec2
uiGetCursor
(UIVec2 __result) Returns the current cursor position in screen coordinates as set bySetCursor
.static UIVec2
uiGetCursorDelta
(UIVec2 __result) Returns the offset of the cursor relative to the last call toProcess
.static UIVec2
uiGetCursorStart
(UIVec2 __result) Returns the beginning point of a drag operation.static UIVec2
uiGetCursorStartDelta
(UIVec2 __result) Returns the offset of the cursor relative to the beginning point of a drag operation.static int
uiGetEvents
(int item) Returns the event flags for an item as passed toSetEvents
static int
uiGetFlags
(int item) Returns the user-defined flags for an item as passed toSetFlags
static int
Returns the item that is currently focused or -1 for none.static long
uiGetHandle
(int item) Returns the application-dependent handle of the item as passed toSetHandle
orAllocHandle
.static UIHandler
Returns the handler callback as passed toSetHandler
static int
uiGetHeight
(int item) Return the height of the item as set bySetSize
.static int
Returns the item that is currently under the cursor or -1 for none.static int
Returns the total number of allocated itemsstatic int
uiGetKey()
When handling aKEY_DOWN/KEY_UP
event: the key that triggered this event.static int
Returns the number if items that have been allocated in the last frame.static int
uiGetLayout
(int item) Returns the anchoring behavior as set bySetLayout
.static short
uiGetMarginDown
(int item) Returns the bottom margin of the item as set withSetMargins
.static short
uiGetMarginLeft
(int item) Returns the left margin of the item as set withSetMargins
.static short
uiGetMarginRight
(int item) Returns the right margin of the item as set withSetMargins
.static short
uiGetMarginTop
(int item) Returns the top margin of the item as set withSetMargins
.static int
When handling a keyboard or mouse event: the active modifier keys.static UIRect
Returns the items layout rectangle in absolute coordinates.static UIVec2
uiGetScroll
(UIVec2 __result) Returns the currently accumulated scroll wheel offsets for this framestatic int
uiGetState
(int item) Returns the current state of the item.static int
uiGetWidth
(int item) Returns the width of the item as set bySetSize
.static int
uiInsert
(int item, int child) Assigns an item to a container.static int
uiInsertBack
(int item, int child) Inserts child into container item likeInsert
, but prepend it to the first child item, effectively putting it in the background.static int
uiInsertFront
(int item, int child) Same asInsert
.static int
uiItem()
Creates a new UI item and return the new item's ID.static void
uiMakeCurrent
(long ctx) Selects an UI context as the current context; a context must always be selected before using any of the other UI functions.static int
uiNextSibling
(int item) Returns an items next sibling in the list of the parent containers children.static void
uiProcess
(int timestamp) Updates the internal state according to the current cursor position and button states, and call all registered handlers.static int
uiRecoverItem
(int olditem) WhenBeginLayout
is called, the most recently declared items are retained.static void
uiRemapItem
(int olditem, int newitem) In cases where it is important to recover old state over changes in the view, and the built-in remapping fails, the UI declaration can manually remap old items to new IDs in cases where e.g.static void
uiSetBox
(int item, int flags) Sets the box model behavior of the item to one or multipleUIboxFlags
.static void
uiSetButton
(int button, int mod, boolean enabled) Sets a mouse or gamepad button as pressed/released button is in the range0..63
and maps to an application defined input source.static void
uiSetChar
(int value) Sends a single character for text input; the character is usually in the unicode range, but can be application defined.static void
uiSetCursor
(int x, int y) Sets the current cursor position (usually belonging to a mouse) to the screen coordinates at(x,y)
.static void
uiSetEvents
(int item, int flags) static void
uiSetFlags
(int item, int flags) static void
uiSetFrozen
(int item, boolean enable) Sets an items state to frozen.static void
uiSetHandle
(int item, long handle) Sets the application-dependent handle of an item.static void
uiSetHandler
(UIHandlerI handler) Sets the global handler callback for interactive items.static void
uiSetKey
(int key, int mod, boolean enabled) Sets a key as down/up; the key can be any application definedkeycode
.static void
uiSetLayout
(int item, int flags) Sets the anchoring behavior of the item to one or multipleUIlayoutFlags
.static void
uiSetMargins
(int item, int l, int t, int r, int b) Sets the left, top, right and bottom margins of an item.static void
uiSetScroll
(int x, int y) Accumulates scroll wheel offsets for the current frame.static void
uiSetSize
(int item, int w, int h) Sets the size of the item.static void
Updates the current hot item; this only needs to be called if items are kept for more than one frame andEndLayout
is not called.
-
Field Details
-
UI_USERMASK
public static final int UI_USERMASKEnum values:
- See Also:
-
UI_ANY
public static final int UI_ANYEnum values:
- See Also:
-
UI_COLD
public static final int UI_COLD- See Also:
-
UI_HOT
public static final int UI_HOT- See Also:
-
UI_ACTIVE
public static final int UI_ACTIVE- See Also:
-
UI_FROZEN
public static final int UI_FROZEN- See Also:
-
UI_ROW
public static final int UI_ROWContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_COLUMN
public static final int UI_COLUMNContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_LAYOUT
public static final int UI_LAYOUTContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_FLEX
public static final int UI_FLEXContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_NOWRAP
public static final int UI_NOWRAPContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_WRAP
public static final int UI_WRAPContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_START
public static final int UI_STARTContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_MIDDLE
public static final int UI_MIDDLEContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_END
public static final int UI_ENDContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_JUSTIFY
public static final int UI_JUSTIFYContainer flags to pass toSetBox
. (UIboxFlags
)Enum values:
ROW
- left to rightCOLUMN
- top to bottomLAYOUT
- free layoutFLEX
- flex modelNOWRAP
- single-lineWRAP
- multi-line, wrap left to rightSTART
- justify-content (start, end, center, space-between) at start of row/columnMIDDLE
- at center of row/columnEND
- at end of row/columnJUSTIFY
- insert spacing to stretch across whole row/column
- See Also:
-
UI_LEFT
public static final int UI_LEFTChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_TOP
public static final int UI_TOPChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_RIGHT
public static final int UI_RIGHTChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_DOWN
public static final int UI_DOWNChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_HFILL
public static final int UI_HFILLChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_VFILL
public static final int UI_VFILLChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_HCENTER
public static final int UI_HCENTERChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_VCENTER
public static final int UI_VCENTERChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_CENTER
public static final int UI_CENTERChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_FILL
public static final int UI_FILLChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_BREAK
public static final int UI_BREAKChild layout flags to pass toSetLayout
. (UIlayoutFlags
)Enum values:
LEFT
- anchor to left item or left side of parentTOP
- anchor to top item or top side of parentRIGHT
- anchor to right item or right side of parentDOWN
- anchor to bottom item or bottom side of parentHFILL
- anchor to both left and right item or parent bordersVFILL
- anchor to both top and bottom item or parent bordersHCENTER
- center horizontally, with left margin as offsetVCENTER
- center vertically, with top margin as offsetCENTER
- center in both directions, with left/top margin as offsetFILL
- anchor to all four directionsBREAK
- when wrapping, put this element on a new line.Wrapping layout code auto-inserts
UI_BREAK
flags, drawing routines can read them withGetLayout
.
- See Also:
-
UI_BUTTON0_DOWN
public static final int UI_BUTTON0_DOWNEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_BUTTON0_UP
public static final int UI_BUTTON0_UPEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_BUTTON0_HOT_UP
public static final int UI_BUTTON0_HOT_UPEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_BUTTON0_CAPTURE
public static final int UI_BUTTON0_CAPTUREEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_BUTTON2_DOWN
public static final int UI_BUTTON2_DOWNEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_SCROLL
public static final int UI_SCROLLEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_KEY_DOWN
public static final int UI_KEY_DOWNEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_KEY_UP
public static final int UI_KEY_UPEvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
UI_CHAR
public static final int UI_CHAREvent flags. (UIevent
)Enum values:
BUTTON0_DOWN
- on button 0 downBUTTON0_UP
- on button 0 up when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON0_HOT_UP
- on button 0 up while item is hovered when this event has a handler,GetState
will returnACTIVE
when the cursor is hovering the items rectangle; this is the behavior expected for buttonsBUTTON0_CAPTURE
- item is being captured (button 0 constantly pressed); when this event has a handler,GetState
will returnACTIVE
as long as button 0 is downBUTTON2_DOWN
- on button 2 down (right mouse button, usually triggers context menu)SCROLL
- item has received a scrollwheel event the accumulated wheel offset can be queried withGetScroll
KEY_DOWN
- item is focused and has received a key-down event the respective key can be queried usingGetKey
andGetModifier
KEY_UP
- item is focused and has received a key-up event the respective key can be queried usingGetKey
andGetModifier
CHAR
- item is focused and has received a character event the respective character can be queried usingGetKey
- See Also:
-
-
Method Details
-
uiCreateContext
public static long uiCreateContext(int item_capacity, int buffer_capacity) Creates a new UI context; callMakeCurrent
to make this context the current context.The context is managed by the client and must be released using
DestroyContext
.- Parameters:
item_capacity
- the maximum number of items that can be declared. 4096 is a good starting value.buffer_capacity
- the maximum total size of bytes that can be allocated usingAllocHandle
; you may pass 0 if you don't need to allocate handles.(1<<20)
is a good starting value.
-
uiMakeCurrent
public static void uiMakeCurrent(long ctx) Selects an UI context as the current context; a context must always be selected before using any of the other UI functions. -
nuiDestroyContext
public static void nuiDestroyContext(long ctx) Unsafe version of:DestroyContext
-
uiDestroyContext
public static void uiDestroyContext(long ctx) Releases the memory of an UI context created withCreateContext
; if the context is the current context, the current context will be set toNULL
. -
uiGetContext
public static long uiGetContext()Returns the currently selected context orNULL
. -
uiSetCursor
public static void uiSetCursor(int x, int y) Sets the current cursor position (usually belonging to a mouse) to the screen coordinates at(x,y)
. -
nuiGetCursor
public static void nuiGetCursor(long __result) Unsafe version of:GetCursor
-
uiGetCursor
Returns the current cursor position in screen coordinates as set bySetCursor
. -
nuiGetCursorDelta
public static void nuiGetCursorDelta(long __result) Unsafe version of:GetCursorDelta
-
uiGetCursorDelta
Returns the offset of the cursor relative to the last call toProcess
. -
nuiGetCursorStart
public static void nuiGetCursorStart(long __result) Unsafe version of:GetCursorStart
-
uiGetCursorStart
Returns the beginning point of a drag operation. -
nuiGetCursorStartDelta
public static void nuiGetCursorStartDelta(long __result) Unsafe version of:GetCursorStartDelta
-
uiGetCursorStartDelta
Returns the offset of the cursor relative to the beginning point of a drag operation. -
nuiSetButton
public static void nuiSetButton(int button, int mod, int enabled) Unsafe version of:SetButton
-
uiSetButton
public static void uiSetButton(int button, int mod, boolean enabled) Sets a mouse or gamepad button as pressed/released button is in the range0..63
and maps to an application defined input source.- Parameters:
mod
- an application defined set of flags for modifier keysenabled
- is 1 for pressed, 0 for released
-
nuiGetButton
public static int nuiGetButton(int button) Unsafe version of:GetButton
-
uiGetButton
public static boolean uiGetButton(int button) Returns the current state of an application dependent input button as set bySetButton
.- Returns:
- 1 if the button has been set to pressed, 0 for released
-
uiGetClicks
public static int uiGetClicks()Returns the number of chained clicks; 1 is a single click, 2 is a double click, etc. -
nuiSetKey
public static void nuiSetKey(int key, int mod, int enabled) Unsafe version of:SetKey
-
uiSetKey
public static void uiSetKey(int key, int mod, boolean enabled) Sets a key as down/up; the key can be any application definedkeycode
.All key events are being buffered until the next call to
Process
.- Parameters:
mod
- an application defined set of flags for modifier keysenabled
- 1 for key down, 0 for key up
-
uiSetChar
public static void uiSetChar(int value) Sends a single character for text input; the character is usually in the unicode range, but can be application defined.All char events are being buffered until the next call to
Process
. -
uiSetScroll
public static void uiSetScroll(int x, int y) Accumulates scroll wheel offsets for the current frame.All offsets are being accumulated until the next call to
Process
. -
nuiGetScroll
public static void nuiGetScroll(long __result) Unsafe version of:GetScroll
-
uiGetScroll
Returns the currently accumulated scroll wheel offsets for this frame -
uiBeginLayout
public static void uiBeginLayout()Clears the item buffer.uiBeginLayout()
should be called before the first UI declaration for this frame to avoid concatenation of the same UI multiple times. After the call, all previously declared item IDs are invalid, and all application dependent context data has been freed.uiBeginLayout()
must be followed byEndLayout
. -
uiEndLayout
public static void uiEndLayout()Layout all added items starting from the root item 0.After calling
uiEndLayout()
, no further modifications to the item tree should be done until the next call toBeginLayout
. It is safe to immediately draw the items after a call touiEndLayout()
.This is an
O(N)
operation forN = number of declared items
. -
uiUpdateHotItem
public static void uiUpdateHotItem()Updates the current hot item; this only needs to be called if items are kept for more than one frame andEndLayout
is not called. -
uiProcess
public static void uiProcess(int timestamp) Updates the internal state according to the current cursor position and button states, and call all registered handlers.No further modifications to the item tree should be done until the next call to
BeginLayout
. Items should be drawn before a call touiProcess()
.This is an
O(N)
operation forN = number of declared items
.- Parameters:
timestamp
- the time in milliseconds relative to the last call touiProcess()
and is used to estimate the threshold for double-clicks after callinguiProcess()
.
-
uiClearState
public static void uiClearState()Resets the currently stored hot/active etc. handles.This should be called when a re-declaration of the UI changes the item indices, to avoid state related glitches because item identities have changed.
-
uiItem
public static int uiItem()Creates a new UI item and return the new item's ID. -
nuiSetFrozen
public static void nuiSetFrozen(int item, int enable) Unsafe version of:SetFrozen
-
uiSetFrozen
public static void uiSetFrozen(int item, boolean enable) Sets an items state to frozen.The UI will not recurse into frozen items when searching for hot or active items; subsequently, frozen items and their child items will not cause mouse event notifications. The frozen state is not applied recursively;
GetState
will reportCOLD
for child items. Upon encountering a frozen item, the drawing routine needs to handle rendering of child items appropriately. -
uiSetHandle
public static void uiSetHandle(int item, long handle) Sets the application-dependent handle of an item.- Parameters:
handle
- an application defined 64-bit handle. IfNULL
, the item will not be interactive.
-
nuiAllocHandle
public static long nuiAllocHandle(int item, int size) Unsafe version of:AllocHandle
-
uiAllocHandle
Allocates space for application-dependent context data and assign it as the handle to the item.The memory of the pointer is managed by the UI context and released upon the next call to
BeginLayout
. -
nuiSetHandler
public static void nuiSetHandler(long handler) Unsafe version of:SetHandler
-
uiSetHandler
Sets the global handler callback for interactive items.The handler will be called for each item whose event flags are set using
SetEvents
. -
uiSetEvents
public static void uiSetEvents(int item, int flags) - Parameters:
flags
- designates for which events the handler should be called. One or more of:BUTTON0_DOWN
BUTTON0_UP
BUTTON0_HOT_UP
BUTTON0_CAPTURE
BUTTON2_DOWN
SCROLL
KEY_DOWN
KEY_UP
CHAR
-
uiSetFlags
public static void uiSetFlags(int item, int flags) - Parameters:
flags
- a user-defined set of flags defined byUSERMASK
-
uiInsert
public static int uiInsert(int item, int child) Assigns an item to a container.An item ID of 0 refers to the root item. The function searches for the last item and calls
Append
on it, which is anO(N)
operation forN
siblings. It is usually more efficient to calluiInser
t() for the first child, then chain additional siblings usinguiAppend()
.- Returns:
- the child item ID if the container has already added items
-
uiAppend
public static int uiAppend(int item, int sibling) Assigns an item to the same container as another item.- Parameters:
sibling
- inserted afteritem
-
uiInsertBack
public static int uiInsertBack(int item, int child) Inserts child into container item likeInsert
, but prepend it to the first child item, effectively putting it in the background.It is efficient to call
uiInsertBack()
repeatedly in cases where drawing or layout order doesn't matter. -
uiInsertFront
public static int uiInsertFront(int item, int child) Same asInsert
. -
uiSetSize
public static void uiSetSize(int item, int w, int h) Sets the size of the item.A size of 0 indicates the dimension to be dynamic; if the size is set, the item can not expand beyond that size.
-
uiSetLayout
public static void uiSetLayout(int item, int flags) Sets the anchoring behavior of the item to one or multipleUIlayoutFlags
. -
uiSetBox
public static void uiSetBox(int item, int flags) Sets the box model behavior of the item to one or multipleUIboxFlags
. -
nuiSetMargins
public static void nuiSetMargins(int item, short l, short t, short r, short b) Unsafe version of:SetMargins
-
uiSetMargins
public static void uiSetMargins(int item, int l, int t, int r, int b) Sets the left, top, right and bottom margins of an item.When the item is anchored to the parent or another item, the margin controls the distance from the neighboring element.
-
uiFocus
public static void uiFocus(int item) Sets item as recipient of all keyboard events.- Parameters:
item
- if -1, no item will be focused
-
uiFirstChild
public static int uiFirstChild(int item) Returns the first child item of a container item.If the item is not a container or does not contain any items, -1 is returned.
- Parameters:
item
- if 0, the first child item of the root item will be returned
-
uiNextSibling
public static int uiNextSibling(int item) Returns an items next sibling in the list of the parent containers children.If
item
is 0 or the item is the last child item, -1 will be returned. -
uiGetItemCount
public static int uiGetItemCount()Returns the total number of allocated items -
uiGetAllocSize
public static int uiGetAllocSize()Returns the total bytes that have been allocated byAllocHandle
-
uiGetState
public static int uiGetState(int item) -
uiGetHandle
public static long uiGetHandle(int item) Returns the application-dependent handle of the item as passed toSetHandle
orAllocHandle
. -
uiGetHotItem
public static int uiGetHotItem()Returns the item that is currently under the cursor or -1 for none. -
uiGetFocusedItem
public static int uiGetFocusedItem()Returns the item that is currently focused or -1 for none. -
uiFindItem
public static int uiFindItem(int item, int x, int y, int flags, int mask) Returns the topmost item containing absolute location(x,y)
, starting withitem
as parent, using a set of flags and masks as filter.If both
flags
andmask
areANY
, the first topmost item is returned. Ifmask
isANY
, the first topmost item matching any of flags is returned. otherwise the first item matching(item.flags & flags) == mask
is returned. You may combine box, layout, event and user flags. Frozen items will always be ignored. -
nuiGetHandler
public static long nuiGetHandler()Unsafe version of:GetHandler
-
uiGetHandler
Returns the handler callback as passed toSetHandler
-
uiGetEvents
public static int uiGetEvents(int item) Returns the event flags for an item as passed toSetEvents
-
uiGetFlags
public static int uiGetFlags(int item) Returns the user-defined flags for an item as passed toSetFlags
-
uiGetKey
public static int uiGetKey()When handling aKEY_DOWN/KEY_UP
event: the key that triggered this event. -
uiGetModifier
public static int uiGetModifier()When handling a keyboard or mouse event: the active modifier keys. -
nuiGetRect
public static void nuiGetRect(int item, long __result) Unsafe version of:GetRect
-
uiGetRect
Returns the items layout rectangle in absolute coordinates.If
uiGetRect()
is called beforeEndLayout
, the values of the returned rectangle are undefined. -
nuiContains
public static int nuiContains(int item, int x, int y) Unsafe version of:Contains
-
uiContains
public static boolean uiContains(int item, int x, int y) Returns 1 if an items absolute rectangle contains a given coordinate, otherwise 0. -
uiGetWidth
public static int uiGetWidth(int item) Returns the width of the item as set bySetSize
. -
uiGetHeight
public static int uiGetHeight(int item) Return the height of the item as set bySetSize
. -
uiGetLayout
public static int uiGetLayout(int item) Returns the anchoring behavior as set bySetLayout
. -
uiGetBox
public static int uiGetBox(int item) Returns the box model as set bySetBox
. -
uiGetMarginLeft
public static short uiGetMarginLeft(int item) Returns the left margin of the item as set withSetMargins
. -
uiGetMarginTop
public static short uiGetMarginTop(int item) Returns the top margin of the item as set withSetMargins
. -
uiGetMarginRight
public static short uiGetMarginRight(int item) Returns the right margin of the item as set withSetMargins
. -
uiGetMarginDown
public static short uiGetMarginDown(int item) Returns the bottom margin of the item as set withSetMargins
. -
uiRecoverItem
public static int uiRecoverItem(int olditem) WhenBeginLayout
is called, the most recently declared items are retained. WhenEndLayout
completes, it matches the old item hierarchy to the new one and attempts to map old items to new items as well as possible. When passed an item Id from the previous frame,uiRecoverItem()
returns the item's new assumed Id, or -1 if the item could not be mapped. It is valid to pass -1 as item. -
uiRemapItem
public static void uiRemapItem(int olditem, int newitem) In cases where it is important to recover old state over changes in the view, and the built-in remapping fails, the UI declaration can manually remap old items to new IDs in cases where e.g. the previous item ID has been temporarily saved;uiRemapItem()
would then be called after creating the new item usingItem
. -
uiGetLastItemCount
public static int uiGetLastItemCount()Returns the number if items that have been allocated in the last frame.
-