+
+(defun test-entry-completion ()
+ "Not working example of GtkEntryCompletion"
+ (within-main-loop
+ (let* ((w (make-instance 'gtk-window))
+ (model (make-instance 'tree-lisp-store)))
+ (tree-lisp-store-add-column model "gchararray" #'identity)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Monday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Tuesday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Wednesday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Thursday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Friday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Saturday") 0)
+ (tree-node-insert-at (tree-lisp-store-root model) (make-tree-node :item "Sunday") 0)
+ (let* ((completion (make-instance 'entry-completion :model model :text-column 0))
+ (e (make-instance 'entry :completion completion)))
+ (setf (entry-completion-text-column completion) 0)
+ (container-add w e))
+ (widget-show w))))
+
+(defun demo-all ()
+ (within-main-loop
+ (let* ((window (make-instance 'gtk-window
+ :title "cl-gtk2-gtk demo"
+ :window-position :center
+ :default-width 500
+ :default-height 500))
+ (scrolled (make-instance 'scrolled-window
+ :hscrollbar-policy :automatic
+ :vscrollbar-policy :automatic))
+ (viewport (make-instance 'viewport))
+ (v-box-buttons (make-instance 'v-box))
+ (v-box-top (make-instance 'v-box)))
+ (container-add window v-box-top)
+ (box-pack-start v-box-top (make-instance 'label :label "These are the demos of cl-gtk2-gtk:") :expand nil)
+ (box-pack-start v-box-top scrolled)
+ (container-add scrolled viewport)
+ (container-add viewport v-box-buttons)
+ (iter (for s in-package :gtk-demo :external-only t)
+ (for fn = (fdefinition s))
+ (unless fn (next-iteration))
+ (when (eq s 'gtk-demo:demo-all) (next-iteration))
+ (for docstring = (documentation fn t))
+ (for description = (format nil "~A~@[~%~A~]" (string-downcase (symbol-name s)) docstring))
+ (for label = (make-instance 'label :label description :justify :center))
+ (for button = (make-instance 'button))
+ (container-add button label)
+ (connect-signal button "clicked"
+ (let ((fn fn))
+ (lambda (b)
+ (declare (ignore b))
+ (funcall fn))))
+ (box-pack-start v-box-buttons button :expand nil))
+ (widget-show window))))
+
+(defun test-ui-markup ()
+ (within-main-loop
+ (let ((label (make-instance 'label :label "Hello!")))
+ (let-ui (gtk-window :type :toplevel
+ :position :center
+ :title "Hello, world!"
+ :default-width 300
+ :default-height 400
+ :var w
+ (v-box
+ (:expr label) :expand nil
+ (scrolled-window
+ :hscrollbar-policy :automatic
+ :vscrollbar-policy :automatic
+ :shadow-type :etched-in
+ (text-view :var tv))
+ (h-box
+ (label :label "Insert:") :expand nil
+ (entry :var entry)
+ (button :label "gtk-ok" :use-stock t :var btn) :expand nil)
+ :expand nil
+ (label :label "Table packing")
+ :expand nil
+ (table
+ :n-columns 2
+ :n-rows 2
+ (label :label "2 x 1") :left 0 :right 2 :top 0 :bottom 1
+ (label :label "1 x 1") :left 0 :right 1 :top 1 :bottom 2
+ (label :label "1 x 1") :left 1 :right 2 :top 1 :bottom 2)))
+ (connect-signal btn "clicked"
+ (lambda (b)
+ (declare (ignore b))
+ (text-buffer-insert (text-view-buffer tv)
+ (entry-text entry))))
+ (widget-show w)))))