28 #include "../ui_main.h"
29 #include "../ui_parse.h"
30 #include "../ui_behaviour.h"
31 #include "../ui_draw.h"
32 #include "../ui_input.h"
33 #include "../ui_nodes.h"
34 #include "../ui_windows.h"
35 #include "../ui_render.h"
36 #include "../ui_actions.h"
40 #include "../../input/cl_keys.h"
41 #include "../../input/cl_input.h"
43 #include "../../../common/scripts_lua.h"
82 if (x > 0 && x < node->box.size[0] && y > 0 && y < node->box.size[1]) {
124 if (hovered && hovered->
root == node->
root)
128 if (hovered && hovered != anchoredNode)
138 const int diffX = x -
startX;
139 const int diffY = y -
startY;
143 if (anchoredNode ==
nullptr)
150 anchoredNode->
box.
pos[0] += diffX;
151 anchoredNode->
box.
pos[1] += diffY;
152 size[0] = anchoredNode->
box.
size[0] - diffX;
153 size[1] = anchoredNode->
box.
size[1] - diffY;
156 anchoredNode->
box.
pos[1] += diffY;
157 size[0] = anchoredNode->
box.
size[0] + diffX;
158 size[1] = anchoredNode->
box.
size[1] - diffY;
161 anchoredNode->
box.
pos[0] += diffX;
162 size[0] = anchoredNode->
box.
size[0] - diffX;
163 size[1] = anchoredNode->
box.
size[1] + diffY;
166 size[0] = anchoredNode->
box.
size[0] + diffX;
167 size[1] = anchoredNode->
box.
size[1] + diffY;
170 anchoredNode->
box.
pos[0] += diffX;
171 anchoredNode->
box.
pos[1] += diffY;
172 size[0] = anchoredNode->
box.
size[0];
173 size[1] = anchoredNode->
box.
size[1];
206 if (selected ==
nullptr)
211 anchoredNode = selected;
212 Cvar_Set(
"ui_sys_editor_node",
"%s", anchoredNode->
name);
228 if (hovered && hovered->
root == node->
root) {
233 if (hovered == anchoredNode)
239 if (hovered ==
nullptr) {
269 if (anchoredNode ==
nullptr)
278 if (anchoredNode ==
nullptr)
287 if (anchoredNode ==
nullptr)
298 for (i = 0; i < depth; i++) {
351 behaviour->
name =
"editor";
const char * Cmd_Argv(int arg)
Returns a given argument.
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
static uiNode_t * anchoredNode
void Sys_Error(const char *error,...)
int FS_OpenFile(const char *filename, qFILE *file, filemode_t mode)
Finds and opens the file in the search path.
int UI_CompleteWithWindow(const char *partial, const char **match)
Complete function for ui_push.
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
void UI_CaptureDrawOver(uiNode_t *node)
Capture a node we will draw over all nodes (per window)
static zoneNode_t dragStatus
void onMouseUp(uiNode_t *node, int x, int y, int button) override
static void UI_EditorNodeHighlightNode(uiNode_t *node, const vec4_t color, bool displayAnchor)
static zoneNode_t UI_EditorNodeGetElementAtPosition(uiNode_t *node, int x, int y)
uiNode_t * UI_GetNodeAtPosition(int x, int y)
Return the first visible node at a position.
uiBehaviour_t * behaviour
void drawOverWindow(uiNode_t *node) override
static void UI_EditorNodeStop(uiNode_t *node, const uiCallContext_t *context)
void UI_RegisterEditorNode(uiBehaviour_t *behaviour)
void Com_Printf(const char *const fmt,...)
static void UI_EditorNodeSelectNext(uiNode_t *node, const uiCallContext_t *context)
static void UI_EditorNodeSelectNode(uiNode_t *node, uiNode_t *selected)
static void UI_EditorNodeSelectParent(uiNode_t *node, const uiCallContext_t *context)
void onMouseDown(uiNode_t *node, int x, int y, int button) override
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
SharedPtr< uiNode > UINodePtr
static void UI_EditorNodeSelectFirstChild(uiNode_t *node, const uiCallContext_t *context)
int FS_Printf(qFILE *f, const char *msg,...)
Can print chunks for 1024 chars into a file.
Atomic structure used to define most of the UI.
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
void draw(uiNode_t *node) override
Contain the context of the calling of a function.
uiNode_t * UI_GetWindow(const char *name)
Searches all windows for the specified one.
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
static void UI_EditorNodeExtractNode(qFILE *file, uiNode_t *node, int depth)
void onCapturedMouseLost(uiNode_t *node) override
Called when the node have lost the captured node.
void UI_NodeAbsoluteToRelativePos(const uiNode_t *node, int *x, int *y)
Update an absolute position to a relative one.
node behaviour, how a node work
static void UI_EditorNodeExtract_f(void)
void Cmd_AddParamCompleteFunction(const char *cmdName, int(*function)(const char *partial, const char **match))
void UI_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
static const int anchorSize
static void UI_EditorNodeStart(uiNode_t *node, const uiCallContext_t *context)
void UI_NodeSetSize(uiNode_t *node, vec2_t size)
Update the node size and fire the size callback.
const struct value_s * UI_RegisterNodeMethod(uiBehaviour_t *behaviour, const char *name, uiNodeMethod_t function)
Register a node method to a behaviour.