UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_input.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uiKeyBinding_t

Macros

#define UI_MAX_KEYBINDING   128

Functions

void UI_SetKeyBinding (const char *path, int key, const char *description)
 Set a binding from a key to a node to active.
void UI_MouseScroll (int deltaX, int deltaY)
 Called when we are in UI mode and scroll via mousewheel.
void UI_MouseMove (int x, int y)
 Is called every time the mouse position change.
void UI_MouseDown (int x, int y, int button)
 Called when we are in UI mode and down a mouse button.
void UI_MouseUp (int x, int y, int button)
 Called when we are in UI mode and up a mouse button.
void UI_InvalidateMouse (void)
 Force to invalidate the mouse position and then to update hover nodes...
bool UI_CheckMouseMove (void)
 Call mouse move only if the mouse position change.
uiNode_t * UI_GetHoveredNode (void)
 Get the current hovered node.
void UI_ResetInput (void)
void UI_RequestFocus (uiNode_t *node)
 request the focus for a node
bool UI_HasFocus (uiNode_t const *node)
 check if a node got the focus
void UI_RemoveFocus (void)
bool UI_KeyRelease (unsigned int key, unsigned short unicode)
 Called by the client when the user released a key.
bool UI_KeyPressed (unsigned int key, unsigned short unicode)
 Called by the client when the user type a key.
int UI_GetKeyBindingCount (void)
uiKeyBinding_t * UI_GetKeyBindingByIndex (int index)
uiNode_t * UI_GetMouseCapture (void)
 Return the captured node.
void UI_SetMouseCapture (uiNode_t *node)
 Captured the mouse into a node.
void UI_MouseRelease (void)
 Release the captured node.
void UI_ReleaseInput (void)
 Release all captured input (keyboard or mouse).

Macro Definition Documentation

◆ UI_MAX_KEYBINDING

#define UI_MAX_KEYBINDING   128

Definition at line 30 of file ui_input.h.

Referenced by UI_AllocStaticKeyBinding().

Function Documentation

◆ UI_CheckMouseMove()

bool UI_CheckMouseMove ( void )

Call mouse move only if the mouse position change.

Definition at line 569 of file ui_input.cpp.

References hoveredNode, uiNode_t::invis, mousePosX, mousePosY, oldMousePosX, oldMousePosY, UI_CheckMouseMove(), UI_CheckVisibility(), UI_InvalidateMouse(), and UI_MouseMove().

Referenced by UI_CheckMouseMove(), and UI_Draw().

◆ UI_GetHoveredNode()

uiNode_t * UI_GetHoveredNode ( void )

Get the current hovered node.

Returns
A node, else nullptr if the mouse hover nothing

Definition at line 552 of file ui_input.cpp.

References hoveredNode, and UI_GetHoveredNode().

Referenced by UI_BeforeDeletingNode(), UI_Draw(), UI_GetHoveredNode(), and UI_IsMouseOnWindow().

◆ UI_GetKeyBindingByIndex()

uiKeyBinding_t * UI_GetKeyBindingByIndex ( int index)

◆ UI_GetKeyBindingCount()

int UI_GetKeyBindingCount ( void )

◆ UI_GetMouseCapture()

◆ UI_HasFocus()

bool UI_HasFocus ( uiNode_t const * node)

check if a node got the focus

Definition at line 230 of file ui_input.cpp.

References focusNode, and UI_HasFocus().

Referenced by uiTextEntryNode::draw(), uiTextEntryNode::onLeftClick(), UI_HasFocus(), UI_TextEntryNodeFocus(), and UI_TextEntryNodeUnFocus().

◆ UI_InvalidateMouse()

void UI_InvalidateMouse ( void )

Force to invalidate the mouse position and then to update hover nodes...

Definition at line 560 of file ui_input.cpp.

References oldMousePosX, oldMousePosY, and UI_InvalidateMouse().

Referenced by UI_BeforeDeletingNode(), UI_CheckMouseMove(), UI_CloseWindowByRef(), UI_DeleteWindowFromStack(), UI_DNDAbort(), UI_DNDDrop(), UI_InvalidateMouse(), UI_MouseRelease(), UI_PushWindow(), and UI_Reinit().

◆ UI_KeyPressed()

bool UI_KeyPressed ( unsigned int key,
unsigned short unicode )

Called by the client when the user type a key.

Parameters
[in]keykey code, either K_ value or lowercase ascii
[in]unicodetranslated meaning of keypress in unicode
Returns
true, if we used the event
Todo
think about what we should do when the mouse is captured

Definition at line 430 of file ui_input.cpp.

References le_t::actorMode, CL_ActorFireModeActivated(), CL_ActorSetMode(), CL_BattlescapeRunning(), focusNode, K_ENTER, K_ESCAPE, K_KP_ENTER, K_TAB, M_MOVE, selActor, UI_DNDAbort(), UI_DNDIsDragging(), UI_FocusExecuteActionNode(), UI_FocusNextActionNode(), UI_GetLastFullScreenWindow(), UI_GetMouseCapture(), ui_global, UI_KeyPressed(), UI_KeyPressedInWindow(), UI_MouseRelease(), UI_Node_KeyPressed(), UI_PopWindowWithEscKey(), UI_WindowIsModal(), uiGlobal_t::windowStack, and uiGlobal_t::windowStackPos.

Referenced by Key_Event(), and UI_KeyPressed().

◆ UI_KeyRelease()

bool UI_KeyRelease ( unsigned int key,
unsigned short unicode )

Called by the client when the user released a key.

Parameters
[in]keykey code, either K_ value or lowercase ascii
[in]unicodetranslated meaning of keypress in unicode
Returns
true, if we used the event

Definition at line 413 of file ui_input.cpp.

References focusNode, UI_KeyRelease(), and UI_Node_KeyReleased().

Referenced by Key_Event(), and UI_KeyRelease().

◆ UI_MouseDown()

void UI_MouseDown ( int x,
int y,
int button )

◆ UI_MouseMove()

◆ UI_MouseRelease()

◆ UI_MouseScroll()

void UI_MouseScroll ( int deltaX,
int deltaY )

Called when we are in UI mode and scroll via mousewheel.

Note
The geoscape zooming code is here, too (also in
See also
CL_ParseInput)
UI_LeftClick
UI_RightClick
UI_MiddleClick

Definition at line 756 of file ui_input.cpp.

References capturedNode, hoveredNode, uiNode_t::parent, UI_MouseScroll(), and UI_Node_Scroll().

Referenced by CL_WheelDown_f(), CL_WheelUp_f(), and UI_MouseScroll().

◆ UI_MouseUp()

void UI_MouseUp ( int x,
int y,
int button )

Called when we are in UI mode and up a mouse button.

See also
UI_LeftClick
UI_RightClick
UI_MiddleClick
Todo
it is really need to clean up this subfunctions

Definition at line 839 of file ui_input.cpp.

References capturedNode, hoveredNode, K_MOUSE1, K_MOUSE2, K_MOUSE3, longPressTimer, pressedNode, UI_LeftClick(), UI_MiddleClick(), UI_MouseUp(), UI_Node_MouseUp(), UI_RightClick(), and UI_TimerStop().

Referenced by CL_LeftClickUp_f(), CL_MiddleClickUp_f(), CL_RightClickUp_f(), and UI_MouseUp().

◆ UI_ReleaseInput()

void UI_ReleaseInput ( void )

Release all captured input (keyboard or mouse).

Definition at line 496 of file ui_input.cpp.

References UI_DNDAbort(), UI_DNDIsDragging(), UI_MouseRelease(), UI_ReleaseInput(), and UI_RemoveFocus().

Referenced by IN_Frame(), Key_SetDest(), UI_CloseWindowByRef(), UI_PushWindow(), UI_Reinit(), and UI_ReleaseInput().

◆ UI_RemoveFocus()

◆ UI_RequestFocus()

void UI_RequestFocus ( uiNode_t * node)

request the focus for a node

Definition at line 206 of file ui_input.cpp.

References focusNode, UI_Node_FocusGained(), UI_Node_FocusLost(), and UI_RequestFocus().

Referenced by uiTextEntryNode::onLeftClick(), UI_RequestFocus(), and UI_TextEntryNodeFocus().

◆ UI_ResetInput()

void UI_ResetInput ( void )

◆ UI_SetKeyBinding()

void UI_SetKeyBinding ( const char * path,
int key,
const char * description )

Set a binding from a key to a node to active.

Parameters
pathPath to a node, or a node method
keyThe key number to use (see for example the K_* names are matched up.)
descriptionTextual description of what the key/cmd does (for tooltip)
Todo

check: only one binding per nodes?

check: key per window must be unique

check: key used into UI_KeyPressed can't be used

Definition at line 362 of file ui_input.cpp.

References UI_SetKeyBinding(), and UI_SetKeyBindingEx().

Referenced by Key_Bind_f(), and UI_SetKeyBinding().

◆ UI_SetMouseCapture()