void UIBinding::_GetMenu(const ValueList& args, KValueRef result) { AutoMenu menu = this->GetMenu(); if (menu.isNull()) { result->SetNull(); } else { result->SetObject(menu); } }
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); }