#include "ui_dragndrop.h"
#include "ui_input.h"
#include "ui_sound.h"
#include "node/ui_node_abstractnode.h"
#include "node/ui_node_container.h"
#include "../input/cl_input.h"
Go to the source code of this file.
Functions | |
qboolean | UI_DNDIsDragging (void) |
Return true if we are dragging something. | |
qboolean | UI_DNDIsTargetNode (struct uiNode_s *node) |
Return true if the requested node is the current target of the DND. | |
qboolean | UI_DNDIsSourceNode (struct uiNode_s *node) |
Return true if the requested node is the source of the DND. | |
int | UI_DNDGetType (void) |
Return the current type of the dragging object, else DND_NOTHING. | |
uiNode_t * | UI_DNDGetTargetNode (void) |
Return target of the DND. | |
uiNode_t * | UI_DNDGetSourceNode (void) |
Return source of the DND. | |
static void | UI_DNDDrag (uiNode_t *node) |
Private function to initialize a the start of a DND. | |
void | UI_DNDDragItem (uiNode_t *node, const item_t *item) |
Start to drag an item. | |
static void | UI_DNDCleanup (void) |
Cleanup data about DND. | |
void | UI_DNDAbort (void) |
Drop the object at the current position. | |
void | UI_DNDDrop (void) |
Drop the object at the current position. | |
item_t * | UI_DNDGetItem (void) |
static void | UI_DNDMouseMove (int mousePosX, int mousePosY) |
Manage the DND when we move the mouse. | |
void | UI_DrawDragAndDrop (int mousePosX, int mousePosY) |
Draw to dragging object and catch mouse move event. | |
Variables | |
static int | oldMousePosX = -1 |
static int | oldMousePosY = -1 |
static qboolean | nodeAcceptDND = qfalse |
static qboolean | positionAcceptDND = qfalse |
static uiDNDType_t | objectType |
static item_t | draggingItem |
static uiNode_t * | sourceNode |
static uiNode_t * | targetNode |
Definition in file ui_dragndrop.c.
void UI_DNDAbort | ( | void | ) |
Drop the object at the current position.
Definition at line 145 of file ui_dragndrop.c.
References uiNode_s::behaviour, DND_NOTHING, uiBehaviour_s::dndFinished, uiBehaviour_s::dndLeave, nodeAcceptDND, objectType, qfalse, UI_DNDCleanup(), UI_DNDIsDragging(), and UI_InvalidateMouse().
Referenced by UI_BaseInventoryNodeMouseDown(), UI_ContainerNodeMouseDown(), UI_DNDDrop(), UI_KeyPressed(), and UI_ReleaseInput().
static void UI_DNDCleanup | ( | void | ) | [inline, static] |
Cleanup data about DND.
Definition at line 133 of file ui_dragndrop.c.
References DND_NOTHING, and objectType.
Referenced by UI_DNDAbort(), and UI_DNDDrop().
static void UI_DNDDrag | ( | uiNode_t * | node | ) | [static] |
Private function to initialize a the start of a DND.
Definition at line 107 of file ui_dragndrop.c.
References DND_SOMETHING, objectType, UI_DNDIsDragging(), and UI_PlaySound().
Referenced by UI_DNDDragItem().
Start to drag an item.
Definition at line 122 of file ui_dragndrop.c.
References DND_ITEM, objectType, UI_DNDDrag(), and UI_DNDIsDragging().
Referenced by UI_BaseInventoryNodeCapturedMouseMove(), and UI_ContainerNodeCapturedMouseMove().
void UI_DNDDrop | ( | void | ) |
Drop the object at the current position.
Definition at line 165 of file ui_dragndrop.c.
References uiNode_s::behaviour, DND_NOTHING, uiBehaviour_s::dndDrop, uiBehaviour_s::dndFinished, mousePosX, mousePosY, objectType, positionAcceptDND, qfalse, UI_DNDAbort(), UI_DNDCleanup(), UI_DNDIsDragging(), UI_InvalidateMouse(), and UI_PlaySound().
Referenced by UI_BaseInventoryNodeMouseUp(), and UI_ContainerNodeMouseUp().
item_t* UI_DNDGetItem | ( | void | ) | [read] |
Definition at line 188 of file ui_dragndrop.c.
References DND_ITEM, and objectType.
Referenced by UI_BaseInventoryNodeDraw(), UI_ContainerNodeDNDFinished(), UI_ContainerNodeDNDMove(), UI_ContainerNodeDraw(), UI_ContainerNodeDrawDropPreview(), and UI_ContainerNodeDrawFreeSpace().
uiNode_t* UI_DNDGetSourceNode | ( | void | ) | [read] |
Return source of the DND.
Definition at line 95 of file ui_dragndrop.c.
References UI_DNDIsDragging().
Referenced by UI_BaseInventoryNodeDNDEnter(), and UI_ContainerNodeDNDEnter().
uiNode_t* UI_DNDGetTargetNode | ( | void | ) | [read] |
Return target of the DND.
Definition at line 86 of file ui_dragndrop.c.
References UI_DNDIsDragging().
Referenced by UI_ContainerNodeDNDFinished().
int UI_DNDGetType | ( | void | ) |
Return the current type of the dragging object, else DND_NOTHING.
Definition at line 78 of file ui_dragndrop.c.
References objectType.
Referenced by UI_BaseInventoryNodeDNDEnter(), UI_BaseInventoryNodeDraw(), UI_ContainerNodeDNDEnter(), and UI_ContainerNodeDraw().
qboolean UI_DNDIsDragging | ( | void | ) |
Return true if we are dragging something.
Definition at line 50 of file ui_dragndrop.c.
References DND_NOTHING, and objectType.
Referenced by SCR_DrawCursor(), UI_BaseInventoryNodeDraw(), UI_BaseInventoryNodeMouseDown(), UI_BaseInventoryNodeMouseUp(), UI_ContainerNodeDraw(), UI_ContainerNodeDrawFreeSpace(), UI_ContainerNodeMouseDown(), UI_ContainerNodeMouseUp(), UI_DNDAbort(), UI_DNDDrag(), UI_DNDDragItem(), UI_DNDDrop(), UI_DNDGetSourceNode(), UI_DNDGetTargetNode(), UI_DNDIsSourceNode(), UI_DNDIsTargetNode(), UI_Draw(), UI_KeyPressed(), UI_MouseMove(), and UI_ReleaseInput().
Return true if the requested node is the source of the DND.
Definition at line 68 of file ui_dragndrop.c.
References qfalse, and UI_DNDIsDragging().
Referenced by UI_ContainerNodeDrawFreeSpace().
Return true if the requested node is the current target of the DND.
Definition at line 58 of file ui_dragndrop.c.
References qfalse, and UI_DNDIsDragging().
Referenced by UI_ContainerNodeDraw().
static void UI_DNDMouseMove | ( | int | mousePosX, | |
int | mousePosY | |||
) | [static] |
Manage the DND when we move the mouse.
Definition at line 197 of file ui_dragndrop.c.
References uiNode_s::behaviour, uiBehaviour_s::dndEnter, uiBehaviour_s::dndLeave, uiBehaviour_s::dndMove, nodeAcceptDND, positionAcceptDND, qfalse, and UI_GetNodeAtPosition().
Referenced by UI_DrawDragAndDrop().
void UI_DrawDragAndDrop | ( | int | mousePosX, | |
int | mousePosY | |||
) |
Draw to dragging object and catch mouse move event.
Definition at line 229 of file ui_dragndrop.c.
References uiNode_s::color, DND_ITEM, objectType, oldMousePosX, oldMousePosY, positionAcceptDND, qfalse, scale, UI_DNDMouseMove(), UI_DrawItem(), and VectorSet.
Referenced by UI_DrawCursor().
item_t draggingItem [static] |
Save the dragging object
Definition at line 41 of file ui_dragndrop.c.
qboolean nodeAcceptDND = qfalse [static] |
Save if the current target node can accept the DND object
Definition at line 37 of file ui_dragndrop.c.
Referenced by UI_DNDAbort(), and UI_DNDMouseMove().
uiDNDType_t objectType [static] |
Save the type of the object we are dragging
Definition at line 40 of file ui_dragndrop.c.
Referenced by UI_DNDAbort(), UI_DNDCleanup(), UI_DNDDrag(), UI_DNDDragItem(), UI_DNDDrop(), UI_DNDGetItem(), UI_DNDGetType(), UI_DNDIsDragging(), and UI_DrawDragAndDrop().
int oldMousePosX = -1 [static] |
Save position X of the mouse to know when it move
Definition at line 34 of file ui_dragndrop.c.
Referenced by UI_DrawDragAndDrop().
int oldMousePosY = -1 [static] |
Save position Y of the mouse to know when it move
Definition at line 35 of file ui_dragndrop.c.
Referenced by UI_DrawDragAndDrop().
qboolean positionAcceptDND = qfalse [static] |
Save if the current position accept the DND object
Definition at line 38 of file ui_dragndrop.c.
Referenced by UI_DNDDrop(), UI_DNDMouseMove(), and UI_DrawDragAndDrop().
uiNode_t* sourceNode [static] |
Node where come from the DND object
Definition at line 43 of file ui_dragndrop.c.
uiNode_t* targetNode [static] |
Current node under the mouse
Definition at line 44 of file ui_dragndrop.c.