示例#1
0
void UI_RegisterTextEntryNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "textentry";
	behaviour->manager = UINodePtr(new uiTextEntryNode());
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* Call back event called when we click on the node. If the click select the node,
	 * it called before we start the cvar edition.
	 */
	UI_RegisterOveridedNodeProperty(behaviour, "onClick");

	/* Call back event (like click...) fired when the text is changed, after
	 * validation. An abort of the edition dont fire this event.
	 */
	UI_RegisterOveridedNodeProperty(behaviour, "onChange");

	/* Custom the draw behaviour by hiding each character of the text with a star (''*''). */
	UI_RegisterExtradataNodeProperty(behaviour, "isPassword", V_BOOL, 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.
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "clickOutAbort", V_BOOL, textEntryExtraData_t, clickOutAbort);
	/* Cursor position (offset of next UTF-8 char to the right) */
	UI_RegisterExtradataNodeProperty(behaviour, "cursorPosition", V_INT, textEntryExtraData_t, cursorPosition);
	/* Call it when we abort the edition */
	UI_RegisterExtradataNodeProperty(behaviour, "onAbort", V_UI_ACTION, textEntryExtraData_t, onAbort);
	/* Call it to force node edition */
	UI_RegisterNodeMethod(behaviour, "edit", UI_TextEntryNodeFocus);
	/* Sprite used to display the background */
	UI_RegisterExtradataNodeProperty(behaviour, "background", V_UI_SPRITEREF, EXTRADATA_TYPE, background);
}
示例#2
0
void UI_RegisterDataNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "data";
	behaviour->isVirtual = true;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
	behaviour->manager = UINodePtr(new uiDataNode());

	/* Store a string into the node.
	 * @note you should note store a cvar ref
	 * @todo use a REF_STRING when it is possible
	 */
	UI_RegisterOveridedNodeProperty(behaviour, "string");

	/* Store a float number into the node. */
	UI_RegisterExtradataNodeProperty(behaviour, "number", V_FLOAT, EXTRADATA_TYPE, number);

	/* Store a integer number into the node. */
	UI_RegisterExtradataNodeProperty(behaviour, "integer", V_INT, EXTRADATA_TYPE, number);
}
void UI_RegisterButtonNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "button";
	behaviour->draw = UI_ButtonNodeDraw;
	behaviour->loaded = UI_ButtonNodeLoaded;
	behaviour->leftClick = UI_ButtonNodeClick;
	behaviour->loading = UI_ButtonNodeLoading;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* Texture used by the button. It's a normalized texture of 128x128.
	 * 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.org/wiki/images/Button_blue.png
	 */
	UI_RegisterOveridedNodeProperty(behaviour, "image");

	/* Icon used to display the node
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "icon", V_UI_SPRITEREF, EXTRADATA_TYPE, icon);
	UI_RegisterExtradataNodeProperty(behaviour, "flipicon", V_BOOL, EXTRADATA_TYPE, flipIcon);
}
示例#4
0
void UI_RegisterSpinnerNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "spinner";
	behaviour->extends = "abstractvalue";
	behaviour->manager = new uiSpinnerNode();
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);

	/* The size of the widget is uneditable. Fixed to 15x19.
	 */
	UI_RegisterOveridedNodeProperty(behaviour, "size");

	/**
	 * @brief Backround used to display the spinner. It is displayed in the center of the node.
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "background", V_UI_SPRITEREF, EXTRADATA_TYPE, background);

	/**
	 * @brief Top icon used to decorate the top button of the spinner. It is displayed in the center of the node.
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "topIcon", V_UI_SPRITEREF, EXTRADATA_TYPE, topIcon);

	/**
	 * @brief Sprite used to decorate the bottom button of the spinner. It is displayed in the center of the node.
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "bottomIcon", V_UI_SPRITEREF, EXTRADATA_TYPE, bottomIcon);

	/**
	 * @brief Spinner mode allow to change the input action of the spinner.
	 * SPINNER_NORMAL is the default mode. With SPINNER_ONLY_INC anywhere it click on the node
	 * it will increase the value. With SPINNER_ONLY_DEC anywhere it click on the node
	 * it will decrease the value.
	 */
	UI_RegisterExtradataNodeProperty(behaviour, "mode", V_INT, EXTRADATA_TYPE, mode);

	Com_RegisterConstInt("SPINNER_NORMAL", NORMAL);
	Com_RegisterConstInt("SPINNER_ONLY_INC", ONLY_INCREASE);
	Com_RegisterConstInt("SPINNER_ONLY_DEC", ONLY_DECREASE);
}