Re: Drag with shadow
Re: Drag with shadow
- Subject: Re: Drag with shadow
- From: jean-michel daix <email@hidden>
- Date: Mon, 13 Aug 2001 10:10:12 +0200
>
On Friday, August 10, 2001, at 06:18 , jean-michel daix wrote:
>
>
>> My question today is about draging a picture. To give you an example, just
>
>> like when you drag a card in a solitaire card game. I know how to move my
>
>> picture, but I want a shadow under it.
>
>>
>
>> What do you think is the best way to do this ? Use a picture with an alpha
>
>> channel for the shadow and draw my image on top ? Use a windows with my
>
>> picture in it and use the shadow drawn by aqua ? A better way ? (may be
>
>> something for this exist in aqua)
>
>
> You could create a borderless window with a frame and do all the dragging
>
> for yourself (even with alpha!). However you won't be able to drag into a
>
> foreign app.
>
>
>
> andy
>
> --
>
> Discussion forthcoming.
>
>
Solution could be to copy the card (png with aplha channel) to an irregular
>
shaped window during dragging (see example on developer.apple.com
>
RoundTransparentWindow) . Using standard procedure to recalculate the shadow of
>
a window on aqua, will display it correctly to the background & with the
>
standard way of shadowing. And of course copy back the card & remove the window
>
when the operation is done.
>
>
Michael
>
Sounds good to me. I don't want to drag into a foreign app, it's just a
solitaire card game in fact, don't need to trade cards with other app :)
But I use this app as a tutorial, so I think I will work with NSView,
NSImageView, drawInRect... to learn drawing in cocoa and to use mouse
events.
Something is confusing me. I use a customView (window sized) where I draw my
card (only one for now) and I use mouseDragged to move it across the
customview. It's good, it's move. The problem is that mouseDragged is in my
customView so it moves my card to the mouse location even if the mouse
isn't in the card.
So I want to use mouseDragged in my card and not in my customView. I'm
confused because it's my card which have to handle the mouseDragged event
and it's my customView which have to draw my card. A solution ?
Should I handle all the rect position of my card in the customView and test
if the mouse is in before dragging the card ? Is there a better way to let
each card handle itself ?
-----------------------------------
jean-michel daix / email@hidden
Sorry, I9m French !
visit <
http://www.adforum.com>