static void UI_AbstractNodeCallRemovaAllChild (uiNode_t* node, const uiCallContext_t* context)
{
	if (UI_GetParamNumber(context) != 0) {
		Com_Printf("UI_AbstractNodeCallRemovaAllChild: Invalid number of parameters\n");
		return;
	}
	UI_DeleteAllChild(node);
}
Exemple #2
0
/**
 * Delete the node and remove it from his parent
 * @param node The node we want to delete
 */
void UI_DeleteNode (uiNode_t* node)
{
	uiBehaviour_t *behaviour;

	if (!node->dynamic)
		return;

	UI_BeforeDeletingNode(node);

	UI_DeleteAllChild(node);
	if (node->firstChild != NULL) {
		Com_Printf("UI_DeleteNode: Node '%s' contain static nodes. We can't delete it.", UI_GetPath(node));
		return;
	}

	if (node->parent)
		UI_RemoveNode(node->parent, node);

	/* delete all allocated properties */
	for (behaviour = node->behaviour; behaviour; behaviour = behaviour->super) {
		const value_t *property = behaviour->properties;
		if (property == NULL)
			continue;
		while (property->string != NULL) {
			if ((property->type & V_UI_MASK) == V_UI_CVAR) {
				void *mem = ((byte *) node + property->ofs);
				if (*(void**)mem != NULL) {
					UI_FreeStringProperty(*(void**)mem);
					*(void**)mem = NULL;
				}
			}

			/** @todo We must delete all EA_LISTENER too */

			property++;
		}
	}

	if (node->behaviour->deleteNode)
		node->behaviour->deleteNode(node);
}
Exemple #3
0
/**
 * Delete the node and remove it from his parent
 * @param node The node we want to delete
 */
void UI_DeleteNode (uiNode_t* node)
{
	uiBehaviour_t *behaviour;

	if (!node->dynamic)
		return;

	UI_BeforeDeletingNode(node);

	UI_DeleteAllChild(node);
	if (node->firstChild != nullptr) {
		Com_Printf("UI_DeleteNode: Node '%s' contain static nodes. We can't delete it.\n", UI_GetPath(node));
		return;
	}

	if (node->parent)
		UI_RemoveNode(node->parent, node);

	/* delete all allocated properties */
	for (behaviour = node->behaviour; behaviour; behaviour = behaviour->super) {
		const value_t **property = behaviour->localProperties;
		if (property == nullptr)
			continue;
		while (*property) {
			if (((*property)->type & V_UI_MASK) == V_UI_CVAR) {
				if (void*& mem = Com_GetValue<void*>(node, *property)) {
					UI_FreeStringProperty(mem);
					mem = 0;
				}
			}

			/** @todo We must delete all EA_LISTENER too */

			property++;
		}
	}

	UI_Node_DeleteNode(node);
}