(in-package :clim-user)

(define-application-frame hello ()
  ()
  (:panes
   (main-area :application :display-time nil :height 400 :width 600)
   (interactor :interactor :height 400))
  (:layouts
   (default (vertically ()
	      main-area
	      interactor))))

(define-hello-command (com-foo :name t) ()
  (let (foo)
    (accepting-values (*standard-input* :align-prompts :right)
      (setf foo
	    (list (accept '(float 10.0 400.0)
			  :view '(slider-view
				  :width 400
				  :show-value-p t
				  :orientation :horizontal)
			  :query-identifier 'foo)
		  (accept '(subset foo bar baz quux)
			  :default '(foo baz)
			  :view 'check-box-view
			  :query-identifier 'bar)
		  (accept '(member-alist (("one" . eins)
					  ("two" . zwei)
					  ("three" . drei)
					  ("four" . vier)
					  ("five" . fünf)))
			  :default 'zwei
			  :view '(option-pane-view :width 100)
			  :prompt "Deutsch macht Spaß"
			  :query-identifier 'bar-1)
		  (accept '(subset eins zwei drei vier fünf)
			  :default '(zwei)
			  :view '(list-pane-view :width 100)
			  :prompt "Numbers")
		  (accept 'string :prompt "string"
				  :view '(text-field-view :width 10)
				  :default "Hello there")
		  (accept 'boolean
			  :view 'toggle-button-view :query-identifier 'baz))))
    (format t "RETURNED ~S~%" foo)))

(define-hello-command (com-foo-1 :name t) ()
  (setf (climi::frame-manager-dialog-view
		     (frame-manager *application-frame*))
	+gadget-dialog-view+)
  (let (foo)
    (accepting-values (*standard-input* :align-prompts :right)
      (setf foo
	    (list (accept '(float 10.0 400.0)
			  :query-identifier 'foo)
		  (accept '(subset foo bar baz quux)
			  :default '(foo baz)
			  :query-identifier 'bar)
		  (accept '(member-alist (("one" . eins)
					  ("two" . zwei)
					  ("three" . drei)
					  ("four" . vier)
					  ("five" . fünf)))
			  :default 'zwei
			  :prompt "Deutsch macht Spaß"
			  :query-identifier 'bar-1)
		  (accept '(subset eins zwei drei vier fünf)
			  :default '(zwei)
			  :prompt "Numbers")
		  (accept 'string :prompt "string"
				  :default "Hello there")
		  (accept 'boolean
			  :query-identifier 'baz))))
    (format t "RETURNED ~S~%" foo)))

(defun run-hello ()
  (run-frame-top-level (make-application-frame 'hello)))