Changeset main,31 for main/output.lisp


Ignore:
Timestamp:
11/05/2007 08:06:48 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui-new
revision id:
dsowen@fugue88.ws-20071105200648-7juihmioe0ruvmln
Message:

A window's background is now SETF-able.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/output.lisp

    r28 r31  
    11(defpackage #:tui-output
    22  (:use #:cl #:cffi #:tui-cursor #:tui-window)
    3   (:export #:add-string #:move-and-add-string #:add-clipped-string))
     3  (:export #:background #:add-string #:move-and-add-string
     4           #:add-clipped-string))
    45
    56(in-package #:tui-output)
     
    1314  (attr chtype)
    1415  (char wchar :count 5))
     16
     17
     18
     19(defcfun "wgetbkgrnd" :int
     20  (window :pointer)
     21  (wch :pointer))
     22
     23(defcfun "wbkgrnd" :void
     24  (window :pointer)
     25  (wch :pointer))
     26
     27;;(defgeneric background (window))
     28
     29(defgeneric (setf background) (pair window)
     30  (:method (pair (window window))
     31    (destructuring-bind (ch color) pair
     32      (with-foreign-object (wch 'cchar_t)
     33        (with-foreign-slots ((attr char) wch cchar_t)
     34          (dotimes (i 5)
     35            (setf (mem-aref char 'wchar i) 0))
     36          (setf attr (cdk::color-pair color)
     37                (mem-aref char 'wchar) (char-code ch)))
     38        (wbkgrnd (window-pointer window) wch)))))
    1539
    1640
     
    3458
    3559(defun add-clipped-string (window y x s)
     60  ;; TODO: double check for ob1 in OVER.
    3661  (multiple-value-bind (maxy maxx) (size window)
    3762    (unless (<= 0 y maxy) (return-from add-clipped-string))
     
    103128          (clear-complex-char cc)
    104129          (set-complex-char cc (aref s i))))
    105       (wadd-wchnstr window a n))))
     130      (wadd-wchnstr (window-pointer window) a n))))
    106131
    107132
     
    122147  (bl chtype)
    123148  (br chtype))
    124 
    125 (defcfun ("wbkgd" c-set-window-background) :int
    126   (window :pointer)
    127   (ch chtype))
    128 
    129 (defcfun "wbkgrnd" :int
    130   (window :pointer)
    131   (wch :pointer))
Note: See TracChangeset for help on using the changeset viewer.