CLIM mail archive


Clim FAQ, archives and MCL questions

    Date: Mon, 21 Oct 1991 05:14 EDT

    4) how can I easily use icons in CLIM.  I read the pattern/design stuff but 
    it is not as high a level as could be required by "elegance"...  I'm sure 
    future versions will support it more completely, but for the moment, I'd 
    like to get icons from mac files (resources) and display them as 
    presentations (I'd like to view the icon as the external representation of 
    an internal lisp object).

Patterns and designs are about as high level as you can get without
sacrificing portability.  The way to get an icon from a Mac resource
and then display it is to write a little code that grabs the resource,
and then makes a pattern from it.  You may want to contribute such code
to the as-yet non-existent "CLIM library".

After that, the following code should suffice to draw a pattern.  (There
should be a DRAW-ICON already in CLIM, but it may or may work in what
you have.)

(in-package :clim)
(defun draw-pattern* (sheet pattern x y &key clipping-region transformation)
  (check-type pattern pattern)
  (let ((width (pattern-width pattern))
        (height (pattern-height pattern)))
    (if (or clipping-region transformation)
        (with-drawing-options (sheet :clipping-region clipping-region
                                     :transformation transformation)
          (draw-rectangle* sheet x y (+ x width) (+ y height)
                           :filled t :ink pattern))
        (draw-rectangle* sheet x y (+ x width) (+ y height)
                         :filled t :ink pattern))))

    5) how can I change the displayed font (not family or style), even if this 
    lowers portability ?

I don't understand why it is the wrong thing to simply use a different
text style.  Are you saying that you want to get a "physical" font that
has no text style mapping?  If that is the case, perhaps someone at ILA
can tell you how to add a new text-style->font mapping for the Mac.


Main Index | Thread Index