(gtk-widget-show-all window)
(gtk-main)))
-(defun test-treeview-list ()
- (let* ((window (make-instance 'gtk-window :type :toplevel :title "Treeview (list)"))
- (model (make-instance 'array-list-store))
- (scroll (make-instance 'scrolled-window :hscrollbar-policy :automatic :vscrollbar-policy :automatic))
- (tv (make-instance 'tree-view :headers-visible t :width-request 100 :height-request 400 :rules-hint t))
- (h-box (make-instance 'h-box))
- (v-box (make-instance 'v-box))
- (title-entry (make-instance 'entry))
- (value-entry (make-instance 'entry))
- (button (make-instance 'button :label "Add")))
- (store-add-column model "gchararray" #'tvi-title)
- (store-add-column model "gint" #'tvi-value)
- (store-add-item model (make-tvi :title "Monday" :value 1))
- (store-add-item model (make-tvi :title "Tuesday" :value 2))
- (store-add-item model (make-tvi :title "Wednesday" :value 3))
- (store-add-item model (make-tvi :title "Thursday" :value 4))
- (store-add-item model (make-tvi :title "Friday" :value 5))
- (store-add-item model (make-tvi :title "Saturday" :value 6))
- (store-add-item model (make-tvi :title "Sunday" :value 7))
- (setf (tree-view-model tv) model (tree-view-tooltip-column tv) 0)
- (gobject:g-signal-connect window "destroy" (lambda (w) (gobject:release w) (gtk-main-quit)))
- (gobject:g-signal-connect button "clicked" (lambda (b) (gobject:release b)
- (store-add-item model (make-tvi :title (entry-text title-entry)
- :value (or (parse-integer (entry-text value-entry)
- :junk-allowed t)
- 0)))))
- (g-signal-connect tv "row-activated" (lambda (tv path column)
- (release* tv path column)
- (format t "You clicked on row ~A~%" (tree-path-indices path))))
- (container-add window v-box)
- (box-pack-start v-box h-box :expand nil)
- (box-pack-start h-box title-entry :expand nil)
- (box-pack-start h-box value-entry :expand nil)
- (box-pack-start h-box button :expand nil)
- (box-pack-start v-box scroll)
- (container-add scroll tv)
- (let ((column (make-instance 'tree-view-column :title "Title" :sort-column-id 0))
- (renderer (make-instance 'cell-renderer-text :text "A text")))
- (tree-view-column-pack-start column renderer)
- (tree-view-column-add-attribute column renderer "text" 0)
- (tree-view-append-column tv column)
- (print (tree-view-column-tree-view column))
- (print (tree-view-column-cell-renderers column)))
- (let ((column (make-instance 'tree-view-column :title "Value"))
- (renderer (make-instance 'cell-renderer-text :text "A text")))
- (tree-view-column-pack-start column renderer)
- (tree-view-column-add-attribute column renderer "text" 1)
- (tree-view-append-column tv column)
- (print (tree-view-column-tree-view column))
- (print (tree-view-column-cell-renderers column)))
- (gtk-widget-show-all window)
- (gtk-main)))
-
(defun test-combo-box ()
(let* ((window (make-instance 'gtk-window :type :toplevel :title "Treeview (list)"))
(model (make-instance 'array-list-store))