#:test-scale-button
#:test-text-view
#:demo-code-editor
- #:test-treeview-list))
+ #:test-treeview-list
+ #:test-combobox))
(in-package :gtk-demo)
(print (tree-view-column-tree-view column))
(print (tree-view-column-cell-renderers column)))
(gtk-widget-show-all window)
+ (gtk-main)))
+
+(defun test-combobox ()
+ (let* ((window (make-instance 'gtk-window :type :toplevel :title "Treeview (list)"))
+ (model (make-instance 'array-list-store))
+ (combobox (make-instance 'combo-box :model model))
+ (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))
+ (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)))))
+ (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)
+ (container-add v-box combobox)
+ (let ((renderer (make-instance 'cell-renderer-text :xalign 0.0)))
+ (cell-layout-pack-start combobox renderer)
+ (cell-layout-add-attribute combobox renderer "text" 0))
+ (let ((renderer (make-instance 'cell-renderer-text :xalign 1.0)))
+ (cell-layout-pack-start combobox renderer)
+ (cell-layout-add-attribute combobox renderer "text" 1))
+ (gtk-widget-show-all window)
(gtk-main)))
\ No newline at end of file