示例#1
0
void UI_RegisterRowsNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "rows";
	behaviour->manager = new uiRowsNode();
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* Background color for odd elements */
	UI_RegisterNodeProperty(behaviour, "color1", V_COLOR, uiNode_t, color);
	/* Background color for even elements */
	UI_RegisterNodeProperty(behaviour, "color2", V_COLOR, uiNode_t, selectedColor);
	/* Element height */
	UI_RegisterExtradataNodeProperty(behaviour, "lineheight", V_INT, rowsExtraData_t, lineHeight);
	/* Element number on the top of the list. It is used to scroll the node content. */
	UI_RegisterExtradataNodeProperty(behaviour, "current", V_INT, rowsExtraData_t, current);
}
示例#2
0
void UI_RegisterTextureNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "texture";
	behaviour->manager = UINodePtr(new uiTextureNode());
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* Source of the texture */
	UI_RegisterNodeProperty(behaviour, "src", V_CVAR_OR_STRING, uiNode_t, image);
}
示例#3
0
void UI_RegisterVScrollbarNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "vscrollbar";
	behaviour->extends = "abstractscrollbar";
	behaviour->manager = UINodePtr(new uiVScrollbarNode());

	/* Image to use. Each behaviour use it like they want.
	 * @todo use V_REF_OF_STRING when its possible ('image' is never a cvar)
	 */
	UI_RegisterNodeProperty(behaviour, "image", V_CVAR_OR_STRING, uiNode_t, image);
}
void UI_RegisterImageNode (uiBehaviour_t* behaviour)
{
	/** @todo rename it according to the function name when its possible */
	behaviour->name = "image";
	behaviour->draw = UI_ImageNodeDraw;
	behaviour->loaded = UI_ImageNodeLoaded;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* Do not change the image ratio. The image will be proportionally stretched. */
	UI_RegisterExtradataNodeProperty(behaviour, "preventratio", V_BOOL, imageExtraData_t, preventRatio);
	/* Now this property do nothing. But we use it like a tag, to remember nodes we should convert into button...
	 * @todo delete it when its possible (use more button instead of image)
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "mousefx", V_BOOL, imageExtraData_t, mousefx);

	/* Texture high. Optional. Define the higher corner of the texture we want to display. Used with texl to crop the image. */
	UI_RegisterExtradataNodeProperty(behaviour, "texh", V_POS, imageExtraData_t, texh);
	/* Texture low. Optional. Define the lower corner of the texture we want to display. Used with texh to crop the image. */
	UI_RegisterExtradataNodeProperty(behaviour, "texl", V_POS, imageExtraData_t, texl);

	/* Source of the image */
	UI_RegisterNodeProperty(behaviour, "src", V_CVAR_OR_STRING, uiNode_t, image);
}
void UI_RegisterAbstractNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "abstractnode";
	behaviour->isAbstract = true;
	behaviour->manager = UINodePtr(new uiLocatedNode());

	/* Top-left position of the node */
	UI_RegisterNodeProperty(behaviour, "pos", V_POS, uiNode_t, box.pos);
	/* Size of the node */
	propertySize = UI_RegisterNodeProperty(behaviour, "size", V_POS, uiNode_t, box.size);
	/* Width of the node (see also <code>size</code>) */
	propertyWidth = UI_RegisterNodeProperty(behaviour, "width", V_FLOAT, uiNode_t, box.size[0]);
	/* Height of the node (see also <code>size</code>) */
	propertyHeight = UI_RegisterNodeProperty(behaviour, "height", V_FLOAT, uiNode_t, box.size[1]);
	/* Left position of the node (see also <code>pos</code>) */
	UI_RegisterNodeProperty(behaviour, "left", V_FLOAT, uiNode_t, box.pos[0]);
	/* Top position of the node (see also <code>pos</code>) */
	UI_RegisterNodeProperty(behaviour, "top", V_FLOAT, uiNode_t, box.pos[1]);

	/* If true, the node name is indexed into the window. We can access to the node with
	 * the path "windowName#nodeName"
	 */
	UI_RegisterNodeProperty(behaviour, "indexed", V_BOOL, uiNode_t, indexed);
	/* If true, the node is not displayed nor or activatable. */
	propertyInvis = UI_RegisterNodeProperty(behaviour, "invis", V_BOOL, uiNode_t, invis);
	/* If true, the node is disabled. Few nodes support it, fell free to request an update. */
	UI_RegisterNodeProperty(behaviour, "disabled", V_BOOL, uiNode_t, disabled);
	/* If true, the node is not ''tangible''. We click through it, then it will not receive mouse event. */
	UI_RegisterNodeProperty(behaviour, "ghost", V_BOOL, uiNode_t, ghost);
	/* Flashing effect. */
	UI_RegisterNodeProperty(behaviour, "flash", V_BOOL, uiNode_t, flash);
	/* Speed of the flashing effect */
	UI_RegisterNodeProperty(behaviour, "flashspeed", V_FLOAT, uiNode_t, flashSpeed);
	/* Border size we want to display. */
	UI_RegisterNodeProperty(behaviour, "border", V_INT, uiNode_t, border);
	/* Padding size we want to use. Few node support it. */
	UI_RegisterNodeProperty(behaviour, "padding", V_INT, uiNode_t, padding);
	/* Background color we want to display. */
	UI_RegisterNodeProperty(behaviour, "bgcolor", V_COLOR, uiNode_t, bgcolor);
	/* Border color we want to display. */
	UI_RegisterNodeProperty(behaviour, "bordercolor", V_COLOR, uiNode_t, bordercolor);

	/*
	 * Used to set the position of the node when the parent use a layout manager.
	 * Else it do nothing.
	 * Available values are: LAYOUTALIGN_TOPLEFT, LAYOUTALIGN_TOP, LAYOUTALIGN_TOPRIGHT,
	 * LAYOUTALIGN_LEFT, LAYOUTALIGN_MIDDLE, LAYOUTALIGN_RIGHT, LAYOUTALIGN_BOTTOMLEFT,
	 * LAYOUTALIGN_BOTTOM, LAYOUTALIGN_BOTTOMRIGHT, LAYOUTALIGN_FILL.
	 * Allowed value depend the layout manager used. The update to date list is into
	 * ui_node_panel.c
	 * @image html http://ufoai.org/wiki/images/Layout.png
	 */
	UI_RegisterNodeProperty(behaviour, "align", V_INT, uiNode_t, align);

	/*
	 * Used share an int, only used by 1 behaviour
	 * @todo move it to the right behaviour, delete it
	 */
	UI_RegisterNodeProperty(behaviour, "num", V_INT, uiNode_t, num);

	/* Tooltip we want to use. */
	UI_RegisterNodeProperty(behaviour, "tooltip", V_CVAR_OR_LONGSTRING, uiNode_t, tooltip);
	/* Text the node will display.
	 */
	UI_RegisterNodeProperty(behaviour, "string", V_CVAR_OR_LONGSTRING, uiNode_t, text);
	/* Text font the node will use.
	 * @todo use V_REF_OF_STRING when its possible ('font' is never a cvar).
	 */
	UI_RegisterNodeProperty(behaviour, "font", V_CVAR_OR_STRING, uiNode_t, font);

	/* Text color the node will use. */
	UI_RegisterNodeProperty(behaviour, "color", V_COLOR, uiNode_t, color);
	/* Text color the node will use when something is selected. */
	UI_RegisterNodeProperty(behaviour, "selectcolor", V_COLOR, uiNode_t, selectedColor);
	/* Flashing color */
	UI_RegisterNodeProperty(behaviour, "flashcolor", V_COLOR, uiNode_t, flashColor);
	/* Alignement of the text into the node, or elements into blocks. */
	UI_RegisterNodeProperty(behaviour, "contentalign", V_UI_ALIGN, uiNode_t, contentAlign);
	/* When <code>invis</code> property is false (default value);
	 * this condition say if the node is visible or not. It use a script expression.
	 */
	UI_RegisterNodeProperty(behaviour, "visiblewhen", V_UI_IF, uiNode_t, visibilityCondition);

	/* Called when the user click with left button into the node. */
	UI_RegisterNodeProperty(behaviour, "onclick", V_UI_ACTION, uiNode_t, onClick);
	/* Called when the user click with right button into the node. */
	UI_RegisterNodeProperty(behaviour, "onrclick", V_UI_ACTION, uiNode_t, onRightClick);
	/* Called when the user click with middle button into the node. */
	UI_RegisterNodeProperty(behaviour, "onmclick", V_UI_ACTION, uiNode_t, onMiddleClick);
	/* Called when the user use the mouse wheel over the node. */
	UI_RegisterNodeProperty(behaviour, "onwheel", V_UI_ACTION, uiNode_t, onWheel);
	/* Called when the user use the mouse wheel up over the node. */
	UI_RegisterNodeProperty(behaviour, "onwheelup", V_UI_ACTION, uiNode_t, onWheelUp);
	/* Called when the user use the mouse wheel down over the node. */
	UI_RegisterNodeProperty(behaviour, "onwheeldown", V_UI_ACTION, uiNode_t, onWheelDown);
	/* Called when the mouse enter over the node. */
	UI_RegisterNodeProperty(behaviour, "onmouseenter", V_UI_ACTION, uiNode_t, onMouseEnter);
	/* Called when the mouse go out of the node. */
	UI_RegisterNodeProperty(behaviour, "onmouseleave", V_UI_ACTION, uiNode_t, onMouseLeave);
	/* Called when the internal content of the nde change. Each behaviour use it how they need it.
	 * @todo Move it where it is need.
	 */
	UI_RegisterNodeProperty(behaviour, "onchange", V_UI_ACTION, uiNode_t, onChange);

	/* Special attribute only use into the node description to exclude part of the node
	 * (see also <code>ghost</code>). Rectangle position is relative to the node. */
	UI_RegisterNodeProperty(behaviour, "excluderect", V_UI_EXCLUDERECT, uiNode_t, firstExcludeRect);

	/* Remove all child from the node (only dynamic allocated nodes). */
	UI_RegisterNodeMethod(behaviour, "removeallchild", UI_AbstractNodeCallRemovaAllChild);

	/* Create a new child with name and type. */
	UI_RegisterNodeMethod(behaviour, "createchild", UI_AbstractNodeCallCreateChild);

	/* Delete the node and remove it from his parent. */
	UI_RegisterNodeMethod(behaviour, "delete", UI_AbstractNodeCallDelete);

	/* Delete the node in x ms and remove it from his parent. */
	UI_RegisterNodeMethod(behaviour, "deletetimed", UI_AbstractNodeCallDeleteTimed);

	/** @todo move it into common? */
	Com_RegisterConstInt("ALIGN_UL", ALIGN_UL);
	Com_RegisterConstInt("ALIGN_UC", ALIGN_UC);
	Com_RegisterConstInt("ALIGN_UR", ALIGN_UR);
	Com_RegisterConstInt("ALIGN_CL", ALIGN_CL);
	Com_RegisterConstInt("ALIGN_CC", ALIGN_CC);
	Com_RegisterConstInt("ALIGN_CR", ALIGN_CR);
	Com_RegisterConstInt("ALIGN_LL", ALIGN_LL);
	Com_RegisterConstInt("ALIGN_LC", ALIGN_LC);
	Com_RegisterConstInt("ALIGN_LR", ALIGN_LR);

	/* some commands */
#ifdef DEBUG
	Cmd_AddCommand("debug_mnsetnodeproperty", UI_NodeSetProperty_f, "Set a node property");
	Cmd_AddCommand("debug_mngetnodeproperty", UI_NodeGetProperty_f, "Get a node property");
#endif
}