/*
 * Automatically generated, do not edit this file directly
 */

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * plugin-class.g.cpp: MoonLight browser plugin - autogenerated classes
 *
 * Contact:
 *   Moonlight List (moonlight-list@lists.ximian.com)
 *
 * Copyright 2007-2009 Novell, Inc. (http://www.novell.com)
 *
 * See the LICENSE file included with the distribution for details.
 *
 */

#include <config.h>

#include <ctype.h>

#include "plugin-class.h"
#include "browser-bridge.h"
#include "plugin.h"
#include "deployment.h"
#include "bitmapimage.h"
#include "uri.h"
#include "textbox.h"

/*** MoonlightUIElementClass *********/
static NPObject *
moonlight_uielement_allocate (NPP instance, NPClass *klass)
{
	return new MoonlightUIElementObject (instance);
}

static const MoonNameIdMapping moonlight_uielement_mapping[] = {
	{"capturemouse", MoonId_UIElement_CaptureMouse},
	{"transformtovisual", MoonId_UIElement_TransformToVisual},
	{"releasemousecapture", MoonId_UIElement_ReleaseMouseCapture},
	{"updatelayout", MoonId_UIElement_UpdateLayout}
};

bool
MoonlightUIElementObject::Invoke (int id, NPIdentifier name,
				   const NPVariant *args, guint32 argCount,
				   NPVariant *result)
{
	UIElement *dob = (UIElement*)GetDependencyObject ();

	switch (id) {

		case MoonId_UIElement_CaptureMouse: {
			bool ret = dob->CaptureMouse();
			BOOLEAN_TO_NPVARIANT (ret, *result);
			return true;
			break;
		}

		case MoonId_UIElement_TransformToVisual: {
			if (!check_arg_list ("o", argCount, args))
				THROW_JS_EXCEPTION ("TransformToVisual");
			MoonError err;
			NPObject *obj0 = NPVARIANT_TO_OBJECT (args[0]);
			if (!npobject_is_dependency_object (obj0))
				THROW_JS_EXCEPTION ("TransformToVisual");
			DependencyObject *arg0 = ((MoonlightDependencyObjectObject *) obj0)->GetDependencyObject();
			GeneralTransform * ret = dob->GetTransformToUIElementWithError((UIElement *) arg0,&err);
			if (err.number != 0) THROW_JS_EXCEPTION (err.message);
			if (ret)
				OBJECT_TO_NPVARIANT (EventObjectCreateWrapper (GetPlugin (), ret), *result);
			else
				NULL_TO_NPVARIANT (*result);
			return true;
			break;
		}

		case MoonId_UIElement_ReleaseMouseCapture: {
			dob->ReleaseMouseCapture();
			VOID_TO_NPVARIANT (*result);
			return true;
			break;
		}

		case MoonId_UIElement_UpdateLayout: {
			dob->UpdateLayout();
			VOID_TO_NPVARIANT (*result);
			return true;
			break;
		}
	}

	return MoonlightDependencyObjectObject::Invoke (id, name, args, argCount, result);
}

MoonlightUIElementType::MoonlightUIElementType ()
{
	AddMapping (moonlight_uielement_mapping, G_N_ELEMENTS (moonlight_uielement_mapping));

	allocate = moonlight_uielement_allocate;
}


