Fix typo in gl-drawing-area code
[cl-gtk2.git] / gtk / gtk.list-store.lisp
blob211e4fb26c6734025817ed2fd3408df9b773120d
1 (in-package :gtk)
3 (defcfun gtk-list-store-set-column-types :void
4 (list-store (g-object list-store))
5 (n-columns :int)
6 (types :pointer))
8 (defun call-list-store-set-column-types (list-store column-types)
9 (let ((n (length column-types)))
10 (with-foreign-object (types-ar 'g-type-designator n)
11 (iter (for i from 0 below n)
12 (for type in column-types)
13 (setf (mem-aref types-ar 'g-type-designator i) type))
14 (gtk-list-store-set-column-types list-store n types-ar))))
16 (defmethod initialize-instance :after ((store list-store) &rest initargs &key (column-types nil column-types-supplied-p) &allow-other-keys)
17 (declare (ignore initargs))
18 (when column-types-supplied-p
19 (call-list-store-set-column-types store column-types)))
21 (defcfun (%gtk-list-store-set-value "gtk_list_store_set_value") :void
22 (list-store (g-object list-store))
23 (iter (g-boxed-foreign tree-iter))
24 (column :int)
25 (value :pointer))
27 (defun gtk-list-store-set-value (list-store iter column value)
28 (with-foreign-object (v 'g-value)
29 (set-g-value v value (tree-model-column-type list-store column) :zero-g-value t)
30 (%gtk-list-store-set-value list-store iter column v)
31 (g-value-unset v)
32 (values)))
34 (defun list-store-value (list-store iter column)
35 (tree-model-value list-store iter column))
37 (defun (setf list-store-value) (new-value list-store iter column)
38 (gtk-list-store-set-value list-store iter column new-value)
39 new-value)
41 (export 'list-store-value)
43 ; unimplemented
44 ;void gtk_list_store_set_valuesv (GtkListStore *list_store,
45 ; GtkTreeIter *iter,
46 ; gint *columns,
47 ; GValue *values,
48 ; gint n_values);
50 (defcfun (list-store-remove "gtk_list_store_remove") :boolean
51 (list-store (g-object list-store))
52 (tree-iter (g-boxed-foreign tree-iter)))
54 (export 'list-store-remove)
56 (defcfun gtk-list-store-insert :void
57 (list-store (g-object list-store))
58 (tree-iter (g-boxed-foreign tree-iter))
59 (position :int))
61 (defun list-store-insert (list-store position)
62 (let ((iter (make-tree-iter)))
63 (gtk-list-store-insert list-store iter position)
64 iter))
66 (export 'list-store-insert)
68 (defcfun gtk-list-store-insert-before :void
69 (list-store (g-object list-store))
70 (tree-iter (g-boxed-foreign tree-iter))
71 (sibling (g-boxed-foreign tree-iter)))
73 (defcfun gtk-list-store-insert-after :void
74 (list-store (g-object list-store))
75 (tree-iter (g-boxed-foreign tree-iter))
76 (sibling (g-boxed-foreign tree-iter)))
78 (defun list-store-insert-before (list-store sibling)
79 (let ((iter (make-tree-iter)))
80 (gtk-list-store-insert-before list-store iter sibling)
81 iter))
83 (defun list-store-insert-after (list-store sibling)
84 (let ((iter (make-tree-iter)))
85 (gtk-list-store-insert-after list-store iter sibling)
86 iter))
88 (export '(list-store-insert-before list-store-insert-after))
90 (defcfun gtk-list-store-insert-with-valuesv :void
91 (list-store (g-object list-store))
92 (iter (g-boxed-foreign tree-iter))
93 (position :int)
94 (columns :pointer)
95 (values :pointer)
96 (n-values :int))
98 (defun list-store-insert-with-values (list-store position &rest values)
99 (let ((n (length values))
100 (iter (make-tree-iter)))
101 (with-foreign-objects ((v-ar 'g-value n)
102 (columns-ar :int n))
103 (iter (for i from 0 below n)
104 (for value in values)
105 (for type = (tree-model-column-type list-store i))
106 (setf (mem-aref columns-ar :int i) i)
107 (set-g-value (mem-aref v-ar 'g-value i) value type :zero-g-value t))
108 (gtk-list-store-insert-with-valuesv list-store iter position columns-ar v-ar n)
109 (iter (for i from 0 below n)
110 (g-value-unset (mem-aref v-ar 'g-value i)))
111 iter)))
113 (export 'list-store-insert-with-values)
115 (defcfun gtk-list-store-prepend :void
116 (list-store (g-object list-store))
117 (iter (g-boxed-foreign tree-iter)))
119 (defcfun gtk-list-store-append :void
120 (list-store (g-object list-store))
121 (iter (g-boxed-foreign tree-iter)))
123 (defun list-store-append (list-store)
124 (let ((i (make-tree-iter)))
125 (gtk-list-store-append list-store i)
128 (defun list-store-prepend (list-store)
129 (let ((i (make-tree-iter)))
130 (gtk-list-store-prepend list-store i)
133 (export '(list-store-append list-store-prepend))
135 (defcfun (list-store-clear "gtk_list_store_clear") :void
136 (list-store (g-object list-store)))
138 (defcfun (list-store-iter-is-valid "gtk_list_store_iter_is_valid") :boolean
139 (list-store (g-object list-store))
140 (iter (g-boxed-foreign tree-iter)))
142 ; not implemented yet
143 ;(defcfun (list-store-reorder "gtk_list_store_reorder") :void
144 ; ())
146 (defcfun (list-store-swap "gtk_list_store_swap") :void
147 (list-store (g-object list-store))
148 (a (g-boxed-foreign tree-iter))
149 (b (g-boxed-foreign tree-iter)))
151 (defcfun (list-store-move-before "gtk_list_store_move_before") :void
152 (list-store (g-object list-store))
153 (iter (g-boxed-foreign tree-iter))
154 (position (g-boxed-foreign tree-iter)))
156 (defcfun (list-store-move-after "gtk_list_store_move_after") :void
157 (list-store (g-object list-store))
158 (iter (g-boxed-foreign tree-iter))
159 (position (g-boxed-foreign tree-iter)))
161 (export '(list-store-clear list-store-iter-is-valid list-store-swap list-store-move-before list-store-move-after))