Exemplo n.º 1
0
	void UIBinding::_GetMenu(const ValueList& args, KValueRef result)
	{
		AutoMenu menu = this->GetMenu();
		if (menu.isNull())
		{
			result->SetNull();
		}
		else
		{
			result->SetObject(menu);
		}
	}
Exemplo n.º 2
0
void MenuItem::_SetSubmenu(const ValueList& args, KValueRef result)
{
    args.VerifyException("setSubmenu", "o|0");
    AutoMenu newSubmenu = NULL;

    if (args.at(0)->IsObject())
    {
        KObjectRef o = args.at(0)->ToObject();
        o = KObject::Unwrap(o);
        newSubmenu = o.cast<Menu>();
    }

    if (!newSubmenu.isNull() && newSubmenu->ContainsItem(this))
    {
        throw ValueException::FromString("Tried to construct a recursive menu");
    }

    this->submenu = newSubmenu;
    this->SetSubmenuImpl(newSubmenu);
}