Exemple #1
0
/**
 * @brief add a call of a function into a node event
 */
static void UI_AddListener_f (void)
{
	uiNode_t *node;
	uiNode_t *function;
	const value_t *property;

	if (Cmd_Argc() != 3) {
		Com_Printf("Usage: %s <pathnode@event> <pathnode>\n", Cmd_Argv(0));
		return;
	}

	UI_ReadNodePath(Cmd_Argv(1), NULL, &node, &property);
	if (node == NULL) {
		Com_Printf("UI_AddListener_f: '%s' node not found.\n", Cmd_Argv(1));
		return;
	}
	if (property == NULL || property->type != V_UI_ACTION) {
		Com_Printf("UI_AddListener_f: '%s' property not found, or is not an event.\n", Cmd_Argv(1));
		return;
	}

	function = UI_GetNodeByPath(Cmd_Argv(2));
	if (function == NULL) {
		Com_Printf("UI_AddListener_f: '%s' node not found.\n", Cmd_Argv(2));
		return;
	}

	UI_AddListener(node, property, function);
}
Exemple #2
0
/**
 * @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);
	}
}
Exemple #3
0
/**
 * @brief Callback every time the parent window is opened (pushed into the active window stack)
 */
void uiConFuncNode::onWindowOpened (uiNode_t* node, linkedList_t* params)
{
    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_AddListener(userData, property, node);
    }
}