Changeset main,60


Ignore:
Timestamp:
11/16/2007 09:23:48 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071116212348-g0y85h0so1fralzf
Message:

Created a new mix-in architecture for grids.
Converted the test.

Location:
main
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/grid/package.lisp

    r57 r60  
    11(defpackage #:grid
    22  (:use #:cl #:dso-util #:tui-display-string #:tui-output #:tui-window)
    3   (:export #:rows #:header-rows #:columns #:header-columns #:column-width
    4            #:item #:uses-display-strings #:row-scroll #:column-scroll
    5            #:make-grid #:draw))
     3  (:export
     4
     5   ;; Model
     6   #:rows #:header-rows #:columns #:header-columns #:column-width #:item
     7   #:uses-display-strings
     8
     9   ;; Display
     10   #:row-scroll #:column-scroll #:make-grid #:draw
     11
     12   ;; Extra
     13   #:hash-per-row-grid-data
     14   #:parse-format-specs #:column-formats
     15   #:column-padding #:padding
     16   #:nice-header
     17   #:row-selectable #:selected-row))
  • main/grid/test.lisp

    r57 r60  
    77
    88
    9 (defclass test () ())
     9(defclass test (nice-header row-selectable column-padding column-formats)
     10  ())
    1011
    1112(defmethod rows ((gd test)) 10)
    12 
    13 (defmethod header-rows ((gd test))
    14   1)
    1513
    1614(defmethod columns ((gd test)) 10)
     
    1917  1)
    2018
    21 (defmethod column-width ((gd test) column)
    22   5)
    23 
    2419(defmethod item ((gd test) row column)
    2520  (assert (and (<= 0 row 9)
    2621               (<= 0 column 9)))
    27   (cond
    28     ((= row 0)
    29      (concatenate 'string "`B`U " (string (aref "*ABCDEFGHI" column)) " `u`b"))
    30     ((= column 0)
    31      (format nil " `B~A`b " row))
    32     (t
    33      (format nil (if (= row column 2) "`R~A,~A`r" "~A,~A") row column))))
    34 
    35 (defmethod uses-display-strings ((gd test) row column)
    36   t)
     22  (* (1+ row) (1+ column)))
    3723
    3824
     
    4228  (refresh screen))
    4329
     30(defconstant +format+ (first (parse-format-specs '(:number 3))))
     31(defconstant +formats+ (make-sequence 'vector 10 :initial-element +format+))
     32
    4433(defun test-draw ()
    45   (let ((data (make-instance 'test)))
     34  (let ((data (make-instance 'test
     35                             :format-specs +formats+
     36                             :column-heads #("   *" "   A" "   B" "   C" "   D"
     37                                             "   E" "   F" "   G" "   H"
     38                                             "   I"))))
     39    (setf (selected-row data) 1)
    4640    (with-screen (screen)
    4741      (clear screen)
  • main/tui.asd

    r54 r60  
    4343                                     (:file "hash-data"
    4444                                      :depends-on ("model"))
    45                                      (:file "formatted-data"
     45                                     (:file "nice-header"
     46                                      :depends-on ("model"))
     47                                     (:file "row-selectable"
     48                                      :depends-on ("model"))
     49                                     (:file "column-formats"
     50                                      :depends-on ("model"))
     51                                     (:file "column-padding"
    4652                                      :depends-on ("model"))
    4753                                     (:file "display"
Note: See TracChangeset for help on using the changeset viewer.