Update of /project/pal/cvsroot/pal-gui/examples In directory clnet:/tmp/cvs-serv5882/examples
Modified Files: files.lisp packing.lisp test.lisp Log Message: Finished the CHOICE-WIDGET.
--- /project/pal/cvsroot/pal-gui/examples/files.lisp 2007/10/29 20:06:01 1.1 +++ /project/pal/cvsroot/pal-gui/examples/files.lisp 2007/10/29 21:09:20 1.2 @@ -1,15 +1,14 @@ - (in-package :pal-gui)
-(defclass file-list (v-box) +(defclass file-widget (v-box) ((list-widget :accessor list-widget-of) (text-widget :accessor text-widget-of) (select :accessor select-of)) (:default-initargs :gap 2))
-(defmethod initialize-instance :after ((g file-list) &key &allow-other-keys) +(defmethod initialize-instance :after ((g file-widget) &key &allow-other-keys) (setf (list-widget-of g) (make-instance 'list-widget :parent g :on-select (lambda (lg) (setf (text-of (text-widget-of g)) (selected-of lg))))) @@ -18,7 +17,7 @@ (setf (select-of g) (make-instance 'button :x-expand-p nil :width (get-m) :value :box :parent hbox))) (update-view g))
-(defmethod update-view ((g file-list)) +(defmethod update-view ((g file-widget)) (setf (items-of (list-widget-of g)) (mapcar (lambda (f) (if (pathname-name f) (pathname-name f) @@ -30,7 +29,7 @@ (with-gui () (let* ((window (make-instance 'window :pos (v 200 200) :width 300 :height 200))
- (hbox (make-instance 'file-list :parent window :label "Choose"))) + (hbox (make-instance 'file-widget :parent window :label "Choose")))
(gui-loop () (clear-screen 150 150 150))))) --- /project/pal/cvsroot/pal-gui/examples/packing.lisp 2007/10/29 20:06:01 1.1 +++ /project/pal/cvsroot/pal-gui/examples/packing.lisp 2007/10/29 21:09:20 1.2 @@ -1,6 +1,6 @@ - -(in-package :pal-gui) - +(defpackage :test + (:use :cl :pal :pal-gui)) +(in-package :test)
(defun test () @@ -53,7 +53,7 @@ (vbox (make-instance 'v-box :label "foo" :parent hbox :width 30 :x-expand-p nil)) (c (make-instance 'button :value "Foo" :parent vbox)))
- (loop repeat 10 do (make-instance 'pin :value "Foo" :b 0 :pos (v (random 800) (random 600)))) + (loop repeat 10 do (make-instance 'pin :value "Foo" :b 0 :pos (v (random 800) (random 600))))
(gui-loop () (clear-screen 50 50 255)))))) --- /project/pal/cvsroot/pal-gui/examples/test.lisp 2007/10/29 20:06:01 1.10 +++ /project/pal/cvsroot/pal-gui/examples/test.lisp 2007/10/29 21:09:20 1.11 @@ -1,8 +1,8 @@ ;; TODO: ;; -;; Exports, window sizing dialogs, menus, tooltips, keyboard control, scrollwheel, fix pal's clipping -;; radio box, check box, joystick, scroll box, paragraph, text box, simple editor, combo box, tree view, gridbox, property list -;; File open/save, directory, yes/no dialogs +;; window sizing, dialogs, menus, tooltips, keyboard control, scrollwheel, fix pal's clipping, constrained mixin, scrolling mixin +;; joystick, scroll box, paragraph, text box, simple editor, combo box, tree view, gridbox, property list +;; File open/save, choose directory, yes/no dialogs
(defpackage :test (:use :cl :pal :pal-gui)) @@ -23,6 +23,7 @@ (bottom-box (make-instance 'v-box :parent window :label "Bar" :y-expand-p nil))
(meter (make-instance 'h-meter :parent right-box :max-value 100 :on-repaint (lambda (g) (setf (value-of g) (get-fps)) nil))) + (multichoice (make-instance 'choice-widget :multip t :parent right-box :items '(Foo Bar Baz))) (rg (make-instance 'h-gauge :parent left-box :min-value 0 :max-value 255 :value 0)) (gg (make-instance 'h-gauge :parent left-box @@ -40,7 +41,7 @@ (button (make-instance 'button :value :circle :parent window-2 :on-select (lambda (g) (setf (items-of list) (remove-if-not 'image-p pal-ffi::*resources*))))) - (choice (make-instance 'choice-widget :label "Foo" :parent window-2 :items '(Foo Bar Baz))) + (choice (make-instance 'choice-widget :label "Foo" :parent window-2 :items '("First" "Second" "and Third"))) (pin (make-instance 'pin :value "Plane" :pos (v 400 300) :a 128)) (text (make-instance 'text-widget :text "Text" :parent bottom-box)))