/[gtk-cffi]/gtk-cffi/gtk/tree-view-column.lisp
ViewVC logotype

Contents of /gtk-cffi/gtk/tree-view-column.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Sun Oct 7 12:02:11 2012 UTC (18 months, 1 week ago) by rklochkov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +87 -83 lines
Fixed examples. Changed cell properties for tree-column to be set as :attributes
Fixed double init in g-value.
1 (in-package :gtk-cffi)
2
3 (defclass tree-view-column (cell-layout)
4 ())
5
6 (defcfun gtk-tree-view-column-new :pointer)
7 (defcfun gtk-tree-view-column-new-with-area :pointer (area pobject))
8
9 (defmethod gconstructor ((tree-view-column tree-view-column)
10 &key area
11 &allow-other-keys)
12 (initialize tree-view-column '(area))
13 (if area
14 (gtk-tree-view-column-new-with-area area)
15 (gtk-tree-view-column-new)))
16
17 (defcenum tree-view-column-sizing :grow-only :autosize :fixed)
18
19
20 (defslots tree-view-column
21 title :string
22 spacing :int
23 visible :boolean
24 resizable :boolean
25 sizing tree-view-column-sizing
26 fixed-width :int
27 min-width :int
28 max-width :int
29 expand :boolean
30 clickable :boolean
31 widget pobject
32 alignment :float
33 reorderable :boolean
34 sort-column-id :int
35 sort-indicator :boolean
36 sort-order sort-type)
37
38 (defcfun gtk-tree-view-column-pack-start :void
39 (tree-view-column pobject) (renderer pobject) (expand :boolean))
40
41 (defcfun gtk-tree-view-column-pack-end :void
42 (tree-view-column pobject) (renderer pobject) (expand :boolean))
43
44 (defmethod pack ((tree-view-column tree-view-column)
45 (cell-renderer cell-renderer)
46 &key end expand)
47 (funcall (if end
48 #'gtk-tree-view-column-pack-end
49 #'gtk-tree-view-column-pack-start)
50 tree-view-column cell-renderer expand)
51 (iter
52 (for (attr column) in (attributes cell-renderer))
53 (add-attribute tree-view-column cell-renderer attr column)))
54
55 (deffuns tree-view-column
56 (add-attribute :void (cell pobject) (attr cffi-keyword) (column :int))
57 (clear-attributes :void (cell-renderer pobject))
58 (clear :void)
59 (clicked :void)
60 (cell-is-visible :boolean)
61 (queue-resize :void &key)
62 (:get tree-view pobject)
63 (:get x-offset :int)
64 (focus-cell :void (cell-renderer pobject))
65 (cell-set-cell-data :void (model pobject) (iter (struct tree-iter))
66 (is-expander :boolean) (is-expanded :boolean)))
67
68 (defcfun gtk-tree-view-column-set-cell-data-func :void
69 (tree-view-column pobject) (renderer pobject) (func pfunction)
70 (data pdata) (notify :pointer))
71
72 (defmethod (setf cell-data-func) (func
73 (tree-view-column tree-view-column)
74 (cell-renderer cell-renderer)
75 &key data destroy-notify)
76 (set-callback tree-view-column gtk-tree-view-column-set-cell-data-func
77 cb-cell-data-func func data destroy-notify cell-renderer))
78
79
80
81 (defcfun gtk-tree-view-column-cell-get-size :void
82 (column pobject) (cell-renderer pobject) (area (struct rectangle))
83 (x-offset :pointer) (y-offset :pointer) (width :pointer) (height :pointer))
84
85 (defmethod cell-get-size ((tree-view-column tree-view-column)
86 (cell-renderer cell-renderer) area)
87 (with-foreign-outs-list
88 ((x-offset :int) (y-offset :int) (width :int) (height :int)) :ignore
89 (gtk-tree-view-column-cell-get-size tree-view-column cell-renderer area
90 x-offset y-offset width height)))
91
92 (defcfun gtk-tree-view-column-cell-get-position :boolean
93 (column pobject) (cell-renderer pobject)
94 (start-pos :pointer) (width :pointer))
95
96 (defmethod cell-get-position ((tree-view-column tree-view-column)
97 (cell-renderer cell-renderer))
98 (with-foreign-outs-list
99 ((start-pos :int) (width :int)) :if-success
100 (gtk-tree-view-column-cell-get-position tree-view-column
101 cell-renderer start-pos width)))
102
103
104 (defmethod get-cell-at ((tree-view-column tree-view-column) x)
105 (loop :for cell in (cells tree-view-column)
106 :when (destructuring-bind (start-pos width)
107 (cell-get-position tree-view-column cell)
108 (and (>= x start-pos) (>= (+ start-pos width) x)))
109 :return cell))
110
111 (init-slots tree-view-column (cell attributes)
112 (when cell
113 (pack tree-view-column cell)
114 (iter
115 (for (key value) on attributes by #'cddr)
116 (add-attribute tree-view-column cell key value))))

  ViewVC Help
Powered by ViewVC 1.1.5