#include "ui_main.h"
#include "ui_internal.h"
#include "ui_actions.h"
#include "ui_input.h"
#include "ui_nodes.h"
#include "ui_parse.h"
#include "ui_draw.h"
#include "ui_dragndrop.h"
#include "ui_sound.h"
#include "../input/cl_keys.h"
#include "../input/cl_input.h"
Go to the source code of this file.
Defines | |
#define | UI_IsMouseInvalidate (oldMousePosX == -1) |
Functions | |
static qboolean | UI_FocusExecuteActionNode (void) |
Execute the current focused action node. | |
static qboolean | UI_FocusNextActionNode (void) |
Set the focus to the next action node. | |
void | UI_RequestFocus (uiNode_t *node) |
request the focus for a node | |
qboolean | UI_HasFocus (const uiNode_t *node) |
check if a node got the focus | |
void | UI_RemoveFocus (void) |
static uiKeyBinding_t * | UI_AllocStaticKeyBinding (void) |
int | UI_GetKeyBindingCount (void) |
uiKeyBinding_t * | UI_GetKeyBindingByIndex (int index) |
void | UI_SetKeyBinding (const char *path, int key) |
static qboolean | UI_KeyPressedInWindow (unsigned int key, const uiNode_t *window) |
Check if a key binding exists for a window and execute it. | |
qboolean | UI_KeyPressed (unsigned int key, unsigned short unicode) |
Called by the client when the user type a key. | |
void | UI_ReleaseInput (void) |
Release all captured input (keyboard or mouse). | |
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. | |
uiNode_t * | UI_GetHoveredNode (void) |
Get the current hovered node. | |
void | UI_InvalidateMouse (void) |
Force to invalidate the mouse position and then to update hover nodes... | |
qboolean | UI_CheckMouseMove (void) |
Call mouse move only if the mouse position change. | |
void | UI_MouseMove (int x, int y) |
Is called every time the mouse position change. | |
static void | UI_LeftClick (int x, int y) |
Is called every time one clicks on a window/screen. Then checks if anything needs to be executed in the area of the click (e.g. button-commands, inventory-handling, geoscape-stuff, etc...). | |
static void | UI_RightClick (int x, int y) |
static void | UI_MiddleClick (int x, int y) |
void | UI_MouseWheel (qboolean down, int x, int y) |
Called when we are in UI mode and scroll via mousewheel. | |
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. | |
Variables | |
static uiNode_t * | focusNode |
save the node with the focus | |
static uiNode_t * | hoveredNode |
save the current hovered node (first node under the mouse) | |
static uiNode_t * | oldHoveredNode |
save the previous hovered node | |
static int | oldMousePosX |
save old position of the mouse | |
static int | oldMousePosY |
static uiNode_t * | capturedNode |
save the captured node |
Definition in file ui_input.c.
#define UI_IsMouseInvalidate (oldMousePosX == -1) |
Definition at line 521 of file ui_input.c.
Referenced by UI_LeftClick(), UI_MiddleClick(), and UI_RightClick().
static uiKeyBinding_t* UI_AllocStaticKeyBinding | ( | void | ) | [static] |
Definition at line 220 of file ui_input.c.
References Com_Error(), ERR_FATAL, uiGlobal_s::keyBindings, uiGlobal_s::numKeyBindings, ui_global, and UI_MAX_KEYBINDING.
Referenced by UI_SetKeyBinding().
qboolean UI_CheckMouseMove | ( | void | ) |
Call mouse move only if the mouse position change.
Definition at line 439 of file ui_input.c.
References uiNode_s::invis, mousePosX, mousePosY, oldMousePosX, oldMousePosY, qfalse, qtrue, UI_CheckVisibility(), UI_InvalidateMouse(), and UI_MouseMove().
Referenced by UI_Draw().
static qboolean UI_FocusExecuteActionNode | ( | void | ) | [static] |
Execute the current focused action node.
<
Definition at line 78 of file ui_input.c.
References uiNode_s::onClick, uiNode_s::onMouseLeave, qfalse, qtrue, UI_ExecuteEventActions(), and UI_GetMouseCapture().
Referenced by UI_KeyPressed().
static qboolean UI_FocusNextActionNode | ( | void | ) | [static] |
Set the focus to the next action node.
<
Definition at line 124 of file ui_input.c.
References uiNode_s::firstChild, i, mouseSpace, MS_UI, qfalse, qtrue, UI_GetLastFullScreenWindow(), UI_GetMouseCapture(), ui_global, UI_RemoveFocus(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_KeyPressed().
uiNode_t* UI_GetHoveredNode | ( | void | ) | [read] |
Get the current hovered node.
Definition at line 422 of file ui_input.c.
Referenced by UI_Draw(), and UI_IsPointOnWindow().
uiKeyBinding_t* UI_GetKeyBindingByIndex | ( | int | index | ) |
Definition at line 238 of file ui_input.c.
References uiGlobal_s::keyBindings, and ui_global.
Referenced by Key_WriteBindings().
int UI_GetKeyBindingCount | ( | void | ) |
Definition at line 233 of file ui_input.c.
References uiGlobal_s::numKeyBindings, and ui_global.
Referenced by Key_WriteBindings().
uiNode_t* UI_GetMouseCapture | ( | void | ) | [read] |
Return the captured node.
Definition at line 386 of file ui_input.c.
Referenced by UI_BaseInventoryNodeMouseUp(), UI_ContainerNodeMouseUp(), UI_EditorNodeDrawOverWindow(), UI_EditorNodeMouseDown(), UI_EditorNodeMouseUp(), UI_FocusExecuteActionNode(), UI_FocusNextActionNode(), UI_IsPointOnWindow(), UI_KeyPressed(), UI_ModelNodeMouseUp(), UI_RemoveFocus(), UI_SelectBoxNodeClick(), UI_SelectBoxNodeDraw(), UI_VScrollbarNodeDraw(), and UI_VScrollbarNodeMouseUp().
check if a node got the focus
Definition at line 189 of file ui_input.c.
Referenced by UI_KeyBindingNodeClick(), UI_KeyBindingNodeDraw(), UI_TextEntryNodeClick(), UI_TextEntryNodeDraw(), and UI_TextEntryNodeFocus().
void UI_InvalidateMouse | ( | void | ) |
Force to invalidate the mouse position and then to update hover nodes...
Definition at line 430 of file ui_input.c.
References oldMousePosX, and oldMousePosY.
Referenced by UI_CheckMouseMove(), UI_CloseWindowByRef(), UI_DeleteWindowFromStack(), UI_DNDAbort(), UI_DNDDrop(), UI_MouseRelease(), UI_PushWindowDelete(), and UI_Reinit().
qboolean UI_KeyPressed | ( | unsigned int | key, | |
unsigned short | unicode | |||
) |
Called by the client when the user type a key.
[in] | key | key code, either K_ value or lowercase ascii |
[in] | unicode | translated meaning of keypress in unicode |
Definition at line 316 of file ui_input.c.
References uiNode_s::behaviour, K_ENTER, K_ESCAPE, K_KP_ENTER, K_TAB, uiBehaviour_s::keyPressed, qfalse, qtrue, UI_DNDAbort(), UI_DNDIsDragging(), UI_FocusExecuteActionNode(), UI_FocusNextActionNode(), UI_GetLastFullScreenWindow(), UI_GetMouseCapture(), ui_global, UI_KeyPressedInWindow(), UI_MouseRelease(), UI_PopWindowWithEscKey(), UI_WindowIsModal(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by Key_Event().
Check if a key binding exists for a window and execute it.
Definition at line 275 of file ui_input.c.
References uiBehaviour_s::activate, uiNode_s::behaviour, binding, Com_Printf(), uiNode_s::disabled, uiNode_s::invis, uiKeyBinding_s::node, value_s::ofs, uiNode_s::parent, uiKeyBinding_s::property, qfalse, qtrue, uiCallContext_s::source, value_s::string, value_s::type, UI_WindowNodeGetKeyBinding(), uiCallContext_s::useCmdParam, and V_UI_NODEMETHOD.
Referenced by UI_KeyPressed().
static void UI_LeftClick | ( | int | x, | |
int | y | |||
) | [static] |
Is called every time one clicks on a window/screen. Then checks if anything needs to be executed in the area of the click (e.g. button-commands, inventory-handling, geoscape-stuff, etc...).
Definition at line 530 of file ui_input.c.
References uiNode_s::behaviour, uiNode_s::disabled, uiBehaviour_s::leftClick, uiNode_s::onClick, uiNode_s::parent, qfalse, UI_ExecuteEventActions(), ui_global, UI_IsMouseInvalidate, UI_PopWindow(), UI_WindowIsDropDown(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_MouseDown().
static void UI_MiddleClick | ( | int | x, | |
int | y | |||
) | [static] |
Definition at line 598 of file ui_input.c.
References uiNode_s::behaviour, uiNode_s::disabled, uiBehaviour_s::middleClick, uiNode_s::onMiddleClick, uiNode_s::parent, UI_ExecuteEventActions(), and UI_IsMouseInvalidate.
Referenced by UI_MouseDown().
void UI_MouseDown | ( | int | x, | |
int | y, | |||
int | button | |||
) |
Called when we are in UI mode and down a mouse button.
Definition at line 662 of file ui_input.c.
References uiNode_s::behaviour, K_MOUSE1, K_MOUSE2, K_MOUSE3, uiBehaviour_s::mouseDown, uiNode_s::root, UI_LeftClick(), UI_MiddleClick(), UI_MoveWindowOnTop(), UI_PlaySound(), and UI_RightClick().
Referenced by CL_LeftClickDown_f(), CL_MiddleClickDown_f(), and CL_RightClickDown_f().
void UI_MouseMove | ( | int | x, | |
int | y | |||
) |
Is called every time the mouse position change.
Definition at line 458 of file ui_input.c.
References uiNode_s::behaviour, uiBehaviour_s::capturedMouseMove, uiBehaviour_s::mouseMove, uiNode_s::onMouseEnter, uiNode_s::onMouseLeave, uiNode_s::parent, qfalse, qtrue, uiNode_s::state, UI_DNDIsDragging(), UI_ExecuteEventActions(), and UI_GetNodeAtPosition().
Referenced by UI_CheckMouseMove().
void UI_MouseRelease | ( | void | ) |
Release the captured node.
Definition at line 404 of file ui_input.c.
References uiNode_s::behaviour, uiBehaviour_s::capturedMouseLost, and UI_InvalidateMouse().
Referenced by UI_BarNodeMouseUp(), UI_BaseInventoryNodeCapturedMouseMove(), UI_BaseInventoryNodeMouseUp(), UI_ContainerNodeCapturedMouseMove(), UI_ContainerNodeMouseUp(), UI_ControlsNodeMouseUp(), UI_EditorNodeMouseDown(), UI_EditorNodeStop(), UI_KeyPressed(), UI_MapNodeMouseUp(), UI_ModelNodeMouseUp(), UI_RadarNodeMouseUp(), UI_ReleaseInput(), UI_SelectBoxNodeClick(), UI_SpinnerNodeUp(), UI_VScrollbarNodeMouseUp(), and UI_ZoneNodeUp().
void UI_MouseUp | ( | int | x, | |
int | y, | |||
int | button | |||
) |
Called when we are in UI mode and up a mouse button.
Definition at line 699 of file ui_input.c.
References uiNode_s::behaviour, and uiBehaviour_s::mouseUp.
Referenced by CL_LeftClickUp_f(), CL_MiddleClickUp_f(), and CL_RightClickUp_f().
void UI_MouseWheel | ( | qboolean | down, | |
int | x, | |||
int | y | |||
) |
Called when we are in UI mode and scroll via mousewheel.
Definition at line 631 of file ui_input.c.
References uiNode_s::behaviour, uiBehaviour_s::mouseWheel, uiNode_s::onWheel, uiNode_s::onWheelDown, uiNode_s::onWheelUp, and UI_ExecuteEventActions().
Referenced by CL_ZoomInQuant_f(), and CL_ZoomOutQuant_f().
void UI_ReleaseInput | ( | void | ) |
Release all captured input (keyboard or mouse).
Definition at line 374 of file ui_input.c.
References UI_DNDAbort(), UI_DNDIsDragging(), UI_MouseRelease(), and UI_RemoveFocus().
Referenced by IN_Frame(), Key_SetDest(), UI_CloseWindowByRef(), UI_PushWindowDelete(), and UI_Reinit().
void UI_RemoveFocus | ( | void | ) |
Definition at line 200 of file ui_input.c.
References uiNode_s::behaviour, uiBehaviour_s::focusLost, and UI_GetMouseCapture().
Referenced by UI_FocusNextActionNode(), UI_KeyBindingNodeKeyPressed(), UI_ReleaseInput(), and UI_TextEntryNodeKeyPressed().
void UI_RequestFocus | ( | uiNode_t * | node | ) |
request the focus for a node
Definition at line 163 of file ui_input.c.
References uiNode_s::behaviour, uiBehaviour_s::focusGained, and uiBehaviour_s::focusLost.
Referenced by UI_KeyBindingNodeClick(), UI_TextEntryNodeClick(), and UI_TextEntryNodeFocus().
static void UI_RightClick | ( | int | x, | |
int | y | |||
) | [static] |
Definition at line 570 of file ui_input.c.
References uiNode_s::behaviour, uiNode_s::disabled, uiNode_s::onRightClick, uiNode_s::parent, uiBehaviour_s::rightClick, UI_ExecuteEventActions(), and UI_IsMouseInvalidate.
Referenced by UI_MouseDown().
void UI_SetKeyBinding | ( | const char * | path, | |
int | key | |||
) |
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 248 of file ui_input.c.
References binding, Com_Error(), Com_Printf(), ERR_FATAL, uiNode_s::key, uiKeyBinding_s::key, uiKeyBinding_s::node, uiKeyBinding_s::property, uiNode_s::root, UI_AllocStaticKeyBinding(), UI_ReadNodePath(), UI_WindowNodeRegisterKeyBinding(), and V_UI_NODEMETHOD.
Referenced by Key_Bind_f().
void UI_SetMouseCapture | ( | uiNode_t * | node | ) |
Captured the mouse into a node.
Definition at line 394 of file ui_input.c.
Referenced by UI_BarNodeMouseDown(), UI_BaseInventoryNodeMouseDown(), UI_ContainerNodeMouseDown(), UI_ControlsNodeMouseDown(), UI_EditorNodeStart(), UI_MapNodeMouseDown(), UI_ModelNodeMouseDown(), UI_RadarNodeMouseDown(), UI_SelectBoxNodeClick(), UI_SpinnerNodeDown(), UI_VScrollbarNodeAction(), and UI_ZoneNodeDown().
uiNode_t* capturedNode [static] |
save the captured node
Definition at line 70 of file ui_input.c.
save the node with the focus
Definition at line 42 of file ui_input.c.
uiNode_t* hoveredNode [static] |
save the current hovered node (first node under the mouse)
Definition at line 50 of file ui_input.c.
uiNode_t* oldHoveredNode [static] |
save the previous hovered node
Definition at line 55 of file ui_input.c.
int oldMousePosX [static] |
save old position of the mouse
Definition at line 60 of file ui_input.c.
Referenced by UI_CheckMouseMove(), and UI_InvalidateMouse().
int oldMousePosY [static] |
Definition at line 60 of file ui_input.c.
Referenced by UI_CheckMouseMove(), and UI_InvalidateMouse().