UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_container.h
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25#pragma once
26
28#define C_UNIT 25
29
30/* prototypes */
31struct base_s;
32struct uiBehaviour_t;
33struct uiNode_t;
34
36public:
37 void draw(uiNode_t* node) override;
38 void drawTooltip(const uiNode_t* node, int x, int y) const override;
39 void initNode (uiNode_t* node) override;
40 void onMouseDown(uiNode_t* node, int x, int y, int button) override;
41 void onMouseUp(uiNode_t* node, int x, int y, int button) override;
42 void onCapturedMouseMove(uiNode_t* node, int x, int y) override;
43 void onLoading(uiNode_t* node) override;
44 void onLoaded(uiNode_t* node) override;
45 bool onDndEnter(uiNode_t* node) override;
46 bool onDndMove(uiNode_t* node, int x, int y) override;
47 void onDndLeave(uiNode_t* node) override;
48 bool onDndFinished(uiNode_t* node, bool isDroped) override;
49};
50
52
54void UI_DrawItem(uiNode_t* node, const vec3_t org, const Item* item, int x, int y, const vec3_t scale, const vec4_t color);
56uiNode_t* UI_GetContainerNodeByContainerIDX(const uiNode_t* const parent, const int index);
58void UI_GetItemTooltip (const Item& item, char* tooltipText, size_t stringMaxLength);
59
64typedef struct containerExtraData_s {
65 /* for all containers */
67
69 struct uiAction_s* onSelect;
inventory definition with all its containers
Definition inv_shared.h:525
item instance data, with linked list capability
Definition inv_shared.h:402
void initNode(uiNode_t *node) override
void onMouseUp(uiNode_t *node, int x, int y, int button) 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 shap...
void onLoading(uiNode_t *node) override
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 draw(uiNode_t *node) override
Main function to draw a container node.
void onDndLeave(uiNode_t *node) override
Call when a DND enter into the node.
void onMouseDown(uiNode_t *node, int x, int y, int button) override
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
bool onDndFinished(uiNode_t *node, bool isDroped) override
Call into the source when the DND end.
void drawTooltip(const uiNode_t *node, int x, int y) const override
Custom tooltip for container node.
QGL_EXTERN GLuint index
Definition r_gl.h:110
int LUA_EVENT
holds a reference to a lua event handler
Definition scripts_lua.h:49
extradata for container widget
struct uiAction_s * onSelect
const invDef_t * container
inventory definition for our menus
Definition inv_shared.h:371
node behaviour, how a node work
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec4_t[4]
Definition ufotypes.h:40
static const vec3_t scale
Inventory * ui_inventory
uiNode_t * UI_GetContainerNodeByContainerIDX(const uiNode_t *const parent, const int index)
Search a child container node by the given container id.
void UI_ContainerNodeAutoPlaceItem(uiNode_t *node, Item *ic)
Try to autoplace an item from a container.
void UI_DrawItem(uiNode_t *node, const vec3_t org, const Item *item, int x, int y, const vec3_t scale, const vec4_t color)
Draws an item to the screen.
void UI_GetItemTooltip(const Item &item, char *tooltipText, size_t stringMaxLength)
Generate tooltip text for an item.
void UI_ContainerNodeUpdateEquipment(Inventory *inv, const equipDef_t *ed)
Fills the ground container of the ui_inventory with unused items from a given equipment definition.
void UI_RegisterContainerNode(uiBehaviour_t *behaviour)