Exemplo n.º 1
0
/**
 * @brief Initializes an option with a very little set of values.
 * @param[in] name The name of the new node
 * @param[in] label label displayed
 * @param[in] value value used when this option is selected
 */
uiNode_t* UI_AllocOptionNode (const char* name, const char* label, const char* value)
{
	uiNode_t* option;
	option = UI_AllocNode(name, "option", true);
	UI_InitOption(option, label, value);
	return option;
}
Exemplo n.º 2
0
/**
 * @brief Append an option to an option list.
 * @param[in,out] tree first option of the list/tree of options
 * @param[in] name name of the option (should be unique in the option list)
 * @param[in] label label displayed
 * @param[in] value value used when this option is selected
 * @return The new option
 */
uiNode_t* UI_AddOption (uiNode_t** tree, const char* name, const char* label, const char* value)
{
	uiNode_t *last;
	uiNode_t *option;
	assert(tree != NULL);

	option = UI_AllocNode(name, "option", qtrue);
	UI_InitOption(option, label, value);

	/* append the option */
	last = *tree;
	if (last != NULL) {
		while (last->next)
			last = last->next;
	}

	if (last)
		last->next = option;
	else
		*tree = option;

	return option;
}