fix typos in function names
[cl-gtk2.git] / gtk / gtk.tree-selection.lisp
1 (in-package :gtk)
2
3 (defcfun gtk-tree-selection-set-select-function :void
4   (selection g-object)
5   (select-function :pointer)
6   (data :pointer)
7   (destroy-notify :pointer))
8
9 (defcallback gtk-tree-selection-select-function-callback :boolean
10     ((selection g-object) (model g-object) (path (g-boxed-ref tree-path)) (path-currently-selected :boolean) (data :pointer))
11   (let ((fn (get-stable-pointer-value data)))
12     (restart-case
13         (funcall fn selection model path path-currently-selected)
14       (return-true () t)
15       (return-false () nil))))
16
17 (defun tree-selection-set-select-function (tree-selection fn)
18   (gtk-tree-selection-set-select-function tree-selection
19                                           (callback gtk-tree-selection-select-function-callback)
20                                           (allocate-stable-pointer fn)
21                                           (callback stable-pointer-free-destroy-notify-callback)))
22
23 (defcfun gtk-tree-selection-get-user-data :pointer (tree-selection g-object))
24
25 (defun tree-selection-get-select-function (tree-selection)
26   (let ((ptr (gtk-tree-selection-get-user-data tree-selection)))
27     (unless (null-pointer-p ptr)
28       (get-stable-pointer-value ptr))))
29
30 (defcfun gtk-tree-selection-get-selected :boolean
31   (selection g-object)
32   (model :pointer)
33   (iter (g-boxed-ref tree-iter)))
34
35 (defun tree-selection-selected (tree-selection)
36   (let ((iter (make-instance 'tree-iter)))
37     (if (gtk-tree-selection-get-selected tree-selection (null-pointer) iter)
38         iter
39         (release iter))))
40
41 (export 'tree-selection-selected)
42
43 (defcfun gtk-tree-selection-selected-foreach :void
44   (selection g-object)
45   (func :pointer)
46   (data :pointer))
47
48 (defcallback gtk-tree-selection-foreach-callback :void
49     ((model g-object) (path (g-boxed-ref tree-path)) (iter (g-boxed-ref tree-iter)) (data :pointer))
50   (let ((fn (get-stable-pointer-value data)))
51     (funcall fn model path iter)))
52
53 (defun map-tree-selection-rows (tree-selection fn)
54   (with-stable-pointer (ptr fn)
55     (gtk-tree-selection-selected-foreach tree-selection (callback gtk-tree-selection-foreach-callback) ptr)))
56
57 (export 'map-tree-selection-rows)
58
59 (defcfun gtk-tree-selection-get-selected-rows (glist (g-boxed-ref tree-path) :free-from-foreign t)
60   (selection g-object)
61   (model :pointer))
62
63 (defun tree-selection-selected-rows (tree-selection)
64   (gtk-tree-selection-get-selected-rows tree-selection (null-pointer)))
65
66 (export 'tree-selection-selected-rows)
67
68 (defcfun (tree-selection-count-selected-rows "gtk_tree_selection_count_selected_rows") :int
69   (selection g-object))
70
71 (export 'tree-selection-count-selected-rows)
72
73 (defcfun (tree-selection-select-path "gtk_tree_selection_select_path") :void
74   (selection g-object)
75   (path (g-boxed-ref tree-path)))
76
77 (export 'tree-selection-select-path)
78
79 (defcfun (tree-selection-unselect-path "gtk_tree_selection_unselect_path") :void
80   (selection g-object)
81   (path (g-boxed-ref tree-path)))
82
83 (export 'tree-selection-unselect-path)
84
85 (defcfun (tree-selection-path-selected-p "gtk_tree_selection_path_is_selected") :boolean
86   (selection g-object)
87   (path (g-boxed-ref tree-path)))
88
89 (export 'tree-selection-path-selected-p)
90
91 (defcfun (tree-selection-select-iter "gtk_tree_selection_select_iter") :void
92   (selection g-object)
93   (iter (g-boxed-ref tree-iter)))
94
95 (export 'tree-selection-select-iter)
96
97 (defcfun (tree-selection-unselect-iter "gtk_tree_selection_unselect_iter") :void
98   (selection g-object)
99   (iter (g-boxed-ref tree-iter)))
100
101 (export 'tree-selection-unselect-iter)
102
103 (defcfun (tree-selection-iter-selected-p "gtk_tree_selection_iter_is_selected") :boolean
104   (selection g-object)
105   (iter (g-boxed-ref tree-iter)))
106
107 (export 'tree-selection-iter-selected-p)
108
109 (defcfun (tree-selection-select-all "gtk_tree_selection_select_all") :void
110   (selection g-object))
111
112 (export 'tree-selection-select-all)
113
114 (defcfun (tree-selection-unselect-all "gtk_tree_selection_unselect_all") :void
115   (selection g-object))
116
117 (export 'tree-selection-unselect-all)
118
119 (defcfun (tree-selection-select-range "gtk_tree_selection_select_range") :void
120   (selection g-object)
121   (start-path (g-boxed-ref tree-path))
122   (end-path (g-boxed-ref tree-path)))
123
124 (export 'tree-selection-select-range)
125
126 (defcfun (tree-selection-unselect-range "gtk_tree_selection_unselect_range") :void
127   (selection g-object)
128   (start-path (g-boxed-ref tree-path))
129   (end-path (g-boxed-ref tree-path)))
130
131 (export 'tree-selection-unselect-range)