Example #1
0
/**
 * @brief Check if a key binding exists for a window and execute it
 */
static bool UI_KeyPressedInWindow (unsigned int key, const uiNode_t* window)
{
	uiNode_t* node;
	const uiKeyBinding_t* binding;

	/* search requested key binding */
	binding = UI_WindowNodeGetKeyBinding(window, key);
	if (!binding)
		return false;

	/* check node visibility */
	node = binding->node;
	while (node) {
		if (node->disabled || node->invis)
			return false;
		node = node->parent;
	}

	/* execute event */
	node = binding->node;
	if (binding->property == nullptr)
		UI_Node_Activate(node);
	else if (binding->property->type == V_UI_NODEMETHOD) {
		uiCallContext_t newContext;
		uiNodeMethod_t func = (uiNodeMethod_t) binding->property->ofs;
		newContext.source = node;
		newContext.useCmdParam = false;
		func(node, &newContext);
	} else
		Com_Printf("UI_KeyPressedInWindow: @%s not supported.", binding->property->string);

	return true;
}
Example #2
0
static void UI_CheckBoxNodeCallActivate (uiNode_t *node, const uiCallContext_t *context)
{
	UI_Node_Activate(node);
}