/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"

#include "JSHTMLMarqueeElement.h"

#include <wtf/GetPtr.h>

#include "HTMLMarqueeElement.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSHTMLMarqueeElementTableEntries[] =
{
    { "constructor", JSHTMLMarqueeElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
};

static const HashTable JSHTMLMarqueeElementTable = 
{
    2, 1, JSHTMLMarqueeElementTableEntries, 1
};

/* Hash table for constructor */

static const HashEntry JSHTMLMarqueeElementConstructorTableEntries[] =
{
    { 0, 0, 0, 0, 0 }
};

static const HashTable JSHTMLMarqueeElementConstructorTable = 
{
    2, 1, JSHTMLMarqueeElementConstructorTableEntries, 1
};

class JSHTMLMarqueeElementConstructor : public DOMObject {
public:
    JSHTMLMarqueeElementConstructor(ExecState* exec)
    {
        setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
        putDirect(exec->propertyNames().prototype, JSHTMLMarqueeElementPrototype::self(exec), None);
    }
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    JSValue* getValueProperty(ExecState*, int token) const;
    virtual const ClassInfo* classInfo() const { return &info; }
    static const ClassInfo info;

    virtual bool implementsHasInstance() const { return true; }
};

const ClassInfo JSHTMLMarqueeElementConstructor::info = { "HTMLMarqueeElementConstructor", 0, &JSHTMLMarqueeElementConstructorTable, 0 };

bool JSHTMLMarqueeElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSHTMLMarqueeElementConstructor, DOMObject>(exec, &JSHTMLMarqueeElementConstructorTable, this, propertyName, slot);
}

JSValue* JSHTMLMarqueeElementConstructor::getValueProperty(ExecState*, int token) const
{
    // The token is the numeric value of its associated constant
    return jsNumber(token);
}

/* Hash table for prototype */

static const HashEntry JSHTMLMarqueeElementPrototypeTableEntries[] =
{
    { "start", JSHTMLMarqueeElement::StartFuncNum, DontDelete|Function, 0, &JSHTMLMarqueeElementPrototypeTableEntries[2] },
    { 0, 0, 0, 0, 0 },
    { "stop", JSHTMLMarqueeElement::StopFuncNum, DontDelete|Function, 0, 0 }
};

static const HashTable JSHTMLMarqueeElementPrototypeTable = 
{
    2, 3, JSHTMLMarqueeElementPrototypeTableEntries, 2
};

const ClassInfo JSHTMLMarqueeElementPrototype::info = { "HTMLMarqueeElementPrototype", 0, &JSHTMLMarqueeElementPrototypeTable, 0 };

JSObject* JSHTMLMarqueeElementPrototype::self(ExecState* exec)
{
    return KJS::cacheGlobalObject<JSHTMLMarqueeElementPrototype>(exec, "[[JSHTMLMarqueeElement.prototype]]");
}

bool JSHTMLMarqueeElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticFunctionSlot<JSHTMLMarqueeElementPrototypeFunction, JSObject>(exec, &JSHTMLMarqueeElementPrototypeTable, this, propertyName, slot);
}

const ClassInfo JSHTMLMarqueeElement::info = { "HTMLMarqueeElement", &JSHTMLElement::info, &JSHTMLMarqueeElementTable, 0 };

JSHTMLMarqueeElement::JSHTMLMarqueeElement(ExecState* exec, HTMLMarqueeElement* impl)
    : JSHTMLElement(exec, impl)
{
    setPrototype(JSHTMLMarqueeElementPrototype::self(exec));
}

bool JSHTMLMarqueeElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSHTMLMarqueeElement, JSHTMLElement>(exec, &JSHTMLMarqueeElementTable, this, propertyName, slot);
}

JSValue* JSHTMLMarqueeElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}

JSValue* JSHTMLMarqueeElement::getConstructor(ExecState* exec)
{
    return KJS::cacheGlobalObject<JSHTMLMarqueeElementConstructor>(exec, "[[HTMLMarqueeElement.constructor]]");
}
JSValue* JSHTMLMarqueeElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSHTMLMarqueeElement::info))
      return throwError(exec, TypeError);

    HTMLMarqueeElement* imp = static_cast<HTMLMarqueeElement*>(static_cast<JSHTMLMarqueeElement*>(thisObj)->impl());

    switch (id) {
    case JSHTMLMarqueeElement::StartFuncNum: {

        imp->start();
        return jsUndefined();
    }
    case JSHTMLMarqueeElement::StopFuncNum: {

        imp->stop();
        return jsUndefined();
    }
    }
    return 0;
}

}
