[comp.sys.mac] Desktop Drawing

jv0l#@andrew.cmu.edu.UUCP (02/20/87)

CC:

I am writing a BBS-type of program which relies heavily upon moving
files and messages from one place to another, deleting them, etc.
I would like to draw the Icons of the disks and b-boards and of
course the trash and maybe a printer on the desktop.

However, IM doesn't help!  The best I can do is getWMgrPort to get
the entire screen, then clipAbove to remove the windows on the desk-
top.  I can then draw what I want onto the desktop.  Also, I have used
the deskHook for desktop clicks and redrawing under exposure, but what
I would like to know is this:  is there a better way?

I realize that this is probably counter to every guideline ever put
out by Apple, but if the Finder does it, I should be able to do it too.
I have tried to use MacNosy on the Finder, but have you ever tried to
understand a 56K AL file with labels like proc54, and global102(a5)?

The only alternative that I could think of is to make a window with a
gray background pattern and make it the ghost window (so frontWindow
won't act strange).

Thanks in advance

Justin

jv0l@andrew.cmu.edu
US Mail: I'll probably be done with my 4 years here by the time any
         Snail Mail gets here...

lsr@apple.UUCP (02/23/87)

In article <gUD1pjy00UsIk=004v@andrew.cmu.edu> jv0l#@andrew.cmu.edu (Justin Chris Vallon) writes:
>I am writing a BBS-type of program which relies heavily upon moving
>files and messages from one place to another, deleting them, etc.
>I would like to draw the Icons of the disks and b-boards and of
>course the trash and maybe a printer on the desktop.
>
>The only alternative that I could think of is to make a window with a
>gray background pattern and make it the ghost window (so frontWindow
>won't act strange).
>
>

This is the best thing to do.  It avoids the problems of handling the
clipping and mouse events, since these can be handled just like any other
window.  (You probably don't have to make it the ghost window for this to
work; you just have to special case the window and never bring it to the
front.)

Also, consider running your program under Servant.  If you draw on the
desktop, I think you will conflict with Servant.  By using the window you
will at least cover up the Servant icons when you are active, and you can
probably arrange to hide your icons when Servant's are active.

As far as the user interface goes, there is a problem of confusing your
users by presenting an interface that looks the same as the Finder but
doesn't work the same way.  For example, if your icons can't be moved then
people might be confused and frustrated.

-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET

tomc@mntgfx.MENTOR.COM (Tom Carstensen) (09/15/87)

I wish to implement something functionally like the icons
on the Finders desktop, and I am currently doing it this
way:

    - traversing the list of windows, subtracting each visible
      window's rectangle from the icon rectangles region
      
    - Use this new region as the clip region
    
    - and then drawing the icon on the desk port.

and I do this for each icon.

Does anybody know of a better way to implement such functionality?

:------------------------------------------------------------:
: Tom Carstensen              Usenet: tomc@mntgfx.MENTOR.COM :
: Mentor Graphics             GEnie:                         :
:------------------------------------------------------------:

oster@dewey.soe.berkeley.edu (David Phillip Oster) (09/16/87)

In article <917@mntgfx.MENTOR.COM> tomc@mntgfx.MENTOR.COM (Tom Carstensen) writes:
>I wish to implement something functionally like the icons
>on the Finders desktop, and I am currently doing it this
>way:
>    - traversing the list of windows, subtracting each visible
>      window's rectangle from the icon rectangles region
>    - Use this new region as the clip region
>    - and then drawing the icon on the desk port.

This is strongly discouraged if you expect to be compatible with
multi-finder. Under multi-finder, the way you are supposed to do this
is: 

1.) write a custom window definition procedure that takes an ICN#
as argument and builds an ICN# shaped window. 

2.) create a separate window for each ICN#.  

Note: this makes it easy to implement something like the mailbox icon
on many systems: a background task that looks one way when you have no
mail, a different way for unread mail, and a third way for read mail
still in the mailbox, and flashes when new mail is delivered.

On your previous query, "can you tell a window's location by looking
at its portbits". Have you considered what happens on a MacII, which
supports multiple displays? 

--- David Phillip Oster            --My Good News: "I'm a perfectionist."
Arpa: oster@dewey.soe.berkeley.edu --My Bad News: "I don't charge by the hour."
Uucp: {seismo,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu