UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_container.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, 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 */
31 struct base_s;
32 struct uiBehaviour_t;
33 struct uiNode_t;
34 
36 public:
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 
51 extern Inventory* ui_inventory;
52 
54 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);
56 uiNode_t* UI_GetContainerNodeByContainerIDX(const uiNode_t* const parent, const int index);
58 void UI_GetItemTooltip (const Item& item, char* tooltipText, size_t stringMaxLength);
59 
64 typedef struct containerExtraData_s {
65  /* for all containers */
69  struct uiAction_s* onSelect;
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
void initNode(uiNode_t *node) override
void onDndLeave(uiNode_t *node) override
Call when a DND enter into the node.
static const vec3_t scale
void UI_GetItemTooltip(const Item &item, char *tooltipText, size_t stringMaxLength)
Generate tooltip text for an item.
int LUA_EVENT
holds a reference to a lua event handler
Definition: scripts_lua.h:49
void drawTooltip(const uiNode_t *node, int x, int y) const override
Custom tooltip for container node.
void UI_ContainerNodeAutoPlaceItem(uiNode_t *node, Item *ic)
Try to autoplace an item from a container.
bool onDndEnter(uiNode_t *node) override
Call when a DND enter into the node.
void onMouseDown(uiNode_t *node, int x, int y, int button) override
A base with all it's data.
Definition: cp_base.h:84
item instance data, with linked list capability
Definition: inv_shared.h:402
inventory definition with all its containers
Definition: inv_shared.h:525
extradata for container widget
void UI_RegisterContainerNode(uiBehaviour_t *behaviour)
uiNode_t * UI_GetContainerNodeByContainerIDX(const uiNode_t *const parent, const int index)
Search a child container node by the given container id.
const invDef_t * container
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
QGL_EXTERN GLuint index
Definition: r_gl.h:110
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 onLoaded(uiNode_t *node) override
Calculates the size of a container node and links the container into the node (uses the invDef_t shap...
struct containerExtraData_s containerExtraData_t
extradata for container widget
Inventory * ui_inventory
node behaviour, how a node work
Definition: ui_behaviour.h:39
bool onDndMove(uiNode_t *node, int x, int y) override
Call into the target when the DND hover it.
void onMouseUp(uiNode_t *node, int x, int y, int button) override
vec_t vec3_t[3]
Definition: ufotypes.h:39
inventory definition for our menus
Definition: inv_shared.h:371
struct uiAction_s * onSelect
void onLoading(uiNode_t *node) override
Atomic element to store UI scripts The parser use this atom to translate script action into many tree...
Definition: ui_actions.h:144
void draw(uiNode_t *node) override
Main function to draw a container node.
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...
bool onDndFinished(uiNode_t *node, bool isDroped) override
Call into the source when the DND end.
vec_t vec4_t[4]
Definition: ufotypes.h:40