chiark / gitweb /
Added missing DESTROY-FUNCTION method for TREE-PATH
[clg] / gtk / gtktree.lisp
CommitLineData
167450a3 1;; Common Lisp bindings for GTK+ v2.0
8725ec34 2;; Copyright (C) 1999-2005 Espen S. Johnsen <espen@users.sf.net>
167450a3 3;;
4;; This library is free software; you can redistribute it and/or
5;; modify it under the terms of the GNU Lesser General Public
6;; License as published by the Free Software Foundation; either
7;; version 2 of the License, or (at your option) any later version.
8;;
9;; This library is distributed in the hope that it will be useful,
10;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12;; Lesser General Public License for more details.
13;;
14;; You should have received a copy of the GNU Lesser General Public
15;; License along with this library; if not, write to the Free Software
16;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
f433f8a7 18;; $Id: gtktree.lisp,v 1.8 2005-03-03 10:05:32 espen Exp $
167450a3 19
20
21(in-package "GTK")
22
23
24;;;; Cell Layout
25
26(defbinding cell-layout-pack-start () nil
27 (cell-layout cell-layout)
28 (cell cell-renderer)
29 (expand boolean))
30
31(defbinding cell-layout-pack-end () nil
32 (cell-layout cell-layout)
33 (cell cell-renderer)
34 (expand boolean))
35
36(defun cell-layout-pack (layout cell &key end expand)
37 (if end
38 (cell-layout-pack-end layout cell expand)
39 (cell-layout-pack-start layout cell expand)))
40
2a8752b0 41
167450a3 42(defbinding cell-layout-reorder () nil
43 (cell-layout cell-layout)
44 (cell cell-renderer)
45 (position int))
46
47(defbinding cell-layout-clear () nil
48 (cell-layout cell-layout))
49
8725ec34 50(defbinding cell-layout-add-attribute
51 (cell-layout cell attribute column &optional model) nil
167450a3 52 (cell-layout cell-layout)
53 (cell cell-renderer)
54 ((string-downcase attribute) string)
8725ec34 55 ((if model (column-index model column) column) int))
167450a3 56
57(def-callback-marshal %cell-layout-data-func
f4175703 58 (nil cell-layout cell-renderer tree-model (copy-of tree-iter)))
167450a3 59
60(defbinding cell-layout-set-cell-data-func (cell-layout cell function) nil
61 (cell-layout cell-layout)
62 (cell cell-renderer)
63 ((callback %cell-layout-data-func) pointer)
64 ((register-callback-function function) unsigned-int)
73572c12 65 ((callback user-data-destroy-func) pointer))
167450a3 66
67(defbinding cell-layout-clear-attributes () nil
68 (cell-layout cell-layout)
69 (cell cell-renderer))
70
71
72
73;;;; List Store
74
2a8752b0 75(defmethod initialize-instance ((list-store list-store) &key column-types
76 column-names initial-content)
167450a3 77 (call-next-method)
2a8752b0 78 (%list-store-set-column-types list-store column-types)
79 (when column-names
80 (setf (object-data list-store 'column-names) column-names))
81 (when initial-content
82 (loop
83 with iter = (make-instance 'tree-iter)
84 for row in initial-content
85 do (list-store-append list-store row iter))))
167450a3 86
87
2a8752b0 88(defmethod column-setter-name ((list-store list-store))
89 (declare (ignore list-store))
90 "gtk_list_store_set")
167450a3 91
2a8752b0 92(defbinding %list-store-set-column-types () nil
167450a3 93 (list-store list-store)
2a8752b0 94 ((length columns) unsigned-int)
95 (columns (vector gtype)))
167450a3 96
f4175703 97(defbinding %list-store-remove () boolean
167450a3 98 (list-store list-store)
99 (tree-iter tree-iter))
100
f4175703 101(defun list-store-remove (store row)
102 (etypecase row
103 (tree-iter
104 (%list-store-remove store row))
105 (tree-path
106 (multiple-value-bind (valid iter) (tree-model-get-iter store row)
107 (if valid
108 (%list-store-remove store iter)
109 (error "~A not poiniting to av valid iterator in ~A" row store))))
110 (tree-row-reference
111 (let ((path (tree-row-reference-get-path row)))
112 (if path
113 (list-store-remove store path)
114 (error "~A not valid" row))))))
115
116
2a8752b0 117(defbinding %list-store-insert () nil
167450a3 118 (list-store list-store)
2a8752b0 119 (tree-iter tree-iter)
167450a3 120 (position int))
121
2a8752b0 122(defun list-store-insert
123 (store position &optional data (iter (make-instance 'tree-iter)))
124 (%list-store-insert store iter position)
125 (when data (%tree-model-set store iter data))
126 iter)
127
128(defbinding %list-store-insert-before () nil
167450a3 129 (list-store list-store)
2a8752b0 130 (tree-iter tree-iter)
167450a3 131 (sibling (or null tree-iter)))
132
2a8752b0 133(defun list-store-insert-before
134 (store sibling &optional data (iter (make-instance 'tree-iter)))
135 (%list-store-insert-before store iter sibling)
136 (when data (%tree-model-set store iter data))
137 iter)
138
139(defbinding %list-store-insert-after
140 (list-store &optional sibling (tree-iter (make-instance 'tree-iter))) nil
167450a3 141 (list-store list-store)
2a8752b0 142 (tree-iter tree-iter)
167450a3 143 (sibling (or null tree-iter)))
144
2a8752b0 145(defun list-store-insert-after
146 (store sibling &optional data (iter (make-instance 'tree-iter)))
147 (%list-store-insert-after store iter sibling)
148 (when data (%tree-model-set store iter data))
149 iter)
150
151(defbinding %list-store-prepend () nil
167450a3 152 (list-store list-store)
2a8752b0 153 (tree-iter tree-iter))
154
155(defun list-store-prepend
156 (store &optional data (iter (make-instance 'tree-iter)))
157 (%list-store-prepend store iter)
158 (when data (%tree-model-set store iter data))
159 iter)
167450a3 160
2a8752b0 161(defbinding %list-store-append () nil
167450a3 162 (list-store list-store)
2a8752b0 163 (tree-iter tree-iter))
164
165(defun list-store-append
166 (store &optional data (iter (make-instance 'tree-iter)))
167 (%list-store-append store iter)
168 (when data (%tree-model-set store iter data))
169 iter)
167450a3 170
171(defbinding list-store-clear () nil
172 (list-store list-store))
173
174(defbinding list-store-reorder () nil
175 (list-store list-store)
176 (new-order (vector int)))
177
178(defbinding list-store-swap () nil
179 (list-store list-store)
180 (a tree-iter)
181 (b tree-iter))
182
183(defbinding list-store-move-before () nil
184 (list-store list-store)
185 (iter tree-iter)
186 (psoition (or null tree-iter)))
187
167450a3 188(defbinding list-store-move-after () nil
189 (list-store list-store)
190 (iter tree-iter)
191 (psoition tree-iter))
192
193
194;;; Tree Model
195
2a8752b0 196(defbinding %tree-path-free () nil
197 (location pointer))
198
199(defbinding %tree-path-get-indices () pointer
200 (location pointer))
201
202(defbinding %tree-path-get-depth () int
203 (location pointer))
204
205(defun %make-tree-path (path)
206 (let ((c-vector (make-c-vector 'int (length path) path))
207 (location (allocate-memory (+ (size-of 'int) (size-of 'pointer)))))
208 (funcall (writer-function 'int) (length path) location)
209 (funcall (writer-function 'pointer) c-vector location (size-of 'int))
210 location))
211
f4175703 212(defun %tree-path-to-vector (location)
213 (let ((indices (%tree-path-get-indices location))
214 (depth (%tree-path-get-depth location)))
215 (if (null-pointer-p indices)
216 #()
217 (map-c-vector 'vector #'identity indices 'int depth))))
2a8752b0 218
219(eval-when (:compile-toplevel :load-toplevel :execute)
220 (defmethod alien-type ((type (eql 'tree-path)) &rest args)
221 (declare (ignore type args))
222 (alien-type 'pointer))
223
224 (defmethod size-of ((type (eql 'tree-path)) &rest args)
225 (declare (ignore type args))
226 (size-of 'pointer))
227
228 (defmethod to-alien-form (path (type (eql 'tree-path)) &rest args)
229 (declare (ignore type args))
230 `(%make-tree-path ,path))
231
2a8752b0 232 (defmethod from-alien-form (location (type (eql 'tree-path)) &rest args)
233 (declare (ignore type args))
f4175703 234 `(let ((location ,location))
235 (prog1
236 (%tree-path-to-vector location)
237 (%tree-path-free location))))
2a8752b0 238
f4175703 239 (defmethod copy-from-alien-form (location (type (eql 'tree-path)) &rest args)
2a8752b0 240 (declare (ignore type args))
f4175703 241 `(%tree-path-to-vector ,location))
2a8752b0 242
243 (defmethod cleanup-form (location (type (eql 'tree-path)) &rest args)
244 (declare (ignore type args))
f4175703 245 `(%tree-path-free ,location)))
246
247(defmethod to-alien-function ((type (eql 'tree-path)) &rest args)
248 (declare (ignore type args))
249 #'%make-tree-path)
2a8752b0 250
f4175703 251(defmethod from-alien-function ((type (eql 'tree-path)) &rest args)
252 (declare (ignore type args))
253 #'(lambda (location)
254 (prog1
255 (%tree-path-to-vector location)
256 (%tree-path-free location))))
257
258(defmethod copy-from-alien-function ((type (eql 'tree-path)) &rest args)
259 (declare (ignore type args))
260 #'%tree-path-to-vector)
261
262(defmethod cleanup-function ((type (eql 'tree-path)) &rest args)
263 (declare (ignore type args))
264 #'%tree-path-free)
265
266(defmethod writer-function ((type (eql 'tree-path)) &rest args)
267 (declare (ignore type args))
268 (let ((writer (writer-function 'pointer)))
269 #'(lambda (path location &optional (offset 0))
270 (funcall writer (%make-tree-path path) location offset))))
271
272(defmethod reader-function ((type (eql 'tree-path)) &rest args)
273 (declare (ignore type args))
274 (let ((reader (reader-function 'pointer)))
275 #'(lambda (location &optional (offset 0))
276 (%tree-path-to-vector (funcall reader location offset)))))
2a8752b0 277
f433f8a7 278(defmethod destroy-function ((type (eql 'tree-path)) &rest args)
279 (declare (ignore type args))
280 (let ((reader (reader-function 'pointer)))
281 #'(lambda (location &optional (offset 0))
282 (%tree-path-free (funcall reader location offset)))))
283
2a8752b0 284
285(defbinding %tree-row-reference-new () pointer
286 (model tree-model)
287 (path tree-path))
288
289(defmethod initialize-instance ((reference tree-row-reference) &key model path)
2a8752b0 290 (setf
291 (slot-value reference 'location)
292 (%tree-row-reference-new model path))
293 (call-next-method))
294
295(defbinding tree-row-reference-get-path () tree-path
296 (reference tree-row-reference))
297
298(defbinding (tree-row-reference-valid-p "gtk_tree_row_reference_valid") () boolean
299 (reference tree-row-reference))
300
301
18e45ba6 302(defbinding tree-model-get-column-type () gtype ;type-number
2a8752b0 303 (tree-model tree-model)
304 (index int))
305
306(defbinding tree-model-get-iter
307 (model path &optional (iter (make-instance 'tree-iter))) boolean
308 (model tree-model)
309 (iter tree-iter :return)
310 (path tree-path))
311
312(defbinding tree-model-get-path () tree-path
313 (tree-model tree-model)
314 (iter tree-iter))
315
316(defbinding %tree-model-get-value () nil
317 (tree-model tree-model)
318 (iter tree-iter)
319 (column int)
320 (gvalue gvalue))
321
18e45ba6 322(defun tree-model-column-value (model iter column)
2a8752b0 323 (let ((index (column-index model column)))
0d46865d 324 (with-gvalue (gvalue)
2a8752b0 325 (%tree-model-get-value model iter index gvalue))))
326
327(defbinding tree-model-iter-next () boolean
328 (tree-model tree-model)
329 (iter tree-iter :return))
330
331(defbinding tree-model-iter-children
332 (tree-model parent &optional (iter (make-instance 'tree-iter))) boolean
333 (tree-model tree-model)
334 (iter tree-iter :return)
335 (parent (or null tree-iter)))
336
337(defbinding (tree-model-iter-has-child-p "gtk_tree_model_iter_has_child")
338 () boolean
339 (tree-model tree-model)
340 (iter tree-iter))
341
342(defbinding tree-model-iter-n-children () int
343 (tree-model tree-model)
344 (iter tree-iter))
345
346(defbinding tree-model-iter-nth-child
73572c12 347 (tree-model parent n &optional (iter (make-instance 'tree-iter))) boolean
2a8752b0 348 (tree-model tree-model)
349 (iter tree-iter :return)
350 (parent (or null tree-iter))
351 (n int))
352
353(defbinding tree-model-iter-parent
354 (tree-model child &optional (iter (make-instance 'tree-iter))) boolean
355 (tree-model tree-model)
356 (iter tree-iter :return)
357 (child tree-iter))
358
2a8752b0 359(def-callback-marshal %tree-model-foreach-func
f4175703 360 (boolean tree-model (path (copy-of tree-path)) (iter (copy-of tree-iter))))
2a8752b0 361
362(defbinding %tree-model-foreach () nil
363 (tree-model tree-model)
364 ((callback %tree-model-foreach-func) pointer)
365 (callback-id unsigned-int))
366
367(defun tree-model-foreach (model function)
368 (with-callback-function (id function)
369 (%tree-model-foreach model id)))
370
371(defbinding tree-model-row-changed () nil
372 (tree-model tree-model)
373 (path tree-path)
374 (iter tree-iter))
375
376(defbinding tree-model-row-inserted () nil
377 (tree-model tree-model)
378 (path tree-path)
379 (iter tree-iter))
380
381(defbinding tree-model-row-has-child-toggled () nil
382 (tree-model tree-model)
383 (path tree-path)
384 (iter tree-iter))
385
386(defbinding tree-model-row-deleted () nil
387 (tree-model tree-model)
388 (path tree-path)
389 (iter tree-iter))
390
391(defbinding tree-model-rows-reordered () nil
392 (tree-model tree-model)
393 (path tree-path)
394 (iter tree-iter)
395 (new-order int))
396
397
398(defun column-types (model columns)
399 (map 'vector
400 #'(lambda (column)
401 (find-type-number (first (mklist column))))
402 columns))
403
404(defun column-index (model column)
405 (or
406 (etypecase column
407 (number column)
408 (symbol (position column (object-data model 'column-names)))
409 (string (position column (object-data model 'column-names)
410 :test #'string=)))
411 (error "~A has no column ~S" model column)))
412
413(defun tree-model-column-value-setter (model column)
414 (let ((setters (or
415 (object-data model 'column-setters)
416 (setf
417 (object-data model 'column-setters)
418 (make-array (tree-model-n-columns model)
419 :initial-element nil)))))
420 (let ((index (column-index model column)))
421 (or
422 (svref setters index)
423 (setf
424 (svref setters index)
425 (let ((setter
426 (mkbinding (column-setter-name model)
427 nil (type-of model) 'tree-iter 'int
18e45ba6 428; (type-from-number (tree-model-get-column-type model index))
429 (tree-model-get-column-type model index)
2a8752b0 430 'int)))
431 #'(lambda (value iter)
432 (funcall setter model iter index value -1))))))))
433
434(defun tree-model-row-setter (model)
435 (or
436 (object-data model 'row-setter)
437 (progn
438 ;; This will create any missing column setter
439 (loop
440 for i from 0 below (tree-model-n-columns model)
441 do (tree-model-column-value-setter model i))
442 (let ((setters (object-data model 'column-setters)))
443 (setf
444 (object-data model 'row-setter)
445 #'(lambda (row iter)
446 (map nil #'(lambda (value setter)
447 (funcall setter value iter))
448 row setters)))))))
449
450(defun (setf tree-model-column-value) (value model iter column)
451 (funcall (tree-model-column-value-setter model column) value iter)
452 value)
453
454(defun (setf tree-model-row-data) (data model iter)
455 (funcall (tree-model-row-setter model) data iter)
456 data)
457
458(defun %tree-model-set (model iter data)
459 (etypecase data
460 (vector (setf (tree-model-row-data model iter) data))
461 (cons
462 (loop
463 as (column value . rest) = data then rest
464 do (setf (tree-model-column-value model iter column) value)
465 while rest))))
167450a3 466
467
f4175703 468;;; Tree Selection
469
470(def-callback-marshal %tree-selection-func (boolean tree-selection tree-model (path (copy-of tree-path)) (path-currently-selected boolean)))
471
472(defbinding tree-selection-set-select-function (selection function) nil
473 (selection tree-selection)
474 ((callback %tree-selection-func) pointer)
475 ((register-callback-function function) unsigned-int)
73572c12 476 ((callback user-data-destroy-func) pointer))
f4175703 477
478(defbinding tree-selection-get-selected
479 (selection &optional (iter (make-instance 'tree-iter))) boolean
480 (selection tree-selection)
481 (nil null)
482 (iter tree-iter :return))
483
484(def-callback-marshal %tree-selection-foreach-func (nil tree-model (path (copy-of tree-path)) (iter (copy-of tree-iter))))
485
486(defbinding %tree-selection-selected-foreach () nil
487 (tree-selection tree-selection)
488 ((callback %tree-selection-foreach-func) pointer)
489 (callback-id unsigned-int))
490
491(defun tree-selection-selected-foreach (selection function)
492 (with-callback-function (id function)
493 (%tree-selection-selected-foreach selection id)))
494
495(defbinding tree-selection-get-selected-rows () (glist tree-path)
496 (tree-selection tree-selection)
497 (nil null))
498
499(defbinding tree-selection-count-selected-rows () int
500 (tree-selection tree-selection))
501
502(defbinding %tree-selection-select-path () nil
503 (tree-selection tree-selection)
504 (tree-path tree-path))
505
506(defbinding %tree-selection-unselect-path () nil
507 (tree-selection tree-selection)
508 (tree-path tree-path))
509
510(defbinding %tree-selection-path-is-selected () boolean
511 (tree-selection tree-selection)
512 (tree-path tree-path))
513
514(defbinding %tree-selection-select-iter () nil
515 (tree-selection tree-selection)
516 (tree-path tree-path))
517
518(defbinding %tree-selection-unselect-iter () nil
519 (tree-selection tree-selection)
520 (tree-path tree-path))
521
522(defbinding %tree-selection-iter-is-selected () boolean
523 (tree-selection tree-selection)
524 (tree-path tree-path))
525
526(defun tree-selection-select (selection row)
527 (etypecase row
528 (tree-path (%tree-selection-select-path selection row))
529 (tree-iter (%tree-selection-select-iter selection row))))
530
531(defun tree-selection-unselect (selection row)
532 (etypecase row
533 (tree-path (%tree-selection-unselect-path selection row))
534 (tree-iter (%tree-selection-unselect-iter selection row))))
535
536(defun tree-selection-is-selected-p (selection row)
537 (etypecase row
538 (tree-path (%tree-selection-path-is-selected selection row))
539 (tree-iter (%tree-selection-iter-is-selected selection row))))
540
541(defbinding tree-selection-select-all () nil
542 (tree-selection tree-selection))
543
544(defbinding tree-selection-unselect-all () nil
545 (tree-selection tree-selection))
546
547(defbinding tree-selection-select-range () nil
548 (tree-selection tree-selection)
549 (start tree-path)
550 (end tree-path))
551
552(defbinding tree-selection-unselect-range () nil
553 (tree-selection tree-selection)
554 (start tree-path)
555 (end tree-path))
556
557
558
167450a3 559;;; Tree Store
560
561(defbinding %tree-store-set-column-types () nil
562 (tree-store tree-store)
2a8752b0 563 ((length columns) unsigned-int)
564 (columns (vector gtype)))
167450a3 565
2a8752b0 566(defmethod initialize-instance ((tree-store tree-store) &key column-types
567 column-names)
167450a3 568 (call-next-method)
2a8752b0 569 (%tree-store-set-column-types tree-store column-types)
570 (when column-names
571 (setf (object-data tree-store 'column-names) column-names)))
167450a3 572
2a8752b0 573(defmethod column-setter-name ((tree-store tree-store))
574 (declare (ignore tree-store))
575 "gtk_tree_store_set")
167450a3 576
577(defbinding tree-store-remove () boolean
578 (tree-store tree-store)
579 (tree-iter tree-iter))
580
2a8752b0 581(defbinding %tree-store-insert () nil
167450a3 582 (tree-store tree-store)
2a8752b0 583 (tree-iter tree-iter)
167450a3 584 (parent (or null tree-iter))
585 (position int))
586
2a8752b0 587(defun tree-store-insert
588 (store parent position &optional data (iter (make-instance 'tree-iter)))
589 (%tree-store-insert store iter parent position)
590 (when data (%tree-model-set store iter data))
591 iter)
592
593(defbinding %tree-store-insert-before () nil
167450a3 594 (tree-store tree-store)
2a8752b0 595 (tree-iter tree-iter)
167450a3 596 (parent (or null tree-iter))
597 (sibling (or null tree-iter)))
598
73572c12 599(defun tree-store-insert-before
2a8752b0 600 (store parent sibling &optional data (iter (make-instance 'tree-iter)))
601 (%tree-store-insert-before store iter parent sibling)
602 (when data (%tree-model-set store iter data))
603 iter)
604
605(defbinding %tree-store-insert-after () nil
167450a3 606 (tree-store tree-store)
2a8752b0 607 (tree-iter tree-iter)
167450a3 608 (parent (or null tree-iter))
609 (sibling (or null tree-iter)))
610
2a8752b0 611(defun tree-store-insert-after
612 (store parent sibling &optional data (iter (make-instance 'tree-iter)))
613 (%tree-store-insert-after store iter parent sibling)
614 (when data (%tree-model-set store iter data))
615 iter)
616
617(defbinding %tree-store-prepend () nil
167450a3 618 (tree-store tree-store)
2a8752b0 619 (tree-iter tree-iter)
167450a3 620 (parent (or null tree-iter)))
621
2a8752b0 622(defun tree-store-prepend
623 (store parent &optional data (iter (make-instance 'tree-iter)))
624 (%tree-store-prepend store iter parent)
625 (when data (%tree-model-set store iter data))
626 iter)
627
628(defbinding %tree-store-append () nil
167450a3 629 (tree-store tree-store)
2a8752b0 630 (tree-iter tree-iter)
167450a3 631 (parent (or null tree-iter)))
632
2a8752b0 633(defun tree-store-append
634 (store parent &optional data (iter (make-instance 'tree-iter)))
635 (%tree-store-append store iter parent)
636 (when data (%tree-model-set store iter data))
637 iter)
638
167450a3 639(defbinding (tree-store-is-ancestor-p "gtk_tree_store_is_ancestor") () boolean
640 (tree-store tree-store)
641 (tree-iter tree-iter)
642 (descendant tree-iter))
643
644(defbinding tree-store-iter-depth () int
645 (tree-store tree-store)
646 (tree-iter tree-iter))
647
648(defbinding tree-store-clear () nil
649 (tree-store tree-store))
650
651(defbinding tree-store-reorder () nil
652 (tree-store tree-store)
653 (parent tree-iter)
654 (new-order (vector int)))
655
656(defbinding tree-store-swap () nil
657 (tree-store tree-store)
658 (a tree-iter)
659 (b tree-iter))
660
661(defbinding tree-store-move-before () nil
662 (tree-store tree-store)
663 (iter tree-iter)
664 (psoition (or null tree-iter)))
665
666
667(defbinding tree-store-move-after () nil
668 (tree-store tree-store)
669 (iter tree-iter)
670 (psoition tree-iter))
671
672
673
674;;; Tree View
675
f4175703 676(defmethod initialize-instance ((tree-view tree-view) &rest initargs
677 &key column)
2a8752b0 678 (call-next-method)
679 (mapc #'(lambda (column)
680 (tree-view-append-column tree-view column))
681 (get-all initargs :column)))
682
683
167450a3 684(defbinding tree-view-columns-autosize () nil
685 (tree-view tree-view))
686
687(defbinding tree-view-append-column () int
688 (tree-view tree-view)
689 (tree-view-column tree-view-column))
690
691(defbinding tree-view-remove-column () int
692 (tree-view tree-view)
693 (tree-view-column tree-view-column))
694
73572c12 695(defbinding tree-view-insert-column (view column position) int
167450a3 696 (view tree-view)
697 (column tree-view-column)
698 ((if (eq position :end) -1 position) int))
699
700(defbinding tree-view-get-column () tree-view-column
701 (tree-view tree-view)
702 (position int))
703
704(defbinding tree-view-move-column-after () nil
705 (tree-view tree-view)
706 (column tree-view-column)
707 (base-column (or null tree-view-column)))
708
709;;(defbinding tree-view-set-column drag-function ...)
710
711(defbinding tree-view-scroll-to-point () nil
712 (tree-view tree-view)
713 (tree-x int)
714 (tree-y int))
715
716(defbinding tree-view-scroll-to-cell () nil
717 (tree-view tree-view)
718 (path (or null tree-path))
719 (column (or null tree-view-column))
720 (use-align boolean)
721 (row-align single-float)
722 (col-align single-float))
723
724(defbinding tree-view-set-cursor () nil
725 (tree-view tree-view)
726 (path tree-path)
727 (focus-column tree-view-column)
728 (start-editing boolean))
729
730(defbinding tree-view-set-cursor-on-cell () nil
731 (tree-view tree-view)
732 (path tree-path)
733 (focus-column (or null tree-view-column))
734 (focus-cell (or null cell-renderer))
735 (start-editing boolean))
736
737(defbinding tree-view-get-cursor () nil
738 (tree-view tree-view)
739 (path tree-path :out )
740 (focus-column tree-view-column :out))
741
742(defbinding tree-view-row-activated () nil
743 (tree-view tree-view)
744 (path tree-path )
745 (column tree-view-column))
746
747(defbinding tree-view-expand-all () nil
748 (tree-view tree-view))
749
750(defbinding tree-view-collapse-all () nil
751 (tree-view tree-view))
752
753(defbinding tree-view-expand-to-path () nil
754 (tree-view tree-view)
755 (path tree-path))
756
757(defbinding tree-view-expand-row () nil
758 (tree-view tree-view)
759 (path tree-path)
760 (open-all boolean))
761
762(defbinding tree-view-collapse-row () nil
763 (tree-view tree-view)
764 (path tree-path))
765
f4175703 766(def-callback-marshal %tree-view-mapping-func (nil tree-view (path (copy-of tree-path))))
167450a3 767
768(defbinding %tree-view-map-expanded-rows () nil
769 (tree-view tree-view)
770 ((callback %tree-view-mapping-func) pointer)
771 (callback-id unsigned-int))
772
773(defun map-expanded-rows (function tree-view)
774 (with-callback-function (id function)
775 (%tree-view-map-expanded-rows tree-view id)))
776
777(defbinding (tree-view-row-expanded-p "gtk_tree_view_row_expanded") () boolean
778 (tree-view tree-view)
779 (path tree-path))
780
781(defbinding tree-view-get-path-at-pos
782 (tree-view x y &optional (cell-x 0) (cell-y 0)) boolean
783 (tree-view tree-view)
784 (x int)
785 (y int)
786 (path tree-path :out)
787 (column tree-view-column :out)
788 (cell-x int)
789 (cell-y int))
790
791(defbinding tree-view-get-cell-area () nil
792 (tree-view tree-view)
793 (path (or null tree-path))
794 (column (or null tree-view-column))
2a8752b0 795 ((make-instance 'gdk:rectangle) gdk:rectangle :return))
167450a3 796
797(defbinding tree-view-get-background-area () nil
798 (tree-view tree-view)
799 (path (or null tree-path))
800 (column (or null tree-view-column))
2a8752b0 801 ((make-instance 'gdk:rectangle) gdk:rectangle :return))
167450a3 802
803(defbinding tree-view-get-visible-rect () nil
804 (tree-view tree-view)
2a8752b0 805 ((make-instance 'gdk:rectangle) gdk:rectangle :return))
167450a3 806
807;; and many more functions which we'll add later
808
2a8752b0 809
810;;; Tree View Column
811