Exemple #1
0
int drv_action(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QAction *self = (QAction*)head->native;
    switch (drvid) {
    case ACTION_INIT: {
        drvNewObj(a0, new QAction(qApp));
        break;
    }
    case ACTION_SETTEXT: {
        self->setText(drvGetString(a1));
        break;
    }
    case ACTION_TEXT: {
        drvSetString(a1,self->text());
        break;
    }
    case ACTION_ONTRIGGERED: {
        QObject::connect(self,SIGNAL(triggered(bool)),drvNewSignal(self,a1,a2),SLOT(call(bool)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #2
0
int drv_menu(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QMenu *self = (QMenu*)head->native;
    switch (drvid) {
    case MENU_INIT: {
        drvNewObj(a0,new QMenu);
        break;
    }
    case MENU_SETTITLE: {
        self->setTitle(drvGetString(a1));
        break;
    }
    case MENU_TITLE: {
        drvSetString(a1,self->title());
        break;
    }
    case MENU_ADDACTION: {
        self->addAction(drvGetAction(a1));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #3
0
int drv_basebutton(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QAbstractButton *self = (QAbstractButton*)head->native;
    switch (drvid) {
    case BASEBUTTON_SETTEXT: {
        self->setText(drvGetString(a1));
        break;
    }
    case BASEBUTTON_TEXT: {
        drvSetString(a1,self->text());
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #4
0
int drv_label(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QLabel *self = (QLabel*)head->native;
    switch (drvid) {
    case LABEL_INIT: {
        drvNewObj(a0,new QLabel);
        break;
    }
    case LABEL_SETTEXT: {
        self->setText(drvGetString(a1));
        break;
    }
    case LABEL_TEXT: {
        drvSetString(a1,self->text());
        break;
    }
    case LABEL_SETWORDWRAP: {
        self->setWordWrap(drvGetBool(a1));
        break;
    }
    case LABEL_WORDWRAP: {
        drvSetBool(a1,self->wordWrap());
        break;
    }
    case LABEL_SETTEXTFORMAT: {
        self->setTextFormat((Qt::TextFormat)drvGetInt(a1));
        break;
    }
    case LABEL_TEXTFORMAT: {
        drvSetInt(a1,self->textFormat());
        break;
    }
    case LABEL_ONLINKACTIVATED: {
        QObject::connect(self,SIGNAL(linkActivated(QString)),drvNewSignal(self,a1,a2),SLOT(call(QString)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #5
0
int drv_groupbox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QGroupBox *self = (QGroupBox*)head->native;
    switch (drvid) {
    case GROUPBOX_INIT: {
        drvNewObj(a0,new QGroupBox);
        break;
    }
    case GROUPBOX_SETTITLE: {
        self->setTitle(drvGetString(a1));
        break;
    }
    case GROUPBOX_TITLE: {
        drvSetString(a1,self->title());
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #6
0
bool QtEvent::eventFilter(QObject *target, QEvent *event)
{
    int type = event->type();
    void *func = m_hash.value(type);
    if (func != 0) {
        int accept = event->isAccepted() ? 1 : 0;
        switch(type) {
        case QEvent::Create:
        case QEvent::Close:
        case QEvent::Show:
        case QEvent::Hide:
        case QEvent::Enter:
        case QEvent::Leave: {
            base_event ev = {accept};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::FocusIn:
        case QEvent::FocusOut: {
            QFocusEvent *e = (QFocusEvent*)event;
            focus_event ev = {accept,e->reason()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::Timer: {
            QTimerEvent *e = (QTimerEvent*)event;
            timer_event ev = {accept,e->timerId()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::HoverEnter:
        case QEvent::HoverLeave:
        case QEvent::HoverMove: {
            QHoverEvent *e = (QHoverEvent*)event;
            const QPoint &pt = e->pos();
            const QPoint &opt = e->oldPos();
            hover_event ev = {accept,pt.x(),pt.y(),opt.x(),opt.y()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::KeyPress:
        case QEvent::KeyRelease: {
            QKeyEvent *e = (QKeyEvent*)event;
            string_head sh;
            drvSetString(&sh,e->text());
            key_event ev = {accept,e->modifiers(),e->count(),e->isAutoRepeat()?1:0,e->key(),e->nativeModifiers(),e->nativeScanCode(),e->nativeVirtualKey(),&sh};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
        case QEvent::MouseButtonDblClick:
        case QEvent::MouseMove: {
            QMouseEvent *e = (QMouseEvent*)event;
            const QPoint &gpt = e->globalPos();
            const QPoint &pt = e->pos();
            mouse_event ev = {accept,e->modifiers(),e->button(),e->buttons(),gpt.x(),gpt.y(),pt.x(),pt.y()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::Move: {
            QMoveEvent *e = (QMoveEvent*)event;
            const QPoint &pt = e->pos();
            const QPoint &opt = e->oldPos();
            move_event ev = {accept,pt.x(),pt.y(),opt.x(),opt.y()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::Resize: {
            QResizeEvent *e = (QResizeEvent*)event;
            const QSize &sz = e->size();
            const QSize &osz = e->oldSize();
            resize_event ev = {accept,sz.width(),sz.height(),osz.width(),osz.height()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        case QEvent::Paint: {
            QPaintEvent *e = (QPaintEvent*)event;
            const QRect &rc = e->rect();
            paint_event ev = {accept,rc.x(),rc.y(),rc.width(),rc.height()};
            drv_callback(func,&ev,0,0,0);
            event->setAccepted(ev.accept != 0);
            break;
        }
        default: {
            return QObject::eventFilter(target,event);
        }
        }
        return true;
    }
    return QObject::eventFilter(target,event);
}
Exemple #7
0
int drv_tabwidget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QTabWidget *self = (QTabWidget*)head->native;
    switch (drvid) {
    case TABWIDGET_INIT: {
        drvNewObj(a0,new QTabWidget);
        break;
    }
    case TABWIDGET_ADDTAB: {
        self->addTab(drvGetWidget(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_CLEAR: {
        self->clear();
        break;
    }
    case TABWIDGET_COUNT: {
        drvSetInt(a1,self->count());
        break;
    }
    case TABWIDGET_CURRENTINDEX: {
        drvSetInt(a1,self->currentIndex());
        break;
    }
    case TABWIDGET_CURRENTWIDGET: {
        drvSetHandle(a1,self->currentWidget());
        break;
    }
    case TABWIDGET_SETCURRENTINDEX: {
        self->setCurrentIndex(drvGetInt(a1));
        break;
    }
    case TABWIDGET_SETCURRENTWIDGET: {
        self->setCurrentWidget(drvGetWidget(a1));
        break;
    }
    case TABWIDGET_INDEXOF: {
        drvSetInt(a2,self->indexOf(drvGetWidget(a1)));
        break;
    }
    case TABWIDGET_INSERTTAB: {
        self->insertTab(drvGetInt(a1),drvGetWidget(a2),drvGetString(a3));
        break;
    }
    case TABWIDGET_REMOVETAB: {
        self->removeTab(drvGetInt(a1));
        break;
    }
    case TABWIDGET_SETTABTEXT: {
        self->setTabText(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_SETTABTOOLTIP: {
        self->setTabToolTip(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_TABTEXT: {
        drvSetString(a2,self->tabText(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_TABTOOLTIP: {
        drvSetString(a2,self->tabToolTip(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_WIDGETOF: {
        drvSetHandle(a2,self->widget(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_ONCURRENTCHANGED: {
        QObject::connect(self,SIGNAL(currentChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #8
0
int drv_widget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QWidget *self = (QWidget*)head->native;
    switch (drvid) {
    case WIDGET_INIT: {
        drvNewObj(a0,new QWidget);
        break;
    }
    case WIDGET_DESTROY: {
        drvDelObj(a0,self);
        break;
    }
    case WIDGET_SETAUTODESTROY: {
        self->setAttribute(Qt::WA_DeleteOnClose,drvGetBool(a1));
        break;
    }
    case WIDGET_AUTODESTROY: {
        drvSetBool(a1,self->testAttribute(Qt::WA_DeleteOnClose));
        break;
    }
    case WIDGET_SETLAYOUT: {
        self->setLayout(drvGetLayout(a1));
        break;
    }
    case WIDGET_LAYOUT: {
        drvSetHandle(a1,self->layout());
        break;
    }
    case WIDGET_SETPARENT: {
        self->setParent(drvGetWidget(a1));
        break;
    }
    case WIDGET_PARENT: {
        drvSetHandle(a1,self->parent());
        break;
    }
    case WIDGET_SETVISIBLE: {
        self->setVisible(drvGetBool(a1));
        break;
    }
    case WIDGET_ISVISIBLE: {
        drvSetBool(a1,self->isVisible());
        break;
    }
    case WIDGET_SETWINDOWTITLE: {
        self->setWindowTitle(drvGetString(a1));
        break;
    }
    case WIDGET_WINDOWTITLE: {
        drvSetString(a1,self->windowTitle());
        break;
    }
    case WIDGET_SETPOS: {
        self->move(drvGetPoint(a1));
        break;
    }
    case WIDGET_POS: {
        drvSetPoint(a1,self->pos());
        break;
    }
    case WIDGET_SETSIZE: {
        self->resize(drvGetSize(a1));
        break;
    }
    case WIDGET_SIZE: {
        drvSetSize(a1,self->size());
        break;
    }
    case WIDGET_SETGEOMETRY: {
        self->setGeometry(drvGetRect(a1));
        break;
    }
    case WIDGET_GEOMETRY: {
        drvSetRect(a1,self->geometry());
        break;
    }
    case WIDGET_SETFONT: {
        self->setFont(drvGetFont(a1));
        break;
    }
    case WIDGET_FONT: {
        drvSetFont(a1,self->font());
        break;
    }
    case WIDGET_CLOSE: {
        self->close();
        break;
    }
    case WIDGET_UPDATE: {
        self->update();
        break;
    }
    case WIDGET_REPAINT: {
        self->repaint();
        break;
    }
    case WIDGET_ONSHOWEVENT: {
        drvNewEvent(QEvent::Show,a0,a1,a2);
        break;
    }
    case WIDGET_ONHIDEEVENT: {
        drvNewEvent(QEvent::Hide,a0,a1,a2);
        break;
    }
    case WIDGET_ONCLOSEEVENT: {
        drvNewEvent(QEvent::Close,a0,a1,a2);
        break;
    }
    case WIDGET_ONKEYPRESSEVENT: {
        drvNewEvent(QEvent::KeyPress,a0,a1,a2);
        break;
    }
    case WIDGET_ONKEYRELEASEEVENT: {
        drvNewEvent(QEvent::KeyRelease,a0,a1,a2);
        break;
    }
    case WIDGET_ONMOUSEPRESSEVENT: {
        drvNewEvent(QEvent::MouseButtonPress,a0,a1,a2);
        break;
    }
    case WIDGET_ONMOUSERELEASEEVENT: {
        drvNewEvent(QEvent::MouseButtonRelease,a0,a1,a2);
        break;
    }
    case WIDGET_ONMOUSEMOVEEVENT: {
        drvNewEvent(QEvent::MouseMove,a0,a1,a2);
        break;
    }
    case WIDGET_ONMOUSEDOUBLECLICKEVENT: {
        drvNewEvent(QEvent::MouseButtonDblClick,a0,a1,a2);
        break;
    }
    case WIDGET_ONMOVEEVENT: {
        drvNewEvent(QEvent::Move,a0,a1,a2);
        break;
    }
    case WIDGET_ONPAINTEVENT: {
        drvNewEvent(QEvent::Paint,a0,a1,a2);
        break;
    }
    case WIDGET_ONRESIZEEVENT: {
        drvNewEvent(QEvent::Resize,a0,a1,a2);
        break;
    }
    case WIDGET_ONENTEREVENT: {
        drvNewEvent(QEvent::Enter,a0,a1,a2);
        break;
    }
    case WIDGET_ONLEAVEEVENT: {
        drvNewEvent(QEvent::Leave,a0,a1,a2);
        break;
    }
    case WIDGET_ONFOCUSINEVENT: {
        drvNewEvent(QEvent::FocusIn,a0,a1,a2);
        break;
    }
    case WIDGET_ONFOCUSOUTEVENT: {
        drvNewEvent(QEvent::FocusOut,a0,a1,a2);
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #9
0
int drv_combobox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QComboBox *self = (QComboBox*)head->native;
    switch (drvid) {
    case COMBOBOX_INIT: {
        drvNewObj(a0,new QComboBox);
        break;
    }
    case COMBOBOX_COUNT: {
        drvSetInt(a1,self->count());
        break;
    }
    case COMBOBOX_SETCURRENTINDEX: {
        self->setCurrentIndex(drvGetInt(a1));
        break;
    }
    case COMBOBOX_CURRENTINDEX: {
        drvSetInt(a1,self->currentIndex());
        break;
    }
    case COMBOBOX_CURRENTTEXT: {
        drvSetString(a1,self->currentText());
        break;
    }
    case COMBOBOX_SETEDITABLE: {
        self->setEditable(drvGetBool(a1));
        break;
    }
    case COMBOBOX_ISEDITABLE: {
        drvSetBool(a1,self->isEditable());
        break;
    }
    case COMBOBOX_SETMAXCOUNT: {
        self->setMaxCount(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXCOUNT: {
        drvSetInt(a1,self->maxCount());
        break;
    }
    case COMBOBOX_SETMAXVISIBLEITEMS: {
        self->setMaxVisibleItems(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXVISIBLEITEMS: {
        drvSetInt(a1,self->maxVisibleItems());
        break;
    }
    case COMBOBOX_SETMINIMUMCONTENTSLENGTH: {
        self->setMinimumContentsLength(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MINIMUNCONTENTSLENGHT: {
        drvSetInt(a1,self->minimumContentsLength());
        break;
    }
    case COMBOBOX_ADDITEM: {
        self->addItem(drvGetString(a1));
        break;
    }
    case COMBOBOX_INSERTITEM: {
        self->insertItem(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case COMBOBOX_REMOVEITEM: {
        self->removeItem(drvGetInt(a1));
        break;
    }
    case COMBOBOX_ITEMTEXT: {
        drvSetString(a2,self->itemText(drvGetInt(a1)));
        break;
    }
    case COMBOBOX_ONCURRENTINDEXCHANGED: {
        QObject::connect(self,SIGNAL(currentIndexChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemple #10
0
int init_callback(void *p, int id, void *p1, void *p2, void *p3)
{
    switch (id) {
    case 1:
        pfn_utf8_to_string = (UTF8_TO_STRING)p;
        break;
    case 2:
        pfn_array_to_slice = (ARRAY_TO_SLICE)p;
        break;
    case 3:
        pfn_append_utf8_to_slice = (APPEND_UTF8_TO_SLICE)p;
        break;
    case 4:
        pfn_append_bytes_to_slice = (APPEND_BYTES_TO_SLICE)p;
        break;
    case 5:
        pfn_append_object_to_slice = (APPEND_OBJECT_TO_SLICE)p;
        break;
    case 6:
        pfn_string_slice_index = (STRING_SLICE_INDEX)p;
        break;
    case 7:
        pfn_object_slice_index = (OBJECT_SLICE_INDEX)p;
        break;
    case 8:
        pfn_drv_signal_call = (DRV_SIGNAL_CALL)p;
        break;
    case 9:
        pfn_drv_remove_signal_call = (DRV_REMOVE_SIGNAL_CALL)p;
        break;
    case 10:
        pfn_insert_string2object_map = (INSERT_STRING2OBJECT_MAP)p;
        break;
    case 11:
        pfn_copy_string2object_map = (COPY_STRING2OBJECT_MAP)p;
        break;
    case 12:
        pfn_insert_int2object_map = (INSERT_INT2OBJECT_MAP)p;
        break;
    case 13:
        pfn_copy_int2object_map = (COPY_INT2OBJECT_MAP)p;
        break;
    case 14:
        pfn_insert_object2object_map = (INSERT_OBJECT2OBJECT_MAP)p;
        break;
    case 15:
        pfn_app_event_init = (APP_EVENT_INIT)p;
        break;
    case 16:
        pfn_drv_event_filter = (DRV_EVENT_FILTER)p;
        break;
    case 17:
        pfn_drv_remove_event_filter = (DRV_REMOVE_EVENT_FILTER)p;
        break;
    case 18:
        pfn_app_async_task = (APP_ASYNC_TASK)p;
        break;
    case 100: //QString => string
        drvSetString(p,*(QString*)p1);
        break;
    case 101: //QStringList => []string
        drvSetStringArray(p,*(QStringList*)p1);
        break;
    case 102: //QList<QRectF> => []*QRectF
        drvSetListPtr(p,*(int*)p2,*(QList<QRectF>*)p1);
        break;
    case 103: //QList<QModelIndex> => []*QModelIndex
        drvSetListPtr(p,*(int*)p2,*(QList<QModelIndex>*)p1);
        break;
    case 104: //string,T => QMap
        (CALLBACK_INSERT_MAP(p3))(p,p1,p2);
        break;
    case 105:
        *(void**)p2 = drvNewFilter(p,(Iface*)p1);
        break;
    case 106:
        drvSetString(p1,qVersion());
        break;
    case 200:
        uidrv.call_async_task();
        break;
    case 201:
        uidrv.call_sync_task();
        break;
    default:
        return -1;
    }
    return 0;
}