// ***** AUTOGENERATED CODE, DO NOT EDIT *****
            // ***** This class is not copyable.
        
        #include "REcmaPenListenerAdapter.h"
        #include "RMetaTypes.h"
        #include "../REcmaHelper.h"

        // forwards declarations mapped to includes
        
            
        // includes for base ecma wrapper classes
        
                  #include "REcmaPenListener.h"
                 void REcmaPenListenerAdapter::initEcma(QScriptEngine& engine, QScriptValue* proto 
    
    ) 
    
    {

    bool protoCreated = false;
    if(proto == NULL){
        proto = new QScriptValue(engine.newVariant(qVariantFromValue(
                (RPenListenerAdapter*) 0)));
        protoCreated = true;
    }

    
        // primary base class QObject:
        
            QScriptValue dpt = engine.defaultPrototype(
                qMetaTypeId<QObject*>());

            if (dpt.isValid()) {
                proto->setPrototype(dpt);
            }
          
        /*
        REcmaPenListener::initEcma(engine, proto);
          
        */
    

    QScriptValue fun;

    // toString:
    REcmaHelper::registerFunction(&engine, proto, toString, "toString");
    

    // destroy:
    REcmaHelper::registerFunction(&engine, proto, destroy, "destroy");
    
        // conversion for base class QObject
        REcmaHelper::registerFunction(&engine, proto, getQObject, "getQObject");
        
        // conversion for base class RPenListener
        REcmaHelper::registerFunction(&engine, proto, getRPenListener, "getRPenListener");
        

    // get class name
    REcmaHelper::registerFunction(&engine, proto, getClassName, "getClassName");
    

    // conversion to all base classes (multiple inheritance):
    REcmaHelper::registerFunction(&engine, proto, getBaseClasses, "getBaseClasses");
    

        // properties of secondary base class RPenListener:
        

        // methods of secondary base class RPenListener:
        

    // properties:
    

    // methods:
    
            REcmaHelper::registerFunction(&engine, proto, updatePen, "updatePen");
            
            REcmaHelper::registerFunction(&engine, proto, clearPen, "clearPen");
            
        engine.setDefaultPrototype(
            qMetaTypeId<RPenListenerAdapter*>(), *proto);

        
                        qScriptRegisterMetaType<
                        RPenListenerAdapter*>(
                        &engine, toScriptValue, fromScriptValue, *proto);
                    
    

    QScriptValue ctor = engine.newFunction(createEcma, *proto, 2);
    
    // static methods:
    

    // static properties:
    

    // enum values:
    

    // enum conversions:
    
        
    // init class:
    engine.globalObject().setProperty("RPenListenerAdapter",
    ctor, QScriptValue::SkipInEnumeration);
    
    if( protoCreated ){
       delete proto;
    }
    
    }
     QScriptValue REcmaPenListenerAdapter::createEcma(QScriptContext* context, QScriptEngine* engine) 
    
    {
    if (context->thisObject().strictlyEquals(
       engine->globalObject())) {
       return REcmaHelper::throwError(
       QString::fromLatin1("RPenListenerAdapter(): Did you forget to construct with 'new'?"),
           context);
    }

    QScriptValue result;
        
            // generate constructor variants:
            
    if( context->argumentCount() ==
        0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ constructor:
    
            // non-copyable class:
            RPenListenerAdapter
                    * cppResult =
                    new
                    RPenListenerAdapter
                    ();
                
                    result = engine->newQObject(context->thisObject(), cppResult, QScriptEngine::QtOwnership);
                
    } else 

    if( context->argumentCount() ==
        1
                && (
                
                        context->argument(
                        0
                        ).isQObject()
                ) /* type: QObject * */
            
    ){
    // prepare arguments:
    
            // argument isQObject
            QObject *
            a0 =
            qobject_cast<
            QObject *>
            ( context->argument(
            0
            ).
            toQObject()
            );
        
    // end of arguments

    // call C++ constructor:
    
            // non-copyable class:
            RPenListenerAdapter
                    * cppResult =
                    new
                    RPenListenerAdapter
                    (
                    a0
                    );
                
                    result = engine->newQObject(context->thisObject(), cppResult, QScriptEngine::QtOwnership);
                
    } else 

    {
       return REcmaHelper::throwError(
       QString::fromLatin1("RPenListenerAdapter(): no matching constructor found."),
           context);
    }
    
    return result;
    }
    

    // conversion functions for base classes:
     QScriptValue REcmaPenListenerAdapter::getQObject(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                QObject* cppResult =
                    qscriptvalue_cast<RPenListenerAdapter*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
             QScriptValue REcmaPenListenerAdapter::getRPenListener(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                RPenListener* cppResult =
                    qscriptvalue_cast<RPenListenerAdapter*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
            

    // returns class name:
     QScriptValue REcmaPenListenerAdapter::getClassName(QScriptContext *context, QScriptEngine *engine) 
        
    {
        return qScriptValueFromValue(engine, QString("RPenListenerAdapter"));
    }
    

    // returns all base classes (in case of multiple inheritance):
     QScriptValue REcmaPenListenerAdapter::getBaseClasses(QScriptContext *context, QScriptEngine *engine) 
        
    {
        QStringList list;
        
        list.append("QObject");
    
        list.append("RPenListener");
    

        return qScriptValueFromSequence(engine, list);
    }
    
        // properties of secondary base class RPenListener:
        

        // methods of secondary base class RPenListener:
        

    // properties:
    

    // public methods:
     QScriptValue
        REcmaPenListenerAdapter::updatePen
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaPenListenerAdapter::updatePen", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaPenListenerAdapter::updatePen";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RPenListenerAdapter* self = 
                        getSelf("updatePen", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RDocumentInterface * */
    
    ){
    // prepare arguments:
    
                    // argument is pointer
                    RDocumentInterface * a0 = NULL;

                    a0 = 
                        REcmaHelper::scriptValueTo<RDocumentInterface >(
                            context->argument(0)
                        );
                    
                    if (a0==NULL && 
                        !context->argument(0).isNull()) {
                        return REcmaHelper::throwError("RPenListenerAdapter: Argument 0 is not of type RDocumentInterface *RDocumentInterface *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->updatePen(a0);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RPenListenerAdapter.updatePen().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaPenListenerAdapter::updatePen", context, engine);
            return result;
        }
         QScriptValue
        REcmaPenListenerAdapter::clearPen
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaPenListenerAdapter::clearPen", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaPenListenerAdapter::clearPen";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RPenListenerAdapter* self = 
                        getSelf("clearPen", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->clearPen();
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RPenListenerAdapter.clearPen().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaPenListenerAdapter::clearPen", context, engine);
            return result;
        }
         QScriptValue REcmaPenListenerAdapter::toString
    (QScriptContext *context, QScriptEngine *engine)
    
    {

    RPenListenerAdapter* self = getSelf("toString", context);
    
    QString result;
    
            result = QString("RPenListenerAdapter(0x%1)").arg((unsigned long int)self, 0, 16);
        
    return QScriptValue(result);
    }
     QScriptValue REcmaPenListenerAdapter::destroy(QScriptContext *context, QScriptEngine *engine)
    
    {

        RPenListenerAdapter* self = getSelf("RPenListenerAdapter", context);
        //Q_ASSERT(self!=NULL);
        if (self==NULL) {
            return REcmaHelper::throwError("self is NULL", context);
        }
        
    
        delete self;
        context->thisObject().setData(engine->nullValue());
        context->thisObject().prototype().setData(engine->nullValue());
        context->thisObject().setPrototype(engine->nullValue());
        context->thisObject().setScriptClass(NULL);
        return engine->undefinedValue();
    }
    RPenListenerAdapter* REcmaPenListenerAdapter::getSelf(const QString& fName, QScriptContext* context)
    
        {
            RPenListenerAdapter* self = NULL;

            
                // self could be a normal object (e.g. from an UI file) or
                // an ECMA shell object (made from an ECMA script):
                //self = getSelfShell(fName, context);
                

            //if (self==NULL) {
                self = REcmaHelper::scriptValueTo<RPenListenerAdapter >(context->thisObject())
                
                ;
            //}

            if (self == NULL){
                // avoid recursion (toString is used by the backtrace):
                if (fName!="toString") {
                    REcmaHelper::throwError(QString("RPenListenerAdapter.%1(): "
                        "This object is not a RPenListenerAdapter").arg(fName),
                        context);
                }
                return NULL;
            }

            return self;
        }
        RPenListenerAdapter* REcmaPenListenerAdapter::getSelfShell(const QString& fName, QScriptContext* context)
    
        {
          RPenListenerAdapter* selfBase = getSelf(fName, context);
                RPenListenerAdapter* self = dynamic_cast<RPenListenerAdapter*>(selfBase);
                //return REcmaHelper::scriptValueTo<RPenListenerAdapter >(context->thisObject());
            if(self == NULL){
                REcmaHelper::throwError(QString("RPenListenerAdapter.%1(): "
                    "This object is not a RPenListenerAdapter").arg(fName),
                    context);
            }

            return self;
            


        }
         void fromScriptValue(const QScriptValue& value,
        RPenListenerAdapter*
        &out) {
            QObject* o = value.toQObject();
            out = qobject_cast<
            RPenListenerAdapter*>(o);
        }
     QScriptValue toScriptValue(QScriptEngine *engine,
        RPenListenerAdapter*
        const &in){
            QScriptValue s = engine->newQObject(in, QScriptEngine::QtOwnership,
            QScriptEngine::PreferExistingWrapperObject);
            /*
            if(s.isNull()){
               REcmaHelper::throwError("This object is null.", engine->currentContext());
            }
            */
            return s;
        }
    