ui_dragndrop.c File Reference

#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"
Include dependency graph for ui_dragndrop.c:

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_tUI_DNDGetTargetNode (void)
 Return target of the DND.
uiNode_tUI_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_tUI_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_tsourceNode
static uiNode_ttargetNode

Detailed Description

Definition in file ui_dragndrop.c.


Function Documentation

void UI_DNDAbort ( void   ) 
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.

See also:
UI_DNDDragItem
UI_DNDDrop
UI_DNDAbort

Definition at line 107 of file ui_dragndrop.c.

References DND_SOMETHING, objectType, UI_DNDIsDragging(), and UI_PlaySound().

Referenced by UI_DNDDragItem().

void UI_DNDDragItem ( uiNode_t node,
const item_t item 
)
void UI_DNDDrop ( void   ) 
item_t* UI_DNDGetItem ( void   )  [read]
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   ) 
qboolean UI_DNDIsSourceNode ( struct uiNode_s node  ) 

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().

qboolean UI_DNDIsTargetNode ( struct uiNode_s node  ) 

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]
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().


Variable Documentation

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().

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.


Generated by  doxygen 1.6.2