initial import
src/properties.lisp
Sun Apr 5 19:56:16 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
--- old-qt.core/src/properties.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.core/src/properties.lisp 2014-11-11 13:37:22.000000000 +0100
@@ -0,0 +1,50 @@
+(in-package :qt)
+
+(defun reverse-lispify (symbol)
+ "Converts the name of symbol to C++ style."
+ (smoke::lisp-to-cxx (symbol-name symbol)))
+
+(defun property-name (name)
+ "The property name is a string or a to camelCase converted symbol."
+ (typecase name
+ (string name)
+ (symbol (reverse-lispify name))))
+
+(defun property (object name)
+ "Returns the property NAME of OBJECT."
+ (from-variant (cxx:property object (property-name name))))
+
+(defun (setf property) (new-value object name)
+ (cxx:set-property object (property-name name)
+ (make-instance 'qt:variant
+ :args (list new-value)))
+ new-value)
+
+(defun property-p (object name)
+ "Returns T when NAME is a property of OBJECT and NIL otherwise."
+ (valid-p (cxx:property object (property-name name))))
+
+(defun meta-object-properties (meta-object &optional (all t))
+ "Returns a list of the properties of META-OBJECT."
+ (loop for index from (if all 0 (cxx:property-offset meta-object))
+ below (cxx:property-count meta-object)
+ collect (smoke::lispify (cxx:name (cxx:property meta-object index)))))
+
+(defgeneric class-properties (class)
+ (:documentation "Returns a list of the properties of CLASS.")
+ (:method ((class class))
+ (meta-object-properties (cxx:static-meta-object class)))
+ (:method ((symbol symbol))
+ (class-properties (find-class symbol))))
+
+(defgeneric class-direct-properties (class)
+ (:documentation "Returns a list of the properties of CLASS.")
+ (:method ((class class))
+ (meta-object-properties (cxx:static-meta-object class) nil))
+ (:method ((symbol symbol))
+ (class-direct-properties (find-class symbol))))
+
+(defun properties (object)
+ "Returns a list of the properties of OBJECT."
+ (warn "FIXME: dynamicPropertyNames not implemented")
+ (meta-object-properties (cxx:meta-object object)))