ui_node_todo.c
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "../ui_nodes.h"
00027 #include "../ui_parse.h"
00028 #include "../ui_draw.h"
00029 #include "../ui_tooltip.h"
00030 #include "../ui_render.h"
00031 #include "ui_node_todo.h"
00032 #include "ui_node_abstractnode.h"
00033
00034 #include "../../input/cl_input.h"
00035
00042 static void UI_TodoNodeDrawTooltip (uiNode_t *node, int x, int y)
00043 {
00044 const int tooltipWidth = 250;
00045 static char tooltiptext[1024];
00046
00047 const char* text = UI_GetReferenceString(node, node->text);
00048 if (!text)
00049 return;
00050
00051 tooltiptext[0] = '\0';
00052 Q_strcat(tooltiptext, text, sizeof(tooltiptext));
00053 UI_DrawTooltip(tooltiptext, x, y, tooltipWidth);
00054 }
00055
00056 static void UI_TodoNodeDraw (uiNode_t *node)
00057 {
00058 static vec4_t red = {1.0, 0.0, 0.0, 1.0};
00059 vec2_t pos;
00060
00061 UI_GetNodeAbsPos(node, pos);
00062 UI_DrawFill(pos[0], pos[1], node->size[0], node->size[1], red);
00063
00064 if (node->state)
00065 UI_CaptureDrawOver(node);
00066 }
00067
00068 static void UI_TodoNodeDrawOverWindow (uiNode_t *node)
00069 {
00070 UI_TodoNodeDrawTooltip(node, mousePosX, mousePosY);
00071 }
00072
00073 static void UI_TodoNodeLoading (uiNode_t *node)
00074 {
00075 Vector4Set(node->color, 1.0, 1.0, 1.0, 1.0);
00076 }
00077
00078 static void UI_TodoNodeLoaded (uiNode_t *node)
00079 {
00080 #ifndef DEBUG
00081 node->invis = qtrue;
00082 #endif
00083 node->size[0] = 10;
00084 node->size[1] = 10;
00085 }
00086
00087 void UI_RegisterTodoNode (uiBehaviour_t *behaviour)
00088 {
00089 behaviour->name = "todo";
00090 behaviour->extends = "string";
00091 behaviour->draw = UI_TodoNodeDraw;
00092 behaviour->drawOverWindow = UI_TodoNodeDrawOverWindow;
00093 behaviour->loading = UI_TodoNodeLoading;
00094 behaviour->loaded = UI_TodoNodeLoaded;
00095 }
00096