UFO: Alien Invasion
Loading...
Searching...
No Matches
uiContainerNode Class Reference

#include <ui_node_container.h>

Inheritance diagram for uiContainerNode:
Inheritance graph
Collaboration diagram for uiContainerNode:
Collaboration graph

Public Member Functions

void draw (uiNode_t *node) override
 Main function to draw a container node.
void drawTooltip (const uiNode_t *node, int x, int y) const override
 Custom tooltip for container node.
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).
bool onDndEnter (uiNode_t *node) override
 Call when a DND enter into the node.
bool onDndMove (uiNode_t *node, int x, int y) override
 Call into the target when the DND hover it.
void onDndLeave (uiNode_t *node) override
 Call when a DND enter into the node.
bool onDndFinished (uiNode_t *node, bool isDroped) override
 Call into the source when the DND end.
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.
virtual void onSizeChanged (uiNode_t *node)
 Callback stub.
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.
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.
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).
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

◆ draw()

◆ drawTooltip()

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

◆ initNode()

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

◆ onCapturedMouseMove()

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 dragInfoIC, oldMouseX, oldMouseY, UI_DNDDragItem(), and UI_MouseRelease().

◆ onDndEnter()

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

◆ onDndFinished()

bool uiContainerNode::onDndFinished ( uiNode_t * node,
bool isDroped )
overridevirtual

◆ onDndLeave()

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.

◆ onDndMove()

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, Item::def(), dragInfoIC, dragInfoToX, dragInfoToY, EXTRADATA, invDef_t::id, INV_DOES_NOT_FIT, invDef_t::isEquipDef(), invDef_t::isFloorDef(), objDef_t::isLoadableInWeapon(), mousePosX, mousePosY, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, invDef_t::single, objDef_t::sx, objDef_t::sy, UI_DNDGetItem(), UI_GetNodeAbsPos(), ui_inventory, and UI_IsScrollContainerNode().

◆ onLoaded()

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(), name, uiNode_t::name, Q_strstart(), invDef_t::shape, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, uiBox_t::size, and UI_IsScrollContainerNode().

◆ onLoading()

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.

◆ onMouseDown()

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

◆ onMouseUp()

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: