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

        // forwards declarations mapped to includes
        
            
        // includes for base ecma wrapper classes
         void REcmaTreeWidget::initEcma(QScriptEngine& engine, QScriptValue* proto 
    
    ) 
    
    {

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

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

            if (dpt.isValid()) {
                proto->setPrototype(dpt);
            }
          
        /*
        
        */
    

    QScriptValue fun;

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

    // destroy:
    REcmaHelper::registerFunction(&engine, proto, destroy, "destroy");
    
        // conversion for base class QTreeWidget
        REcmaHelper::registerFunction(&engine, proto, getQTreeWidget, "getQTreeWidget");
        

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

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

    // properties:
    

    // methods:
    
            REcmaHelper::registerFunction(&engine, proto, setSelectableColumn, "setSelectableColumn");
            
            REcmaHelper::registerFunction(&engine, proto, getIndex, "getIndex");
            
            REcmaHelper::registerFunction(&engine, proto, getActiveItem, "getActiveItem");
            
        engine.setDefaultPrototype(
            qMetaTypeId<RTreeWidget*>(), *proto);

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

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

    // static properties:
    

    // enum values:
    

    // enum conversions:
    
        
    // init class:
    engine.globalObject().setProperty("RTreeWidget",
    ctor, QScriptValue::SkipInEnumeration);
    
    if( protoCreated ){
       delete proto;
    }
    
    }
     QScriptValue REcmaTreeWidget::createEcma(QScriptContext* context, QScriptEngine* engine) 
    
    {
    if (context->thisObject().strictlyEquals(
       engine->globalObject())) {
       return REcmaHelper::throwError(
       QString::fromLatin1("RTreeWidget(): 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:
            REcmaShellTreeWidget
                    * cppResult =
                    new
                    REcmaShellTreeWidget
                    ();
                
                    result = engine->newQObject(context->thisObject(), cppResult, QScriptEngine::QtOwnership);
                
        cppResult->__qtscript_self = result;
    
    } else 

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

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

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

    // conversion functions for base classes:
     QScriptValue REcmaTreeWidget::getQTreeWidget(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                QTreeWidget* cppResult =
                    qscriptvalue_cast<RTreeWidget*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
            

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

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

        return qScriptValueFromSequence(engine, list);
    }
    

    // properties:
    

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

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

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isNumber()
        ) /* type: int */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    int
                    a0 =
                    (int)
                    
                    context->argument( 0 ).
                    toNumber();
                
    // end of arguments

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


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

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RTreeWidget* self = 
                        getSelf("getIndex", 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: QTreeWidgetItem * */
    
    ){
    // prepare arguments:
    
                    // argument is pointer
                    QTreeWidgetItem * a0 = NULL;

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

    // call C++ function:
    // return type 'QModelIndex'
    QModelIndex cppResult =
        
               self->getIndex(a0);
        // return type: QModelIndex
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: QTreeWidgetItem * */
     && (
            context->argument(1).isNumber()
        ) /* type: int */
    
    ){
    // prepare arguments:
    
                    // argument is pointer
                    QTreeWidgetItem * a0 = NULL;

                    a0 = 
                        REcmaHelper::scriptValueTo<QTreeWidgetItem >(
                            context->argument(0)
                        );
                    
                    if (a0==NULL && 
                        !context->argument(0).isNull()) {
                        return REcmaHelper::throwError("RTreeWidget: Argument 0 is not of type QTreeWidgetItem *QTreeWidgetItem *.", context);                    
                    }
                
                    // argument isStandardType
                    int
                    a1 =
                    (int)
                    
                    context->argument( 1 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QModelIndex'
    QModelIndex cppResult =
        
               self->getIndex(a0
        ,
    a1);
        // return type: QModelIndex
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


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

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RTreeWidget* self = 
                        getSelf("getActiveItem", 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 'QTreeWidgetItem *'
    QTreeWidgetItem * cppResult =
        
               self->getActiveItem();
        // return type: QTreeWidgetItem *
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


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

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

        RTreeWidget* self = getSelf("RTreeWidget", 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();
    }
    RTreeWidget* REcmaTreeWidget::getSelf(const QString& fName, QScriptContext* context)
    
        {
            RTreeWidget* 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<RTreeWidget >(context->thisObject())
                
                ;
            //}

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

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

            return self;
            


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