X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/b6d4ac86c7f32c64e5a0debea5ad93f2f00672e7..cff201e796189db493dbce26acb857922d0f3001:/gtk/gtktree.lisp diff --git a/gtk/gtktree.lisp b/gtk/gtktree.lisp index 503b5c5..170041d 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.19 2006-04-26 12:13:38 espen Exp $ +;; $Id: gtktree.lisp,v 1.22 2006-06-23 12:46:26 espen Exp $ (in-package "GTK") @@ -210,10 +210,11 @@ (defbinding %tree-path-get-depth () int (location pointer)) (defun %make-tree-path (path) - (let ((c-vector (make-c-vector 'int (length path) :content path)) - (location (allocate-memory (+ (size-of 'int) (size-of 'pointer))))) + (let* ((c-vector (make-c-vector 'int (length path) :content path)) + (pointer-offset (adjust-offset (size-of 'int) 'pointer)) + (location (allocate-memory (+ pointer-offset (size-of 'pointer))))) (funcall (writer-function 'int) (length path) location) - (funcall (writer-function 'pointer) c-vector location (size-of 'int)) + (funcall (writer-function 'pointer) c-vector location pointer-offset) location)) (defun %tree-path-to-vector (location) @@ -224,10 +225,11 @@ (defun %tree-path-to-vector (location) (map-c-vector 'vector #'identity indices 'int depth)))) (defmacro %with-tree-path ((var path) &body body) - (let ((vector-offset (+ (size-of 'int) (size-of 'pointer)))) - `(with-memory (,var (+ ,(size-of 'int) ,(size-of 'pointer) (* ,(size-of 'int) (length ,path)))) + (let* ((pointer-offset (adjust-offset (size-of 'int) 'pointer)) + (vector-offset (adjust-offset (+ pointer-offset (size-of 'pointer)) 'int))) + `(with-memory (,var (+ ,vector-offset (* ,(size-of 'int) (length ,path)))) (funcall (writer-function 'int) (length ,path) ,var) - (setf (ref-pointer ,var ,(size-of 'int)) (pointer+ ,var ,vector-offset)) + (setf (ref-pointer ,var ,pointer-offset) (pointer+ ,var ,vector-offset)) (make-c-vector 'int (length ,path) :content ,path :location (pointer+ ,var ,vector-offset)) ,@body))) @@ -306,6 +308,11 @@ (define-type-method destroy-function ((type tree-path) &key temp inlined) #'(lambda (location &optional (offset 0)) (%tree-path-free (ref-pointer location offset)))) +(defun ensure-tree-path (path) + (etypecase path + (string (coerce (clg-utils:split-string path :delimiter #\:) 'vector)) + (vector path))) + (defbinding %tree-row-reference-new () pointer (model tree-model) @@ -969,18 +976,54 @@ (defbinding %icon-view-set-text-column (column icon-view) nil column (column-index (icon-view-model icon-view) column)) int)) + (defbinding %%icon-view-get-text-column () int + (icon-view icon-view)) + + (defun %icon-view-get-text-column (icon-view) + (column-index + (icon-view-model icon-view) + (%%icon-view-get-text-column icon-view))) + + (defun %icon-view-text-column-boundp (icon-view) + (not (eql (%%icon-view-get-text-column icon-view) -1))) + + (defbinding %icon-view-set-markup-column (column icon-view) nil (icon-view icon-view) ((if (integerp column) column (column-index (icon-view-model icon-view) column)) int)) + (defbinding %%icon-view-get-markup-column () int + (icon-view icon-view)) + + (defun %icon-view-get-markup-column (icon-view) + (column-index + (icon-view-model icon-view) + (%%icon-view-get-markup-column icon-view))) + + (defun %icon-view-markup-column-boundp (icon-view) + (not (eql (%%icon-view-get-markup-column icon-view) -1))) + + (defbinding %icon-view-set-pixbuf-column (column icon-view) nil (icon-view icon-view) ((if (integerp column) column (column-index (icon-view-model icon-view) column)) int))) + (defbinding %%icon-view-get-pixbuf-column () int + (icon-view icon-view)) + + (defun %icon-view-get-pixbuf-column (icon-view) + (column-index + (icon-view-model icon-view) + (%%icon-view-get-pixbuf-column icon-view))) + + (defun %icon-view-pixbuf-column-boundp (icon-view) + (not (eql (%%icon-view-get-pixbuf-column icon-view) -1))) + + #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0") (progn (defbinding icon-view-get-item-at-pos () boolean