コード例 #1
0
ファイル: ui_node_special.c プロジェクト: kevlund/ufoai
/**
 * @brief Call after the script initialized the node
 */
static void UI_ConFuncNodeLoaded (uiNode_t *node)
{
	/* register confunc non inherited */
	if (node->super == NULL) {
		/* don't add a callback twice */
		if (!Cmd_Exists(node->name)) {
			Cmd_AddCommand(node->name, UI_ConfuncCommand_f, "Confunc callback");
			Cmd_AddUserdata(node->name, node);
		} else {
			Com_Printf("UI_ParseNodeBody: Command name for confunc '%s' already registered\n", UI_GetPath(node));
		}
	} else {
		uiNode_t *dummy;

		/* convert a confunc to an "inherited" confunc if it is possible */
		if (Cmd_Exists(node->name)) {
			if (UI_ConFuncIsVirtual(node))
				return;
		}

		dummy = UI_AllocNode(node->name, "confunc", qfalse);
		Cmd_AddCommand(node->name, UI_ConfuncCommand_f, "Inherited confunc callback");
		Cmd_AddUserdata(dummy->name, dummy);
	}
}
コード例 #2
0
ファイル: ui_node_special.c プロジェクト: kevlund/ufoai
/**
 * @brief Callback every time the parent window is opened (pushed into the active window stack)
 */
static void UI_ConFuncNodeInit (uiNode_t *node, linkedList_t *params)
{
	if (UI_ConFuncIsVirtual(node)) {
		const value_t *property = UI_GetPropertyFromBehaviour(node->behaviour, "onClick");
		uiNode_t *userData = (uiNode_t*) Cmd_GetUserdata(node->name);
		UI_AddListener(userData, property, node);
	}
}
コード例 #3
0
ファイル: ui_node_special.c プロジェクト: kevlund/ufoai
/**
 * @brief Callback every time the parent window is closed (pop from the active window stack)
 */
static void UI_ConFuncNodeClose (uiNode_t *node)
{
	if (UI_ConFuncIsVirtual(node)) {
		const value_t *property = UI_GetPropertyFromBehaviour(node->behaviour, "onClick");
		uiNode_t *userData = (uiNode_t*) Cmd_GetUserdata(node->name);
		UI_RemoveListener(userData, property, node);
	}
}
コード例 #4
0
ファイル: ui_node_special.cpp プロジェクト: rxadmin/ufoai
/**
 * @brief Callback every time the parent window is closed (pop from the active window stack)
 */
void uiConFuncNode::onWindowClosed (uiNode_t* node)
{
    if (UI_ConFuncIsVirtual(node)) {
        const value_t* property = UI_GetPropertyFromBehaviour(node->behaviour, "onClick");
        uiNode_t* userData = static_cast<uiNode_t*>(Cmd_GetUserdata(node->name));
        UI_RemoveListener(userData, property, node);
    }
}