37 #include "../input/cl_keys.h"
38 #include "../input/cl_input.h"
39 #include "../cl_shared.h"
40 #include "../battlescape/cl_localentity.h"
41 #include "../battlescape/cl_camera.h"
42 #include "../battlescape/cl_actor.h"
43 #include "../battlescape/cl_battlescape.h"
101 #define UI_STARTDRAG_ALREADY_SENT -1
107 #define LONGPRESS_DELAY 800
124 if (IN_GetMouseSpace() != MS_UI)
147 static uiNode_t* UI_GetNextActionNode (uiNode_t* node)
153 && ((node->onClick && node->onMouseEnter) || node->onMouseEnter))
170 static int i = UI_MAX_WINDOWSTACK + 1;
184 uiNode_t* node = UI_GetNextActionNode(focusNode);
186 return UI_FocusSetNode(node);
192 if (UI_FocusSetNode(UI_GetNextActionNode(window->
firstChild)))
210 if (node == focusNode)
309 const value_t*
property =
nullptr;
312 if (node ==
nullptr) {
313 Com_Printf(
"UI_SetKeyBinding: node \"%s\" not found.\n", path);
318 Com_Error(
ERR_FATAL,
"UI_SetKeyBinding: Only node and method are supported. Property @%s not found in path \"%s\".", property->string, path);
322 binding->
node = node;
384 node = binding->
node;
392 node = binding->
node;
400 func(node, &newContext);
476 if (lastWindowId < 0)
518 assert(capturedNode ==
nullptr);
519 assert(node !=
nullptr);
530 if (capturedNode ==
nullptr)
533 capturedNode =
nullptr;
540 hoveredNode =
nullptr;
541 oldHoveredNode =
nullptr;
543 capturedNode =
nullptr;
544 pressedNode =
nullptr;
545 longPressTimer =
nullptr;
593 if (pressedNode && !capturedNode) {
618 if (oldHoveredNode != hoveredNode) {
626 if (node == commonNode)
632 commonNode = commonNode->
parent;
637 while (node != commonNode) {
642 oldHoveredNode->
state =
false;
645 while (commonNode != hoveredNode) {
648 while (node->
parent != commonNode)
654 hoveredNode->
state =
true;
666 #define UI_IsMouseInvalidate() (oldMousePosX == -1)
784 if (pressedNode ==
nullptr)
812 if (node !=
nullptr) {
818 if (pressedNode ==
nullptr) {
824 if (longPressTimer ==
nullptr) {
829 pressedNode =
nullptr;
847 if (pressedNode || capturedNode) {
865 }
else if (pressedNode == hoveredNode) {
869 pressedNode =
nullptr;
bool Q_strnull(const char *string)
uiNode_t * windowStack[UI_MAX_WINDOWSTACK]
void UI_MoveWindowOnTop(uiNode_t *window)
Move the window on top of compatible windows. "Compatible" mean non full screen windows, and windows with the same window parent.
uiKeyBinding_t keyBindings[UI_MAX_KEYBINDING]
void UI_ReadNodePath(const char *path, const uiNode_t *relativeNode, const uiNode_t *iterationNode, uiNode_t **resultNode, const value_t **resultProperty, value_t *luaMethod)
Read a path and return every we can use (node and property)
void UI_Node_MouseUp(uiNode_t *node, int x, int y, int button)
void UI_Node_CapturedMouseLost(uiNode_t *node)
bool UI_CheckVisibility(uiNode_t *node)
Check the if conditions for a given node.
bool UI_Node_MouseLongPress(uiNode_t *node, int x, int y, int button)
uiNode_t * UI_GetNodeAtPosition(int x, int y)
Return the first visible node at a position.
bool UI_Node_StartDragging(uiNode_t *node, int startX, int startY, int currentX, int currentY, int button)
void UI_WindowNodeRegisterKeyBinding(uiNode_t *node, uiKeyBinding_t *binding)
Add a key binding to a window node. Window node store key bindings for his node child.
bool UI_Node_Scroll(uiNode_t *node, int deltaX, int deltaY)
void UI_DNDAbort(void)
Drop the object at the current position.
struct uiAction_s * onMouseLeave
const struct value_s * property
void UI_Node_MouseMove(uiNode_t *node, int x, int y)
uiTimer_t * UI_AllocTimer(uiNode_t *node, int firstDelay, timerCallback_t callback)
Allocate a new time for a node.
void Com_Printf(const char *const fmt,...)
struct uiAction_s * onClick
void UI_Node_RightClick(uiNode_t *node, int x, int y)
void UI_Node_FocusLost(uiNode_t *node)
Internal data use by the UI package.
C interface to allow to access to cpp node code.
void Com_Error(int code, const char *fmt,...)
int UI_GetLastFullScreenWindow(void)
Returns the ID of the last fullscreen ID. Before this, window should be hidden.
uiKeyBinding_t * UI_WindowNodeGetKeyBinding(uiNode_t const *const node, unsigned int key)
Search a a key binding from a window node. Window node store key bindings for his node child...
void UI_Node_FocusGained(uiNode_t *node)
bool UI_Node_KeyPressed(uiNode_t *node, unsigned int key, unsigned short unicode)
void UI_Node_Activate(uiNode_t *node)
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
void UI_TimerStop(uiTimer_t *timer)
Stop a timer.
bool CL_ActorFireModeActivated(const actorModes_t mode)
Checks whether we are in fire mode or node.
Atomic structure used to define most of the UI.
void UI_Node_MouseLeave(uiNode_t *node)
uiNode_t * windows[UI_MAX_WINDOWS]
bool CL_BattlescapeRunning(void)
Check whether we already have actors spawned on the battlefield.
Contain the context of the calling of a function.
void UI_PopWindowWithEscKey(void)
bool UI_WindowIsModal(uiNode_t const *const node)
True if the window is a modal.
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
void UI_PopWindow(bool all)
Pops a window from the window stack.
bool UI_Node_KeyReleased(uiNode_t *node, unsigned int key, unsigned short unicode)
void UI_Node_LeftClick(uiNode_t *node, int x, int y)
bool UI_WindowIsDropDown(uiNode_t const *const node)
True if the window is a drop down.
void UI_Node_MiddleClick(uiNode_t *node, int x, int y)
const uiKeyBinding_t * binding
void CL_ActorSetMode(le_t *actor, actorModes_t actorMode)
#define Mem_PoolStrDup(in, pool, tagNum)
void UI_Node_MouseDown(uiNode_t *node, int x, int y, int button)
void(* uiNodeMethod_t)(uiNode_t *node, const struct uiCallContext_s *context)
Signature of a function to bind a node method.
bool UI_DNDIsDragging(void)
Return true if we are dragging something.
const char * Key_KeynumToString(int keynum)
Convert a given keynum to string.
void UI_TimerStart(uiTimer_t *timer)
Restart a timer.
void UI_Node_CapturedMouseMove(uiNode_t *node, int x, int y)
struct uiKeyBinding_s * key
void UI_Node_MouseEnter(uiNode_t *node)