Example #1
0
// Disable all parent context menus once the child is clicked
static void DisableContextMenuParents(UIObject *o)
{
	if (o->Parent)
	{
		if (o->Parent->Type == UITYPE_CONTEXT_MENU)
		{
			o->Parent->IsVisible = false;
		}
		DisableContextMenuParents(o->Parent);
	}
}
Example #2
0
// Disable all parent context menus once the child is clicked
static void DisableContextMenuParents(UIObject *o)
{
	// Don't disable if we are a textbox
	if (o->Parent && o->Type != UITYPE_TEXTBOX)
	{
		if (o->Parent->Type == UITYPE_CONTEXT_MENU)
		{
			o->Parent->IsVisible = false;
		}
		DisableContextMenuParents(o->Parent);
	}
}
Example #3
0
int UIObjectChange(UIObject *o, int d)
{
	switch (o->Type)
	{
	case UITYPE_TAB:
		// switch child
		o->u.Tab.Index = CLAMP_OPPOSITE(
			o->u.Tab.Index + d, 0, (int)o->u.Tab.Labels.size - 1);
		break;
	default:
		// do nothing
		break;
	}
	if (o->ChangeFunc)
	{
		o->ChangeFunc(o->Data, d);
		DisableContextMenuParents(o);
		return o->ChangesData;
	}
	return 0;
}