1 /**
2  * @file
3  */
4 
5 /*
6 Copyright (C) 2002-2013 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 
27 #include "../../common/scripts.h"
28 
29 struct uiNode_t;
30 struct uiAction_s;
31 struct value_s;
32 
33 bool UI_ParseWindow(const char* type, const char* name, const char** text);
34 bool UI_ParseComponent(const char* type, const char* name, const char** text);
35 bool UI_ParseSprite(const char* name, const char** text);
36 bool UI_ParseUIModel(const char* name, const char** text);
37 float UI_GetReferenceFloat(uiNode_t const* node, const void* ref);
38 const char* UI_GetReferenceString(uiNode_t const* node, const char* ref) __attribute__ ((warn_unused_result));
39 const value_t* UI_FindPropertyByName(const value_t* propertyList, const char* name) __attribute__ ((warn_unused_result));
40 char* UI_AllocStaticString(const char* string, int size) __attribute__ ((warn_unused_result));
41 float* UI_AllocStaticFloat(int count) __attribute__ ((warn_unused_result));
42 vec4_t* UI_AllocStaticColor(int count) __attribute__ ((warn_unused_result));
43 struct uiAction_s* UI_AllocStaticAction(void) __attribute__ ((warn_unused_result));
44 bool UI_InitRawActionValue(struct uiAction_s* action, uiNode_t* node, const struct value_s* property, const char* string);
45 
46 /* main special type */
47 /** @todo we should split/flag parse type (type need only 1 lex; and other) */
48 #define	V_UI_MASK			0x8F00			/**< Mask for all UI bits */
49 #define	V_UI				0x8000			/**< bit identity an UI type */
50 #define V_NOT_UI			0
51 #define	V_UI_ACTION			(V_UI + 0)		/**< Identify an action type into the value_t structure */
52 #define V_UI_EXCLUDERECT	(V_UI + 1)		/**< Identify a special attribute, use special parse function */
53 #define V_UI_SPRITEREF		(V_UI + 3)		/**< Identify a special attribute, use special parse function */
54 #define V_UI_IF				(V_UI + 4)		/**< Identify a special attribute, use special parse function */
55 #define V_UI_DATAID			(V_UI + 5)
56 #define V_UI_CVAR			(V_UI + 0x0100) /**< Property is a CVAR string (mix this flag with base type, see bellow) */
57 #define V_UI_REF			(V_UI + 0x0200) /**< Property is a ref into a value (mix this flag with base type, see bellow) */
58 #define V_UI_NODEMETHOD		(V_UI + 0x0400) /**< Property is a function */
59 
60 /* alias */
61 #define V_UI_ALIGN			V_INT
62 
63 /* composite special type */
64 #define V_CVAR_OR_FLOAT			(V_UI_CVAR + V_FLOAT)
65 #define V_CVAR_OR_STRING		(V_UI_CVAR + V_STRING)
66 #define V_CVAR_OR_LONGSTRING	(V_UI_CVAR + V_LONGSTRING)
67 #define V_REF_OF_STRING			(V_UI_REF + V_STRING)
68