ui_node_todo.c

Go to the documentation of this file.
00001 
00006 /*
00007 Copyright (C) 2002-2010 UFO: Alien Invasion.
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018 See the GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 

Generated by  doxygen 1.6.2