repos
/
qt.gui
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
filehistory
normal
|
plain
|
shade
|
zebra
QList<QObject*>
Annotate for file src/list.lisp
2009-06-11 tobias
1
(in-package :qt)
2010-01-10 tobias
2
2009-05-31 tobias
3
(defmacro define-qlist-wrapper (type-name &optional c-name)
22:22:22 '
4
(let* ((c-name (or c-name type-name))
'
5
(type (string-upcase c-name))
'
6
(list-type (symbolicate 'qlist- type)))
2010-01-10 tobias
7
`(progn
2009-05-31 tobias
8
(defcfun ,(concatenate 'string "qt_smoke_list_" c-name "_size") :int
2010-01-10 tobias
9
"Returns the size of LIST."
08:52:49 '
10
(list :pointer))
2009-05-31 tobias
11
(defcfun ,(concatenate 'string "qt_smoke_free_list_" c-name) :void
2010-01-10 tobias
12
"Frees LIST."
08:52:49 '
13
(list :pointer))
2009-05-31 tobias
14
(defcfun ,(concatenate 'string "qt_smoke_make_list_" c-name) :pointer
2010-01-10 tobias
15
"Makes a list.")
2009-05-31 tobias
16
(defcfun ,(concatenate 'string "qt_smoke_list_" c-name "_at") :pointer
2010-01-10 tobias
17
"Returns the a newly constructed copy of the element at position AT of LIST."
08:52:49 '
18
(list :pointer)
'
19
(index :int))
2009-05-31 tobias
20
(defcfun ,(concatenate 'string "qt_smoke_list_" c-name "_append") :pointer
2010-01-10 tobias
21
"Appends NEW-ELEMENT to LIST."
08:52:49 '
22
(list :pointer)
'
23
(new-element :pointer))
2009-08-02 tobias
24
(define-foreign-type ,list-type ()
11:15:21 '
25
()
'
26
(:actual-type :pointer))
'
27
(define-parse-method ,list-type ()
'
28
(make-instance ',list-type))
'
29
(eval-when (:load-toplevel :execute)
2009-05-31 tobias
30
(smoke::add-type ,(format nil "const QList<~A>&" type-name)
22:39:13 '
31
',list-type)
'
32
(smoke::add-type ,(format nil "QList<~A>" type-name) ',list-type))
'
33
(defmethod translate-from-foreign (list (type ,list-type))
2009-07-01 tobias
34
(let ((vector (make-array (,(symbolicate 'qt-smoke-list-
10:58:06 '
35
type '-size)
'
36
list))))
'
37
(dotimes (index (length vector) vector)
'
38
(setf (aref vector index)
'
39
;; FIXME the retuned object is not wrapped by Smoke
'
40
;; -> change this?
'
41
(smoke::object-to-lisp
'
42
(,(symbolicate 'qt-smoke-list-
'
43
type '-at)
'
44
list index)
2009-05-31 tobias
45
(smoke::make-smoke-type *qt-smoke* ,type-name))))))
2009-08-02 tobias
46
(defmethod free-translated-object (pointer (type ,list-type) param)
11:15:21 '
47
(declare (ignore param))
'
48
(,(symbolicate 'qt-smoke-free-list- type)
'
49
pointer))
2010-01-10 tobias
50
(defun ,(symbolicate 'coerce- list-type) (list)
08:52:49 '
51
(let ((qlist (,(symbolicate 'qt-smoke-make-list- type))))
2009-09-02 tobias
52
(loop for element in list do
2010-01-10 tobias
53
(,(symbolicate 'qt-smoke-list- type '-append)
2009-09-02 tobias
54
qlist (pointer (make-instance ',type :args (list element)))))
2009-08-02 tobias
55
(smoke::make-cleanup-pointer
2010-01-10 tobias
56
qlist
08:52:49 '
57
(function ,(symbolicate 'qt-smoke-free-list- type)))))
2009-05-31 tobias
58
(define-from-lisp-translation (,(format nil "const QList<~A>&" type-name)
2009-07-01 tobias
59
,(format nil "QLIst<~A>" type-name))
2009-05-31 tobias
60
list ;; FIXME allow seqence and define element type
2009-05-31 tobias
61
,(symbolicate 'coerce- list-type)))))
2010-01-10 tobias
62
2009-09-02 tobias
63
(define-qlist-wrapper "QVariant")
2009-05-31 tobias
64
(define-qlist-wrapper "QObject*" "void")
2009-09-02 tobias
65
(define-qlist-wrapper "QByteArray")