Beispiel #1
0
	static VALUE RubyKMethodCall(VALUE self, VALUE args)
	{
		SharedValue* dval = NULL;
		Data_Get_Struct(self, SharedValue, dval);
		SharedKMethod method = (*dval)->ToMethod();

		// TODO: We should raise an exception instead
		if (method.isNull())
			return Qnil;

		return RubyUtils::GenericKMethodCall(method, args);
	}
	AutoMenuItem UIBinding::__CreateCheckMenuItem(const ValueList& args)
	{
		args.VerifyException("createCheckMenuItem", "?s m|0");
		std::string label = args.GetString(0, "");
		SharedKMethod eventListener = args.GetMethod(1, NULL);

		AutoMenuItem item = this->CreateCheckMenuItem();
		if (!label.empty())
			item->SetLabel(label);
		if (!eventListener.isNull())
			item->AddEventListener(Event::CLICKED, eventListener);

		return item;
	}