[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check-box and radio-button part colors



At 4:42 AM 2/1/95, Tobias Kunze wrote:

>I need to implement windows which have a light-gray upper
>(dialog-like) pane and a white lower (editor-like) pane--very much 
>
>like Apple's Script Editor and Mailer applications.  The light-gray
>panesthus have generally controls in it like radio buttons and
>checkboxes, whose :body color should be always light-gray, too.
>
>Following your suggestion, I tried to set the :content color of their enclosing
>to ccl:*light-gray-color*, which works fine for the buttons.  However, I can
>do so only for the WHOLE window.  Defining a new
>"white-view" class with a :before method to 
>
>view-draw-contents that (re)paints the view in white 
>
>doesn't help, because  it paints IN BLACK on b/w screens  :(  
>
>
>I need a GENERAL color handling mechanism which works on ANY
>screen combination, even if one part of a view is on a b/w
>screen and another on a color screen. I thought that picking a
>color value over 32768 would result in a white color on b/w
>screens, but apparently i was wrong on that point!

Use *white-color*. You need a value close to 255 for all three
of red, green, & bluw.

>
>Any hints or even solutions greatly appreciated! 

The following code generates for me a window whose top half is black
and whose bottom half is white on a black & white screen. If
you don't give a true value for the window's :color-p initarg,
the whole screen is white, since it is color QuickDraw that
handles the set-part-color settings.

---------------------------------------------------------------

; white-view.lisp

(defclass white-view (view)
  ())

(defmethod view-draw-contents :before ((view white-view))
  (rlet ((rect :rect
               :topleft #@(0 0)
               :botright (view-size view)))
    (with-fore-color *white-color*
      (#_PaintRect rect))))

(let ((w (make-instance 'window
           :color-p t
           :window-show nil
           :view-size #@(100 200)
           :view-subviews (list (make-instance 'white-view
                                  :view-position #@(0 100)
                                  :view-size #@(100 100))))))
  (set-part-color w :content *black-color*)
  (window-select w))