• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Building a view transparent to dragging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building a view transparent to dragging


  • Subject: Re: Building a view transparent to dragging
  • From: Stephane Sudre <email@hidden>
  • Date: Mon, 24 Oct 2005 13:26:40 +0200


On 24 oct. 05, at 13:08, Jerome Foucher wrote:

Le 24 oct. 05 à 13:00, Stephane Sudre a écrit :


On 24 oct. 05, at 09:00, Jerome Foucher wrote:


Hi list,

I'd like to build a custom subclass of NSImageView that is transparent to dragging.

My custom view is used to draw borders around an NSImageView. It's positionnned on top of the image in the view hierarchy, and draws a PNG with alpha mask to draw the border.

The image view behind the custom view supports drag&drop, so the user can drag an image file from the Finder and drop it into the image frame.
However, the custom border view intercepts all drags....


For various reasons, I'd like to avoid having to build a class that draws the border AND the image itself.

Does anybody have a solution ?


Why not just putting the NSImageView inside the custom view?

I'd like to avoid this solution as it would require me to rewrite lots of classes to be compatible with this new embedded structures.
If possible I'd like to find out how to render the custom-view transparent to dragging as this wouldn't break the existing logic.

If the view is above the other, you have something like this in the view hierarchy:


+-------------+
|  Superview  |
+-------------+
      |
+-------------+       +-------------+
| NSImageView | ----- |  CustomView |
+-------------+       +-------------+

While drawing is made from top to bottom (and left to right), clicking and dragging support works from right to keft (and bottom to top). (At least, this is how it's usually working).

This system along with the proper drawing and clicking algorithm allows overlapping and what you're looking for.

But since AppKit does not _always_ support Overlapping (because of optimizations AFAIK), I guess there's also an optimization to state that:

if the first view whose frame includes the drag location does not support dragging operations (or the pasteboard type), then go to the superview level.

My $0.02 (before tax)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Building a view transparent to dragging (From: Jerome Foucher <email@hidden>)
 >Re: Building a view transparent to dragging (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Building a view transparent to dragging
  • Next by Date: Re: Killing a daemon process
  • Previous by thread: Re: Building a view transparent to dragging
  • Next by thread: Re: Building a view transparent to dragging
  • Index(es):
    • Date
    • Thread