X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/56ccd5b731e30f2d195cefc4cbf0b8640fac2c92..18b84c8043e09adb90c047fd5dfe6860e26b27e8:/gtk/gtktree.lisp diff --git a/gtk/gtktree.lisp b/gtk/gtktree.lisp index 52ee220..81d6474 100644 --- a/gtk/gtktree.lisp +++ b/gtk/gtktree.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gtktree.lisp,v 1.15 2006-02-19 19:31:15 espen Exp $ +;; $Id: gtktree.lisp,v 1.18 2006-03-03 19:00:12 espen Exp $ (in-package "GTK") @@ -81,13 +81,16 @@ (defmethod initialize-instance ((list-store list-store) &key column-types (call-next-method) (%list-store-set-column-types list-store column-types) (when column-names - (setf (object-data list-store 'column-names) column-names)) + (setf + (object-data list-store 'column-names) + (coerce column-names 'vector))) (when initial-content (loop with iter = (make-instance 'tree-iter) for row in initial-content do (list-store-append list-store row iter)))) +(defgeneric column-setter-name (store)) (defmethod column-setter-name ((list-store list-store)) (declare (ignore list-store)) @@ -221,67 +224,67 @@ (defun %tree-path-to-vector (location) (map-c-vector 'vector #'identity indices 'int depth)))) (eval-when (:compile-toplevel :load-toplevel :execute) - (defmethod alien-type ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method alien-type ((type tree-path)) + (declare (ignore type)) (alien-type 'pointer)) - (defmethod size-of ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method size-of ((type tree-path)) + (declare (ignore type)) (size-of 'pointer)) - (defmethod to-alien-form (path (type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method to-alien-form ((type tree-path) path) + (declare (ignore type)) `(%make-tree-path ,path)) - (defmethod from-alien-form (location (type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method from-alien-form ((type tree-path) location) + (declare (ignore type)) `(let ((location ,location)) (prog1 (%tree-path-to-vector location) (%tree-path-free location)))) - (defmethod copy-from-alien-form (location (type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method copy-from-alien-form ((type tree-path) location) + (declare (ignore type)) `(%tree-path-to-vector ,location)) - (defmethod cleanup-form (location (type (eql 'tree-path)) &rest args) - (declare (ignore type args)) + (define-type-method cleanup-form ((type tree-path) location) + (declare (ignore type)) `(%tree-path-free ,location))) -(defmethod to-alien-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method to-alien-function ((type tree-path)) + (declare (ignore type)) #'%make-tree-path) -(defmethod from-alien-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method from-alien-function ((type tree-path)) + (declare (ignore type)) #'(lambda (location) (prog1 (%tree-path-to-vector location) (%tree-path-free location)))) -(defmethod copy-from-alien-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method copy-from-alien-function ((type tree-path)) + (declare (ignore type )) #'%tree-path-to-vector) -(defmethod cleanup-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method cleanup-function ((type tree-path)) + (declare (ignore type)) #'%tree-path-free) -(defmethod writer-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method writer-function ((type tree-path)) + (declare (ignore type)) (let ((writer (writer-function 'pointer))) #'(lambda (path location &optional (offset 0)) (funcall writer (%make-tree-path path) location offset)))) -(defmethod reader-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method reader-function ((type tree-path)) + (declare (ignore type)) (let ((reader (reader-function 'pointer))) #'(lambda (location &optional (offset 0) weak-p) (declare (ignore weak-p)) (%tree-path-to-vector (funcall reader location offset))))) -(defmethod destroy-function ((type (eql 'tree-path)) &rest args) - (declare (ignore type args)) +(define-type-method destroy-function ((type tree-path)) + (declare (ignore type)) (let ((reader (reader-function 'pointer))) #'(lambda (location &optional (offset 0)) (%tree-path-free (funcall reader location offset))))) @@ -321,7 +324,9 @@ (defbinding %tree-model-get-value () nil (column int) (gvalue gvalue)) -(defun tree-model-value (model row column) +(defgeneric tree-model-value (model row column)) + +(defmethod tree-model-value ((model tree-model) row column) (let ((index (column-index model column)) (iter (etypecase row (tree-iter row) @@ -405,6 +410,7 @@ (defbinding tree-model-rows-reordered () nil (defun column-types (model columns) + (declare (ignore model)) (map 'vector #'(lambda (column) (find-type-number (first (mklist column)))) @@ -459,7 +465,9 @@ (defun tree-model-row-setter (model) (funcall setter value iter)) row setters))))))) -(defun (setf tree-model-value) (value model row column) +(defgeneric (setf tree-model-value) (value model row column)) + +(defmethod (setf tree-model-value) (value (model tree-model) row column) (let ((iter (etypecase row (tree-iter row) (tree-path (multiple-value-bind (valid iter) @@ -762,6 +770,7 @@ (defbinding tree-store-move-after () nil (defmethod initialize-instance ((tree-view tree-view) &rest initargs &key column) + (declare (ignore column)) (call-next-method) (mapc #'(lambda (column) (tree-view-append-column tree-view column))