diff --git a/main.cpp b/main.cpp index 39dd024..5aa683e 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,7 @@ protected: #define qtsound QSoundEffect * #define qttextedit QTextEdit * #define qtaction QAction * +#define qtlayout QLayout * extern "C" { #include "prototypes.h" @@ -494,6 +496,8 @@ char *qt_listwidgetitem(qtwidget w, int i) { return qstrdata(((QListWidget *)w)->item(i)->text()); } +void qt_addlayoutwidget(qtlayout l, qtwidget w) { l->addWidget(w); } + qtsound qt_sound(char *filename) { QSoundEffect* sound = new QSoundEffect(); sound->setSource(QUrl::fromLocalFile(filename)); diff --git a/prototypes.h b/prototypes.h index 1c86110..8d060bb 100644 --- a/prototypes.h +++ b/prototypes.h @@ -56,6 +56,7 @@ void qt_addcomboboxitem(qtwidget w, char *s); void qt_addlistwidgetitem(qtwidget w, char *s); void qt_addtreewidgetitem(qtwidget w, char *s); char *qt_listwidgetitem(qtwidget w, int i); +void qt_addlayoutwidget(qtlayout l, qtwidget w); char *qt_getexistingdirectory(qtwidget p, char *cap, char *dir, int opts); char *qt_getopenfilename(qtwidget p, char *cap, char *dir, char *filter, int opts); char *qt_getsavefilename(qtwidget p, char *cap, char *dir, char *filter, int opts); diff --git a/qt-light.scm b/qt-light.scm index 0324a72..dac2b4e 100644 --- a/qt-light.scm +++ b/qt-light.scm @@ -33,7 +33,7 @@ (define - (% (current-root-object) + (% (current-root-object) (class ') (pointer #f) (print (lambda (self #!optional (port (current-output-port))) @@ -49,9 +49,11 @@ (define (% (class 'qt-timer))) (define (% (class 'qt-text-edit))) (define (% (class 'qt-action))) +(define (% (class 'qt-layout))) (define (qt:->pointer i) (and i (? i pointer))) (define (qt:pointer->widget p) (and p (% (pointer p)))) +(define (qt:pointer->layout p) (and p (% (pointer p)))) (define (qt:pointer->object p) (and p (% (pointer p)))) (define (qt:pointer->timer p) (and p (% (pointer p)))) (define (qt:pointer->application p) (and p (% (pointer p)))) @@ -68,6 +70,7 @@ (bind-type qtapplication c-pointer qt:->pointer qt:pointer->application) (bind-type qtpixmap c-pointer qt:->pointer qt:pointer->pixmap) (bind-type qticon c-pointer qt:->pointer qt:pointer->icon) +(bind-type qtlayout c-pointer qt:->pointer qt:pointer->layout) (bind-type qtobject c-pointer qt:->pointer qt:pointer->object) (bind-type qttimer c-pointer qt:->pointer qt:pointer->timer) (bind-type qtreceiver c-pointer qt:->pointer qt:pointer->receiver) @@ -118,6 +121,8 @@ extern "C" { (qt:pointer->widget (qt:->pointer result))) ((qt:inherits result "QAction") (qt:pointer->action (qt:->pointer result))) + ((qt:inherits result "QLayout") + (qt:pointer->layout (qt:->pointer result))) (#t result)) result))))) @@ -215,6 +220,7 @@ extern "C" { (cond ((qt:inherits w "QComboBox") (qt:addcomboboxitem w x)) ((qt:inherits w "QListWidget") (qt:addlistwidgetitem w x)) ((qt:inherits w "QTreeWidget") (qt:addtreewidgetitem w x)) + ((qt:inherits w "QLayout") (qt:addlayoutwidget w x)) (else (error 'qt:add "invalid widget" w x)) ) ) (define (qt:item w i) (and (positive? i) (qt:listwidgetitem w i)))