UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
uiContainerNode Class Reference

#include <ui_node_container.h>

Inherits uiLocatedNode.

Inherited by uiBaseInventoryNode.

Public Member Functions

void draw (uiNode_t *node) override
 Main function to draw a container node. More...
 
void drawTooltip (const uiNode_t *node, int x, int y) const override
 Custom tooltip for container node. More...
 
void initNode (uiNode_t *node) override
 
void onMouseDown (uiNode_t *node, int x, int y, int button) override
 
void onMouseUp (uiNode_t *node, int x, int y, int button) override
 
void onCapturedMouseMove (uiNode_t *node, int x, int y) override
 
void onLoading (uiNode_t *node) override
 
void onLoaded (uiNode_t *node) override
 Calculates the size of a container node and links the container into the node (uses the invDef_t shape bitmask to determine the size) More...
 
bool onDndEnter (uiNode_t *node) override
 Call when a DND enter into the node. More...
 
bool onDndMove (uiNode_t *node, int x, int y) override
 Call into the target when the DND hover it. More...
 
void onDndLeave (uiNode_t *node) override
 Call when a DND enter into the node. More...
 
bool onDndFinished (uiNode_t *node, bool isDroped) override
 Call into the source when the DND end. More...
 
- Public Member Functions inherited from uiLocatedNode
virtual void drawOverWindow (uiNode_t *node)
 
virtual void doLayout (uiNode_t *node)
 Call to update the node layout. This common code revalidates the node tree. More...
 
virtual void onSizeChanged (uiNode_t *node)
 Callback stub. More...
 
virtual void onLeftClick (uiNode_t *node, int x, int y)
 
virtual void onRightClick (uiNode_t *node, int x, int y)
 
virtual void onMiddleClick (uiNode_t *node, int x, int y)
 
virtual bool onScroll (uiNode_t *node, int deltaX, int deltaY)
 
virtual void onMouseMove (uiNode_t *node, int x, int y)
 
virtual bool onMouseLongPress (uiNode_t *node, int x, int y, int button)
 Send mouse event when a pressed mouse button is dragged. More...
 
virtual void onMouseEnter (uiNode_t *node)
 
virtual void onMouseLeave (uiNode_t *node)
 
virtual void onCapturedMouseLost (uiNode_t *node)
 
virtual bool onStartDragging (uiNode_t *node, int startX, int startY, int currentX, int currentY, int button)
 Send mouse event when a pressed mouse button is dragged. More...
 
virtual bool onDndDrop (uiNode_t *node, int x, int y)
 
virtual void onFocusGained (uiNode_t *node)
 
virtual void onFocusLost (uiNode_t *node)
 
virtual bool onKeyPressed (uiNode_t *node, unsigned int key, unsigned short unicode)
 
virtual bool onKeyReleased (uiNode_t *node, unsigned int key, unsigned short unicode)
 
virtual void getClientPosition (uiNode_t const *node, vec2_t position)
 
virtual int getCellWidth (uiNode_t *node)
 
virtual int getCellHeight (uiNode_t *node)
 
- Public Member Functions inherited from uiNode
virtual void clone (uiNode_t const *source, uiNode_t *clone)
 
virtual void initNodeDynamic (uiNode_t *node)
 
virtual void deleteNode (uiNode_t *node)
 
virtual void onWindowOpened (uiNode_t *node, linkedList_t *params)
 
virtual void onWindowClosed (uiNode_t *node)
 
virtual void onWindowActivate (uiNode_t *node)
 
virtual void onActivate (uiNode_t *node)
 Activate the node. Can be used without the mouse (ie. a button will execute onClick) More...
 
virtual void onPropertyChanged (uiNode_t *node, const value_t *property)
 
virtual ~uiNode ()
 

Detailed Description

Definition at line 35 of file ui_node_container.h.

Member Function Documentation

void uiContainerNode::drawTooltip ( const uiNode_t node,
int  x,
int  y 
) const
overridevirtual

Custom tooltip for container node.

Parameters
[in]nodeNode we request to draw tooltip
[in]x,yPosition of the mouse

Reimplemented from uiLocatedNode.

Definition at line 654 of file ui_node_container.cpp.

References Item::getX(), Item::getY(), MAX_VAR, Q_strcat(), UI_ContainerNodeGetItemAtPosition(), UI_DrawTooltip(), and UI_GetItemTooltip().

void uiContainerNode::initNode ( uiNode_t node)
overridevirtual

call to initialize the node structure and extradata structure

Reimplemented from uiNode.

Definition at line 877 of file ui_node_container.cpp.

References EXTRADATA, and uiNode::initNode().

Referenced by uiBaseInventoryNode::initNode().

void uiContainerNode::onCapturedMouseMove ( uiNode_t node,
int  x,
int  y 
)
overridevirtual

Mouse move event in the node when captured

Reimplemented from uiLocatedNode.

Definition at line 819 of file ui_node_container.cpp.

References oldMouseX, oldMouseY, UI_DNDDragItem(), and UI_MouseRelease().

bool uiContainerNode::onDndEnter ( uiNode_t node)
overridevirtual

Call when a DND enter into the node.

Reimplemented from uiLocatedNode.

Definition at line 892 of file ui_node_container.cpp.

References DND_ITEM, EXTRADATA, UI_DNDGetSourceNode(), UI_DNDGetType(), and UI_IsScrollContainerNode().

bool uiContainerNode::onDndFinished ( uiNode_t node,
bool  isDroped 
)
overridevirtual
void uiContainerNode::onDndLeave ( uiNode_t node)
overridevirtual

Call when a DND enter into the node.

Reimplemented from uiLocatedNode.

Definition at line 980 of file ui_node_container.cpp.

References dragInfoToX, and dragInfoToY.

bool uiContainerNode::onDndMove ( uiNode_t target,
int  x,
int  y 
)
overridevirtual

Call into the target when the DND hover it.

Returns
True if the DND is accepted

We calculate the position of the top-left corner of the dragged item in oder to compensate for the centered-drawn cursor-item. Or to be more exact, we calculate the relative offset from the cursor location to the middle of the top-left square of the item.

See also
UI_LeftClick

Reimplemented from uiLocatedNode.

Definition at line 902 of file ui_node_container.cpp.

References C_UNIT, Inventory::canHoldItem(), Inventory::containsItem(), Item::def(), dragInfoIC, dragInfoToX, dragInfoToY, EXTRADATA, Inventory::findSpace(), Inventory::getItemAtPos(), invDef_s::id, INV_DOES_NOT_FIT, invDef_s::isEquipDef(), invDef_s::isFloorDef(), objDef_s::isLoadableInWeapon(), mousePosX, mousePosY, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, invDef_s::single, objDef_s::sx, objDef_s::sy, UI_DNDGetItem(), UI_GetNodeAbsPos(), and UI_IsScrollContainerNode().

void uiContainerNode::onLoaded ( uiNode_t node)
overridevirtual

Calculates the size of a container node and links the container into the node (uses the invDef_t shape bitmask to determine the size)

Parameters
[in,out]nodeThe node to get the size for
Todo:
find a better way to add more equip node, without this hack

Reimplemented from uiNode.

Definition at line 384 of file ui_node_container.cpp.

References uiNode_t::box, C_UNIT, EXTRADATA, i, INVSH_GetInventoryDefinitionByID(), uiNode_t::name, name, Q_strstart(), invDef_s::shape, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, uiBox_t::size, and UI_IsScrollContainerNode().

void uiContainerNode::onLoading ( uiNode_t node)
overridevirtual

Called before script initialization, initialized default values

Reimplemented from uiNode.

Definition at line 883 of file ui_node_container.cpp.

References uiNode_t::color, and EXTRADATA.

void uiContainerNode::onMouseDown ( uiNode_t node,
int  x,
int  y,
int  button 
)
overridevirtual
void uiContainerNode::onMouseUp ( uiNode_t node,
int  x,
int  y,
int  button 
)
overridevirtual

Mouse button up event in the node

Reimplemented from uiLocatedNode.

Definition at line 865 of file ui_node_container.cpp.

References K_MOUSE1, UI_DNDDrop(), UI_DNDIsDragging(), UI_GetMouseCapture(), and UI_MouseRelease().


The documentation for this class was generated from the following files: