UI_AbstractScrollableNodeSetY(node, EXTRADATA(node).scrollY.fullSize, -1, -1);
}

/**
 * @brief Scroll the Y scroll with a relative position, and call event if need
 * @return True, if something have change
 */
qboolean UI_AbstractScrollableNodeScrollY (uiNode_t *node, int offset)
{
	assert(UI_NodeInstanceOf(node, "abstractscrollable"));
	return UI_AbstractScrollableNodeSetY(node, EXTRADATA(node).scrollY.viewPos + offset, -1, -1);
}

static const value_t properties[] = {
	/* position of the vertical view (into the full number of elements the node contain) */
	{"viewpos", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.viewPos),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.viewPos)},
	/* size of the vertical view (proportional to the number of elements the node can display without moving) */
	{"viewsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.viewSize),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.viewSize)},
	/* full vertical size (proportional to the number of elements the node contain) */
	{"fullsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.fullSize),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.fullSize)},
	/* Called when one of the properties viewpos/viewsize/fullsize change */
	{"onviewchange", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, onViewChange), MEMBER_SIZEOF(EXTRADATA_TYPE, onViewChange)},

	/* Call it to vertically scroll the document up */
	{"pageup", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodePageUp), 0},
	/* Call it to vertically scroll the document down */
	{"pagedown", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodePageDown), 0},
	/* Call it to vertically scroll the document up */
	{"moveup", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodeMoveUp), 0},
	/* Call it to vertically scroll the document down */
	{"movedown", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodeMoveDown), 0},
Beispiel #2
0
		B_DrawBuilding(entry);
	}
}

/**
 * @brief Called before loading. Used to set default attribute values
 */
static void UI_BaseLayoutNodeLoading (uiNode_t *node)
{
	node->padding = 3;
	Vector4Set(node->color, 1, 1, 1, 1);
}

static const value_t properties[] = {
	/* Identify the base, from a base ID, the node use. */
	{"baseid", V_INT, UI_EXTRADATA_OFFSETOF(baseExtraData_t, baseid), MEMBER_SIZEOF(baseExtraData_t, baseid)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterAbstractBaseNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "abstractbase";
	behaviour->isAbstract = qtrue;
	behaviour->properties = properties;
	behaviour->loaded = UI_AbstractBaseNodeLoaded;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}

void UI_RegisterBaseMapNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "basemap";
Beispiel #3
0
	}

	text = UI_GetReferenceString(node, node->text);
	if (text != NULL && *text != '\0') {
		R_Color(textColor);
		UI_DrawStringInBox(font, node->contentAlign,
			pos[0] + node->padding, pos[1] + node->padding,
			node->size[0] - node->padding - node->padding, node->size[1] - node->padding - node->padding,
			text, LONGLINES_PRETTYCHOP);
		R_Color(NULL);
	}
}

static const value_t properties[] = {
	/* Skin position. Define the top-left position of the skin we will used from the image. Y should not be bigger than 64. To compute the high corner we use the node size. */
	{"texl", V_POS, UI_EXTRADATA_OFFSETOF(customButtonExtraData_t, texl), MEMBER_SIZEOF(customButtonExtraData_t, texl)},
	/* Sprite used to display the background */
	{"background", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, background), MEMBER_SIZEOF(EXTRADATA_TYPE, background)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterCustomButtonNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "custombutton";
	behaviour->extends = "button";
	behaviour->draw = UI_CustomButtonNodeDraw;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#include "../ui_nodes.h"
#include "ui_node_abstractscrollbar.h"

#define EXTRADATA_TYPE abstractScrollbarExtraData_t

static const value_t properties[] = {
	/* Current position of the scroll. Image of the <code>viewpos</code> from <code>abstractscrollable</code> node. */
	{"current", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, pos),  MEMBER_SIZEOF(EXTRADATA_TYPE, pos)},
	/* Image of the <code>viewsize</code> from <code>abstractscrollable</code> node. */
	{"viewsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, viewsize),  MEMBER_SIZEOF(EXTRADATA_TYPE, viewsize)},
	/* Image of the <code>fullsize</code> from <code>abstractscrollable</code> node. */
	{"fullsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, fullsize),  MEMBER_SIZEOF(EXTRADATA_TYPE, fullsize)},

	/* If true, hide the scroll when the position is 0 and can't change (when <code>viewsize</code> >= <code>fullsize</code>). */
	{"hidewhenunused", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, hideWhenUnused),  MEMBER_SIZEOF(EXTRADATA_TYPE, hideWhenUnused)},

	/* Callback value set when before calling onChange. It is used to know the change apply by the user
	 * @Deprecated
	 */
	{"lastdiff", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, lastdiff),  MEMBER_SIZEOF(EXTRADATA_TYPE, lastdiff)},

	{NULL, V_NULL, 0, 0}
};
Beispiel #5
0
		UI_TimerRelease(capturedTimer);
		capturedTimer = NULL;
	}
}

/**
 * @brief Call before the script initialized the node
 */
static void UI_ZoneNodeLoading (uiNode_t *node)
{
	EXTRADATA(node).clickDelay = 1000;
}

static const value_t properties[] = {
	/* If true, the <code>onclick</code> call back is called more than one time if the user do not release the button. */
	{"repeat", V_BOOL, UI_EXTRADATA_OFFSETOF(zoneExtraData_t, repeat), MEMBER_SIZEOF(zoneExtraData_t, repeat)},
	/* Delay it is used between 2 calls of <code>onclick</code>. */
	{"clickdelay", V_INT, UI_EXTRADATA_OFFSETOF(zoneExtraData_t, clickDelay), MEMBER_SIZEOF(zoneExtraData_t, clickDelay)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterZoneNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "zone";
	behaviour->loading = UI_ZoneNodeLoading;
	behaviour->mouseDown = UI_ZoneNodeDown;
	behaviour->mouseUp = UI_ZoneNodeUp;
	behaviour->capturedMouseLost = UI_ZoneNodeCapturedMouseLost;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
Beispiel #6
0
     * Normal button start at 0x0, mouse over start at 64x0, mouse click
     * start at 0x64 (but not yet implemented), and disabled start at 64x64.
     * See the image to have a usable template for this node.
     * @image html http://ufoai.ninex.info/wiki/images/Button_blue.png
     */
    /* @override onclick
     * Call back event called when we click on the node. If the click select the node,
     * it called before we start the cvar edition.
     */
    /* @override onchange
     * Call back event (like click...) fired when the text is changed, after
     * validation. An abort of the edition dont fire this event.
     */

    /* Custom the draw behaviour by hiding each character of the text with a star (''*''). */
    {"ispassword", V_BOOL, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, isPassword), MEMBER_SIZEOF(textEntryExtraData_t, isPassword)},
    /* ustom the mouse event behaviour. When we are editing the text, if we click out of the node, the edition is aborted. Changes on
     * the text are canceled, and no change event are fired.
     */
    {"clickoutabort", V_BOOL, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, clickOutAbort), MEMBER_SIZEOF(textEntryExtraData_t, clickOutAbort)},
    /* Call it when we abort the edition */
    {"onabort", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, onAbort), MEMBER_SIZEOF(textEntryExtraData_t, onAbort)},
    /* Call it to force node edition */
    {"edit", V_UI_NODEMETHOD, ((size_t) UI_TextEntryNodeFocus), 0},

    {NULL, V_NULL, 0, 0}
};

void UI_RegisterTextEntryNode (uiBehaviour_t *behaviour)
{
    behaviour->name = "textentry";
Beispiel #7
0
static void UI_OptionPropertyChanged (uiNode_t *node, const value_t *property)
{
	if (property == propertyCollapsed) {
		UI_Invalidate(node);
		return;
	}
	ui_optionBehaviour->super->propertyChanged(node, property);
}

/** @brief valid properties for options (used by selectbox, tab, optonlist and optiontree) */
static const value_t properties[] = {
	/**
	 * Displayed text
	 */
	{"label", V_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, label), 0},

	/**
	 * Value of the option
	 */
	{"value", V_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, value), 0},

	/**
	 * If true, child are not displayed
	 */
	{"collapsed", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, collapsed), MEMBER_SIZEOF(EXTRADATA_TYPE, collapsed)},

	/* Icon used to display the node
	 */
	{"icon", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, icon), MEMBER_SIZEOF(EXTRADATA_TYPE, icon)},
Beispiel #8
0
static void UI_VideoNodeInit (uiNode_t *node, linkedList_t *params)
{
	CIN_InitCinematic(&(EXTRADATA(node).cin));
}

static void UI_VideoNodeClose (uiNode_t *node)
{
	/* If playing a cinematic, stop it */
	CIN_CloseCinematic(&(EXTRADATA(node).cin));
}

static const value_t properties[] = {
	/** Source of the video. File name without prefix ./base/videos and without extension */
	{"src", V_CVAR_OR_STRING, offsetof(uiNode_t, image), 0},
	/** Use or not the music from the video. */
	{"nosound", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, nosound), MEMBER_SIZEOF(EXTRADATA_TYPE, nosound)},
	/** Invoked when video end. */
	{"onEnd", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(videoExtraData_t, onEnd), MEMBER_SIZEOF(videoExtraData_t, onEnd)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterVideoNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "video";
	behaviour->draw = UI_VideoNodeDraw;
	behaviour->properties = properties;
	behaviour->windowOpened = UI_VideoNodeInit;
	behaviour->windowClosed = UI_VideoNodeClose;
	behaviour->drawOverWindow = UI_VideoNodeDrawOverWindow;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
Beispiel #9
0
}

/**
 * @brief Call before the script initialization of the node
 */
static void UI_KeyBindingNodeLoading (uiNode_t *node)
{
	node->padding = 8;
	node->contentAlign = ALIGN_CL;
	EXTRADATA(node).bindingWidth = 50;
	Vector4Set(node->color, 1, 1, 1, 1);
	Vector4Set(node->selectedColor, 1, 1, 1, 0.5);
}

static const value_t properties[] = {
	{"keyspace", V_INT, UI_EXTRADATA_OFFSETOF(keyBindingExtraData_t, keySpace), MEMBER_SIZEOF(keyBindingExtraData_t, keySpace)},
	{"bindingwidth", V_INT, UI_EXTRADATA_OFFSETOF(keyBindingExtraData_t, bindingWidth), MEMBER_SIZEOF(keyBindingExtraData_t, bindingWidth)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterKeyBindingNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "keybinding";
	behaviour->leftClick = UI_KeyBindingNodeClick;
	behaviour->keyPressed = UI_KeyBindingNodeKeyPressed;
	behaviour->draw = UI_KeyBindingNodeDraw;
	behaviour->loading = UI_KeyBindingNodeLoading;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
Beispiel #10
0
	lineStrip = ui_global.sharedData[dataId].data.lineStrip;
	for (; lineStrip; lineStrip = lineStrip->next) {
		/* Draw this line if it's valid. */
		if (lineStrip->pointList && lineStrip->numPoints > 0) {
			R_Color(lineStrip->color);
			R_DrawLineStrip(lineStrip->numPoints, lineStrip->pointList);
		}
	}
	R_Color(NULL);

	UI_Transform(NULL, NULL, NULL);
}

static const value_t properties[] = {
	/* Identity the shared data the node use. It must be a LINESTRIP data. */
	{"dataid", V_UI_DATAID, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, dataId), MEMBER_SIZEOF(lineChartExtraData_t, dataId)},
	/* If true, it display axes of the chart. */
	{"displayaxes", V_BOOL, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, displayAxes), MEMBER_SIZEOF(lineChartExtraData_t, displayAxes)},
	/* Axe color. */
	{"axescolor", V_COLOR, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, axesColor), MEMBER_SIZEOF(lineChartExtraData_t, axesColor)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterLineChartNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "linechart";
	behaviour->draw = UI_LineChartNodeDraw;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
Beispiel #11
0
}

/**
 * @brief Handles radio button clicks
 */
static void UI_RadioButtonNodeClick (uiNode_t * node, int x, int y)
{
	if (node->onClick)
		UI_ExecuteEventActions(node, node->onClick);

	UI_RadioButtonNodeActivate(node);
}

static const value_t properties[] = {
	/* Numerical value defining the radiobutton. Cvar is updated with this value when the radio button is selected. */
	{"value", V_FLOAT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, value), MEMBER_SIZEOF(EXTRADATA_TYPE, value)},
	/* String Value defining the radiobutton. Cvar is updated with this value when the radio button is selected. */
	{"stringValue", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, string), 0},

	/* Cvar name shared with the radio button group to identify when a radio button is selected. */
	{"cvar", V_UI_CVAR, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, cvar), 0},
	/* Icon used to display the node */
	{"icon", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, icon), MEMBER_SIZEOF(EXTRADATA_TYPE, icon)},
	{"flipicon", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, flipIcon), MEMBER_SIZEOF(EXTRADATA_TYPE, flipIcon)},
	/* Sprite used to display the background */
	{"background", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, background), MEMBER_SIZEOF(EXTRADATA_TYPE, background)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterRadioButtonNode (uiBehaviour_t *behaviour)
Beispiel #12
0
		EXTRADATA(node).tag = NULL;
	}

	if (EXTRADATA(node).oldRefValue == NULL)
		EXTRADATA(node).oldRefValue = UI_AllocStaticString("", MAX_OLDREFVALUE);

	/* no tag but no size */
	if (EXTRADATA(node).tag == NULL && (node->size[0] == 0 || node->size[1] == 0)) {
		Com_Printf("UI_ModelNodeLoaded: Please set a pos and size to the node '%s'. Note: 'origin' is a relative value to the center of the node\n", UI_GetPath(node));
	}
}

/** @brief valid properties for model */
static const value_t properties[] = {
	/* Both. Name of the animation for the model */
	{"anim", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, animation), 0},
	/* Main model only. Point of view. */
	{"angles", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, angles), MEMBER_SIZEOF(modelExtraData_t, angles)},
	/* Main model only. Position of the model relative to the center of the node. */
	{"origin", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, origin), MEMBER_SIZEOF(modelExtraData_t, origin)},
	/* Main model only. Rotation vector of the model. */
	{"omega", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, omega), MEMBER_SIZEOF(modelExtraData_t, omega)},
	/* Both. Scale the model */
	{"scale", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, scale), MEMBER_SIZEOF(modelExtraData_t, scale)},
	/* Submodel only. A tag name to link the model to the parent model. */
	{"tag", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, tag), 0},
	/* Main model only. Auto compute the "better" scale for the model. The function dont work
	 * very well at the moment because it dont check the angle and no more submodel bounding box.
	 */
	{"autoscale", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, autoscale), MEMBER_SIZEOF(modelExtraData_t, autoscale)},
	/* Main model only. Allow to change the POV of the model with the mouse (only for main model) */