repos
/
qt.gui
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
filehistory
normal
|
plain
|
shade
|
zebra
Rework QObject parent ownership transfer
Annotate for file src/properties.lisp
2009-06-11 tobias
1
(in-package :qt)
2010-01-10 tobias
2
08:52:49 '
3
(defun reverse-lispify (symbol)
'
4
"Converts the name of symbol to C++ style."
2009-07-22 tobias
5
(smoke::lisp-to-cxx (symbol-name symbol)))
2010-01-10 tobias
6
08:52:49 '
7
(defun property-name (name)
'
8
"The property name is a string or a to camelCase converted symbol."
'
9
(typecase name
'
10
(string name)
'
11
(symbol (reverse-lispify name))))
'
12
2009-06-11 tobias
13
(defun property (object name)
2010-01-10 tobias
14
"Returns the property NAME of OBJECT."
2009-06-11 tobias
15
(from-variant (cxx:property object (property-name name))))
2010-01-10 tobias
16
2009-05-31 tobias
17
2009-06-11 tobias
18
(defun (setf property) (new-value object name)
2009-07-22 tobias
19
(cxx:set-property object (property-name name)
22:21:01 '
20
(make-instance 'qt:variant
'
21
:args (list new-value)))
2010-01-10 tobias
22
new-value)
08:52:49 '
23
2009-05-31 tobias
24
(defun remove-property (object name)
17:33:32 '
25
"Removes the property NAME from OBJECT."
'
26
(setf (property object name) (qt:make-variant)))
'
27
2009-06-11 tobias
28
(defun property-p (object name)
2010-01-10 tobias
29
"Returns T when NAME is a property of OBJECT and NIL otherwise."
2009-06-11 tobias
30
(variant-boundp (cxx:property object (property-name name))))
2010-01-10 tobias
31
08:52:49 '
32
(defun meta-object-properties (meta-object &optional (all t))
'
33
"Returns a list of the properties of META-OBJECT."
'
34
(loop for index from (if all 0 (cxx:property-offset meta-object))
'
35
below (cxx:property-count meta-object)
2009-07-22 tobias
36
collect (smoke::lispify (cxx:name (cxx:property meta-object index)))))
2010-01-10 tobias
37
2009-06-11 tobias
38
(defgeneric class-properties (class)
2010-01-10 tobias
39
(:documentation "Returns a list of the properties of CLASS.")
08:52:49 '
40
(:method ((class class))
2009-07-22 tobias
41
(meta-object-properties (cxx:static-meta-object class)))
2010-01-10 tobias
42
(:method ((symbol symbol))
2009-06-11 tobias
43
(class-properties (find-class symbol))))
2010-01-10 tobias
44
2009-06-11 tobias
45
(defgeneric class-direct-properties (class)
2010-01-10 tobias
46
(:documentation "Returns a list of the properties of CLASS.")
08:52:49 '
47
(:method ((class class))
'
48
(meta-object-properties (cxx:static-meta-object class) nil))
'
49
(:method ((symbol symbol))
2009-06-11 tobias
50
(class-direct-properties (find-class symbol))))
2010-01-10 tobias
51
08:52:49 '
52
(defun dynamic-properties (object)
2009-07-22 tobias
53
(map 'list (compose #'smoke::lispify #'cxx:data)
2010-01-10 tobias
54
(cxx:dynamic-property-names object)))
08:52:49 '
55
2009-06-11 tobias
56
(defun properties (object)
2010-01-10 tobias
57
"Returns a list of the properties of OBJECT."
2009-07-22 tobias
58
(nconc (dynamic-properties object)
22:21:01 '
59
(meta-object-properties (cxx:meta-object object))))