Changeset main,87
- Timestamp:
- 02/23/2008 12:27:43 AM (18 years ago)
- branch-nick:
- tui
- revision id:
- dsowen@fugue88.ws-20080223002743-09u28trz6kvjtdpo
- Location:
- main
- Files:
-
- 4 edited
-
form.lisp (modified) (5 diffs)
-
widget/checkbox.lisp (modified) (6 diffs)
-
widget/db-checkbox.lisp (modified) (1 diff)
-
widget/package.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
main/form.lisp
r80 r87 41 41 (precision :initarg :precision) 42 42 (inactive-background :initarg :inactive-background) 43 (active-background :initarg :active-background))) 44 45 (defclass checkbox-def (value-widget-def) 46 ((inactive-background :initarg :inactive-background) 43 47 (active-background :initarg :active-background))) 44 48 … … 83 87 :active-background (list ,@active-background))) 84 88 89 (defun make-checkbox-def (row column name &key read-only 90 (inactive-background 91 *default-inactive-widget-background*) 92 (active-background 93 *default-active-widget-background*)) 94 `(make-instance 'checkbox-def 95 :row ,row :column ,column :name ,name :read-only ,read-only 96 :inactive-background (list ,@inactive-background) 97 :active-background (list ,@active-background))) 98 85 99 (defun parse-widget-form (widget-form) 86 100 (destructuring-bind (type &rest args) widget-form … … 88 102 (:label 'make-label-def) 89 103 (:textbox 'make-textbox-def) 90 (:numberbox 'make-numberbox-def)) 104 (:numberbox 'make-numberbox-def) 105 (:checkbox 'make-checkbox-def)) 91 106 args))) 92 107 … … 97 112 * (:label row column text) 98 113 * (:textbox row column name display-width &key data-width read-only) 99 * (:numberbox row column name display-width &key data-width precision read-only)" 114 * (:numberbox row column name display-width &key data-width precision read-only) 115 * (:checkbox row column name)" 100 116 (destructuring-bind (&key ((:inactive-widget-background *default-inactive-widget-background*) '(#\Nul 0)) 101 117 ((:active-widget-background *default-active-widget-background*) '(#\Nul 0))) … … 146 162 :validator validator 147 163 :inactive-background inactive-background 148 :active-background active-background)))))) 164 :active-background active-background))))) 165 (:method ((cbd checkbox-def) form) 166 (with-slots (row column name inactive-background active-background) cbd 167 (with-slots (data window scroll) form 168 (let ((r (make-reflector data name))) 169 (create-widget 'db-checkbox window (- row scroll) column 170 :data r 171 :inactive-background inactive-background 172 :active-background active-background)))))) 149 173 150 174 -
main/widget/checkbox.lisp
r84 r87 26 26 (cue-window :initarg :cue-window) 27 27 (data-window :initarg :data-window) 28 (active :type boolean :initform nil )))28 (active :type boolean :initform nil :accessor active))) 29 29 30 30 … … 37 37 (setf (background data-window) 38 38 (if active active-background inactive-background)) 39 (add-clipped-string data-window 0 0 (if (checked cb) "X" " "))39 (add-clipped-string data-window 0 0 (if (checked cb) "X" "-")) 40 40 (setf (cursor-position data-window) '(0 0)) 41 41 (refresh cue-window))) … … 46 46 (when listener 47 47 (funcall listener)))) 48 49 (defmethod (setf active) :after (flag (cb checkbox)) 50 (draw cb)) 48 51 49 52 … … 68 71 (defmethod activate ((cb checkbox) &key (key-callback 'nothing) 69 72 &allow-other-keys) 70 (with-slots (data-window active) cb71 (with-accessors (( checked checked)) cb72 (set-cursor-visible t)73 (with-slots (data-window) cb 74 (with-accessors ((active active) (checked checked)) cb 75 #|(set-cursor-visible t)|# 73 76 (setf active t) 74 77 (unwind-protect … … 78 81 (let ((key (read-key data-window))) 79 82 (case key 83 ((#\x #\X) 84 (setf checked t)) 85 (#\- 86 (setf checked nil)) 80 87 (#\Space 81 88 (setf checked (not checked))) … … 85 92 (return r)))))))) 86 93 (setf active nil) 87 (set-cursor-visible nil)))))94 #|(set-cursor-visible nil)|#)))) -
main/widget/db-checkbox.lisp
r84 r87 32 32 &key data &allow-other-keys) 33 33 (assert data (data) "DATA must be specified.") 34 (loop until (remf args :data)) 34 35 (let ((inst (apply 'create-widget 'checkbox parent y x args))) 35 (change-class inst 'db-checkbox :data data))) 36 (change-class inst 'db-checkbox :data data) 37 (draw inst) 38 inst)) -
main/widget/package.lisp
r84 r87 1 1 (defpackage #:tui-widget 2 (:use #:cl #:tui-widget-generic #:tui-widget- label #:tui-widget-textbox3 #:tui-widget- numberbox)2 (:use #:cl #:tui-widget-generic #:tui-widget-db-checkbox #:tui-widget-label 3 #:tui-widget-textbox #:tui-widget-numberbox) 4 4 (:export #:text #:widget #:scroll #:insertion-point #:create-widget #:destroy 5 5 #:activate
Note: See TracChangeset
for help on using the changeset viewer.
