UFO: Alien Invasion
|
#include "ui_main.h"
#include "ui_internal.h"
#include "ui_actions.h"
#include "ui_input.h"
#include "ui_nodes.h"
#include "ui_node.h"
#include "ui_parse.h"
#include "ui_draw.h"
#include "ui_dragndrop.h"
#include "ui_timer.h"
#include "../input/cl_keys.h"
#include "../input/cl_input.h"
#include "../cl_shared.h"
#include "../battlescape/cl_localentity.h"
#include "../battlescape/cl_camera.h"
#include "../battlescape/cl_actor.h"
#include "../battlescape/cl_battlescape.h"
Go to the source code of this file.
Macros | |
#define | UI_STARTDRAG_ALREADY_SENT -1 |
Value of pressedNodeLocationX when event already sent. More... | |
#define | LONGPRESS_DELAY 800 |
Value of the delay to wait before sending a long press event This value is used for Qt 4.7. Maybe we can use a cvar. More... | |
#define | UI_IsMouseInvalidate() (oldMousePosX == -1) |
Functions | |
static bool | UI_FocusExecuteActionNode (void) |
Execute the current focused action node. More... | |
static bool | UI_FocusNextActionNode (void) |
Set the focus to the next action node. More... | |
void | UI_RequestFocus (uiNode_t *node) |
request the focus for a node More... | |
bool | UI_HasFocus (const uiNode_t *node) |
check if a node got the focus More... | |
void | UI_RemoveFocus (void) |
static uiKeyBinding_t * | UI_AllocStaticKeyBinding (void) |
int | UI_GetKeyBindingCount (void) |
uiKeyBinding_t * | UI_GetKeyBindingByIndex (int index) |
static void | UI_SetKeyBindingEx (const char *path, int key, const char *description, bool inherited) |
Set a binding from a key to a node to active. More... | |
void | UI_SetKeyBinding (const char *path, int key, const char *description) |
Set a binding from a key to a node to active. More... | |
static bool | UI_KeyPressedInWindow (uiNode_t *window, unsigned int key, unsigned int unicode) |
Check if a key binding exists for a window and execute it. More... | |
bool | UI_KeyRelease (unsigned int key, unsigned short unicode) |
Called by the client when the user released a key. More... | |
bool | UI_KeyPressed (unsigned int key, unsigned short unicode) |
Called by the client when the user type a key. More... | |
void | UI_ReleaseInput (void) |
Release all captured input (keyboard or mouse) More... | |
uiNode_t * | UI_GetMouseCapture (void) |
Return the captured node. More... | |
void | UI_SetMouseCapture (uiNode_t *node) |
Captured the mouse into a node. More... | |
void | UI_MouseRelease (void) |
Release the captured node. More... | |
void | UI_ResetInput (void) |
uiNode_t * | UI_GetHoveredNode (void) |
Get the current hovered node. More... | |
void | UI_InvalidateMouse (void) |
Force to invalidate the mouse position and then to update hover nodes... More... | |
bool | UI_CheckMouseMove (void) |
Call mouse move only if the mouse position change. More... | |
void | UI_MouseMove (int x, int y) |
Is called every time the mouse position change. More... | |
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...) More... | |
static void | UI_RightClick (int x, int y) |
static void | UI_MiddleClick (int x, int y) |
void | UI_MouseScroll (int deltaX, int deltaY) |
Called when we are in UI mode and scroll via mousewheel. More... | |
static void | UI_LongPressCallback (uiNode_t *, uiTimer_t *timer) |
void | UI_MouseDown (int x, int y, int button) |
Called when we are in UI mode and down a mouse button. More... | |
void | UI_MouseUp (int x, int y, int button) |
Called when we are in UI mode and up a mouse button. More... | |
Variables | |
static uiNode_t * | focusNode |
save the node with the focus More... | |
static uiNode_t * | hoveredNode |
save the current hovered node (first node under the mouse) More... | |
static uiNode_t * | oldHoveredNode |
save the previous hovered node More... | |
static int | oldMousePosX |
save old position of the mouse More... | |
static int | oldMousePosY |
static uiNode_t * | capturedNode |
save the captured node More... | |
static uiNode_t * | pressedNode |
Store node which receive a mouse down event. More... | |
static int | pressedNodeLocationX |
X position of the mouse when pressedNode != nullptr. More... | |
static int | pressedNodeLocationY |
Y position of the mouse when pressedNode != nullptr. More... | |
static int | pressedNodeButton |
Button pressed when pressedNode != nullptr. More... | |
static uiTimer_t * | longPressTimer |
Timer used to manage long press event. More... | |
#define LONGPRESS_DELAY 800 |
Value of the delay to wait before sending a long press event This value is used for Qt 4.7. Maybe we can use a cvar.
Definition at line 107 of file ui_input.cpp.
Referenced by UI_MouseDown().
#define UI_IsMouseInvalidate | ( | ) | (oldMousePosX == -1) |
Definition at line 666 of file ui_input.cpp.
Referenced by UI_LeftClick(), UI_MiddleClick(), and UI_RightClick().
#define UI_STARTDRAG_ALREADY_SENT -1 |
Value of pressedNodeLocationX when event already sent.
Definition at line 101 of file ui_input.cpp.
Referenced by UI_MouseMove().
|
static |
Definition at line 259 of file ui_input.cpp.
References Com_Error(), ERR_FATAL, uiGlobal_s::keyBindings, uiGlobal_s::numKeyBindings, OBJZERO, ui_global, and UI_MAX_KEYBINDING.
Referenced by UI_SetKeyBindingEx().
bool UI_CheckMouseMove | ( | void | ) |
Call mouse move only if the mouse position change.
Definition at line 569 of file ui_input.cpp.
References uiNode_t::invis, mousePosX, mousePosY, oldMousePosX, oldMousePosY, UI_CheckVisibility(), UI_InvalidateMouse(), and UI_MouseMove().
Referenced by UI_Draw().
|
static |
Execute the current focused action node.
<
Definition at line 121 of file ui_input.cpp.
References uiNode_t::onClick, uiNode_t::onMouseLeave, UI_ExecuteEventActions(), and UI_GetMouseCapture().
Referenced by UI_KeyPressed().
|
static |
Set the focus to the next action node.
<
Definition at line 167 of file ui_input.cpp.
References uiNode_t::firstChild, i, IN_GetMouseSpace, MS_UI, UI_GetLastFullScreenWindow(), UI_GetMouseCapture(), ui_global, UI_RemoveFocus(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_KeyPressed().
Get the current hovered node.
Definition at line 552 of file ui_input.cpp.
References hoveredNode.
Referenced by UI_BeforeDeletingNode(), UI_Draw(), and UI_IsMouseOnWindow().
uiKeyBinding_t* UI_GetKeyBindingByIndex | ( | int | index | ) |
Definition at line 277 of file ui_input.cpp.
References index, uiGlobal_s::keyBindings, and ui_global.
Referenced by CLMN_AddUIBindings(), and Key_WriteBindings().
Definition at line 272 of file ui_input.cpp.
References uiGlobal_s::numKeyBindings, and ui_global.
Referenced by CLMN_AddUIBindings(), and Key_WriteBindings().
Return the captured node.
Definition at line 508 of file ui_input.cpp.
References capturedNode.
Referenced by uiVScrollbarNode::draw(), uiSelectBoxNode::draw(), uiEditorNode::drawOverWindow(), uiSelectBoxNode::onLeftClick(), uiEditorNode::onMouseDown(), uiOptionTreeNode::onMouseDown(), uiMessageListNode::onMouseDown(), uiOptionListNode::onMouseDown(), uiTextNode::onMouseDown(), uiPanelNode::onMouseLongPress(), uiEditorNode::onMouseUp(), uiVScrollbarNode::onMouseUp(), uiModelNode::onMouseUp(), uiOptionTreeNode::onMouseUp(), uiMessageListNode::onMouseUp(), uiOptionListNode::onMouseUp(), uiTextNode::onMouseUp(), uiBaseInventoryNode::onMouseUp(), uiPanelNode::onMouseUp(), uiContainerNode::onMouseUp(), uiSpinnerNode::onMouseUp(), UI_FocusExecuteActionNode(), UI_FocusNextActionNode(), UI_IsMouseOnWindow(), UI_KeyPressed(), and UI_RemoveFocus().
bool UI_HasFocus | ( | const uiNode_t * | node | ) |
check if a node got the focus
Definition at line 230 of file ui_input.cpp.
References focusNode.
Referenced by uiTextEntryNode::draw(), uiTextEntryNode::onLeftClick(), UI_TextEntryNodeFocus(), and UI_TextEntryNodeUnFocus().
Force to invalidate the mouse position and then to update hover nodes...
Definition at line 560 of file ui_input.cpp.
References oldMousePosX, and oldMousePosY.
Referenced by UI_BeforeDeletingNode(), UI_CheckMouseMove(), UI_CloseWindowByRef(), UI_DeleteWindowFromStack(), UI_DNDAbort(), UI_DNDDrop(), UI_MouseRelease(), UI_PushWindow(), and UI_Reinit().
bool 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 430 of file ui_input.cpp.
References le_s::actorMode, CL_ActorFireModeActivated(), CL_ActorSetMode(), CL_BattlescapeRunning(), 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_KeyPressedInWindow(), UI_MouseRelease(), UI_Node_KeyPressed(), UI_PopWindowWithEscKey(), UI_WindowIsModal(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by Key_Event().
|
static |
Check if a key binding exists for a window and execute it.
Definition at line 370 of file ui_input.cpp.
References binding, Com_Printf(), uiNode_t::disabled, uiNode_t::invis, uiKeyBinding_s::node, value_s::ofs, uiNode_t::parent, uiKeyBinding_s::property, uiCallContext_s::source, value_s::string, value_s::type, UI_Node_Activate(), UI_Node_KeyPressed(), UI_WindowNodeGetKeyBinding(), uiCallContext_s::useCmdParam, and V_UI_NODEMETHOD.
Referenced by UI_KeyPressed().
bool UI_KeyRelease | ( | unsigned int | key, |
unsigned short | unicode | ||
) |
Called by the client when the user released a key.
[in] | key | key code, either K_ value or lowercase ascii |
[in] | unicode | translated meaning of keypress in unicode |
Definition at line 413 of file ui_input.cpp.
References UI_Node_KeyReleased().
Referenced by Key_Event().
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 675 of file ui_input.cpp.
References uiNode_t::disabled, uiNode_t::parent, ui_global, UI_IsMouseInvalidate, UI_Node_LeftClick(), UI_PopWindow(), UI_WindowIsDropDown(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_MouseUp().
Callback function waked up to send long click event
Definition at line 779 of file ui_input.cpp.
References uiNode_t::parent, pressedNode, pressedNodeButton, pressedNodeLocationX, pressedNodeLocationY, UI_Node_MouseLongPress(), and UI_TimerStop().
Referenced by UI_MouseDown().
Definition at line 732 of file ui_input.cpp.
References uiNode_t::disabled, uiNode_t::parent, UI_IsMouseInvalidate, and UI_Node_MiddleClick().
Referenced by UI_MouseUp().
Called when we are in UI mode and down a mouse button.
Definition at line 801 of file ui_input.cpp.
References hoveredNode, LONGPRESS_DELAY, pressedNodeButton, pressedNodeLocationX, pressedNodeLocationY, uiNode_t::root, UI_AllocTimer(), UI_LongPressCallback(), UI_MoveWindowOnTop(), UI_Node_MouseDown(), UI_TimerStart(), and UI_TimerStop().
Referenced by CL_LeftClickDown_f(), CL_MiddleClickDown_f(), and CL_RightClickDown_f().
Is called every time the mouse position change.
Definition at line 588 of file ui_input.cpp.
References hoveredNode, oldHoveredNode, uiNode_t::parent, pressedNode, pressedNodeButton, pressedNodeLocationX, pressedNodeLocationY, uiNode_t::state, UI_DNDIsDragging(), UI_GetNodeAtPosition(), UI_Node_CapturedMouseMove(), UI_Node_MouseEnter(), UI_Node_MouseLeave(), UI_Node_MouseMove(), UI_Node_StartDragging(), UI_STARTDRAG_ALREADY_SENT, and UI_TimerStop().
Referenced by UI_CheckMouseMove().
Release the captured node.
Definition at line 526 of file ui_input.cpp.
References capturedNode, UI_InvalidateMouse(), and UI_Node_CapturedMouseLost().
Referenced by uiBaseInventoryNode::onCapturedMouseMove(), uiContainerNode::onCapturedMouseMove(), uiSelectBoxNode::onLeftClick(), uiEditorNode::onMouseDown(), uiZoneNode::onMouseUp(), uiVScrollbarNode::onMouseUp(), uiControlNode::onMouseUp(), uiBarNode::onMouseUp(), uiMessageListNode::onMouseUp(), uiModelNode::onMouseUp(), uiOptionTreeNode::onMouseUp(), uiOptionListNode::onMouseUp(), uiRadarNode::onMouseUp(), uiPanelNode::onMouseUp(), uiTextNode::onMouseUp(), uiBaseInventoryNode::onMouseUp(), uiGeoscapeNode::onMouseUp(), uiContainerNode::onMouseUp(), uiSpinnerNode::onMouseUp(), UI_EditorNodeStop(), UI_KeyPressed(), and UI_ReleaseInput().
Called when we are in UI mode and scroll via mousewheel.
Definition at line 756 of file ui_input.cpp.
References hoveredNode, uiNode_t::parent, and UI_Node_Scroll().
Referenced by CL_WheelDown_f(), and CL_WheelUp_f().
Called when we are in UI mode and up a mouse button.
Definition at line 839 of file ui_input.cpp.
References capturedNode, hoveredNode, K_MOUSE1, K_MOUSE2, K_MOUSE3, UI_LeftClick(), UI_MiddleClick(), UI_Node_MouseUp(), UI_RightClick(), and UI_TimerStop().
Referenced by CL_LeftClickUp_f(), CL_MiddleClickUp_f(), and CL_RightClickUp_f().
Release all captured input (keyboard or mouse)
Definition at line 496 of file ui_input.cpp.
References UI_DNDAbort(), UI_DNDIsDragging(), UI_MouseRelease(), and UI_RemoveFocus().
Referenced by IN_Frame(), Key_SetDest(), UI_CloseWindowByRef(), UI_PushWindow(), and UI_Reinit().
Definition at line 241 of file ui_input.cpp.
References focusNode, UI_GetMouseCapture(), and UI_Node_FocusLost().
Referenced by uiTextEntryNode::onFocusGained(), uiTextEntryNode::onKeyPressed(), UI_FocusNextActionNode(), UI_ReleaseInput(), and UI_TextEntryNodeUnFocus().
request the focus for a node
Definition at line 206 of file ui_input.cpp.
References focusNode, UI_Node_FocusGained(), and UI_Node_FocusLost().
Referenced by uiTextEntryNode::onLeftClick(), and UI_TextEntryNodeFocus().
Definition at line 538 of file ui_input.cpp.
Referenced by UI_Shutdown().
Definition at line 710 of file ui_input.cpp.
References uiNode_t::disabled, uiNode_t::parent, UI_IsMouseInvalidate, and UI_Node_RightClick().
Referenced by UI_MouseUp().
Set a binding from a key to a node to active.
path | Path to a node, or a node method |
key | The key number to use (see for example the K_* names are matched up.) |
description | Textual description of what the key/cmd does (for tooltip) |
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_SetKeyBindingEx().
Referenced by Key_Bind_f().
|
static |
Set a binding from a key to a node to active.
This command creates a relation between a key and a node.
The relation is stored with the node (to display the shortcut in the tooltip) and with the parent window of the node (for faster search of all available shortcuts).
The storage on the node is not a list, so if there is more than one shortcut to a node we can't display all shortcuts in the tooltip, but the binding will still work.
If the parent window is inherited, the binding is duped to other extended windows and the relation is flagged as "inherited".
path | Path to a node, or a node method |
key | The key number to use (see for example the K_* names are matched up.) |
description | Textual description of what the key/cmd does (for tooltip) |
inherited | True if this binding is inherited from another binding. |
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 306 of file ui_input.cpp.
References binding, Com_Error(), Com_Printf(), uiKeyBinding_s::description, ERR_FATAL, uiKeyBinding_s::inherited, uiKeyBinding_s::key, key, uiNode_t::key, Key_KeynumToString(), Mem_PoolStrDup, uiNode_t::name, uiKeyBinding_s::node, uiGlobal_s::numWindows, uiKeyBinding_s::property, Q_strcat(), Q_strnull(), uiNode_t::root, uiNode_t::super, UI_AllocStaticKeyBinding(), ui_dynPool, ui_global, UI_ReadNodePath(), UI_WindowNodeRegisterKeyBinding(), V_UI_NODEMETHOD, and uiGlobal_s::windows.
Referenced by UI_SetKeyBinding().
Captured the mouse into a node.
Definition at line 516 of file ui_input.cpp.
Referenced by uiSelectBoxNode::onLeftClick(), uiZoneNode::onMouseDown(), uiControlNode::onMouseDown(), uiBarNode::onMouseDown(), uiModelNode::onMouseDown(), uiMessageListNode::onMouseDown(), uiOptionTreeNode::onMouseDown(), uiOptionListNode::onMouseDown(), uiRadarNode::onMouseDown(), uiBaseInventoryNode::onMouseDown(), uiTextNode::onMouseDown(), uiContainerNode::onMouseDown(), uiSpinnerNode::onMouseDown(), uiPanelNode::onMouseLongPress(), uiGeoscapeNode::onStartDragging(), uiGeoscapeNode::startMouseShifting(), UI_EditorNodeStart(), and UI_VScrollbarNodeAction().
|
static |
save the captured node
Definition at line 76 of file ui_input.cpp.
Referenced by UI_GetMouseCapture(), UI_MouseRelease(), and UI_MouseUp().
|
static |
save the node with the focus
Definition at line 48 of file ui_input.cpp.
Referenced by UI_HasFocus(), UI_RemoveFocus(), and UI_RequestFocus().
|
static |
save the current hovered node (first node under the mouse)
Definition at line 56 of file ui_input.cpp.
Referenced by UI_GetHoveredNode(), UI_MouseDown(), UI_MouseMove(), UI_MouseScroll(), and UI_MouseUp().
|
static |
Timer used to manage long press event.
Definition at line 112 of file ui_input.cpp.
|
static |
save the previous hovered node
Definition at line 61 of file ui_input.cpp.
Referenced by UI_MouseMove().
|
static |
save old position of the mouse
Definition at line 66 of file ui_input.cpp.
Referenced by UI_CheckMouseMove(), and UI_InvalidateMouse().
|
static |
Definition at line 66 of file ui_input.cpp.
Referenced by UI_CheckMouseMove(), and UI_InvalidateMouse().
|
static |
Store node which receive a mouse down event.
Definition at line 81 of file ui_input.cpp.
Referenced by UI_LongPressCallback(), and UI_MouseMove().
|
static |
Button pressed when pressedNode != nullptr.
Definition at line 96 of file ui_input.cpp.
Referenced by UI_LongPressCallback(), UI_MouseDown(), and UI_MouseMove().
|
static |
X position of the mouse when pressedNode != nullptr.
Definition at line 86 of file ui_input.cpp.
Referenced by UI_LongPressCallback(), UI_MouseDown(), and UI_MouseMove().
|
static |
Y position of the mouse when pressedNode != nullptr.
Definition at line 91 of file ui_input.cpp.
Referenced by UI_LongPressCallback(), UI_MouseDown(), and UI_MouseMove().