On Sep 13, 2012, at 12:40 PM, Chris Markle <cmar...@asperasoft.com> wrote:
> I saw an app called Dragster that > allows you to drag a file over the dock icon for the app, at which > point a menu of rows opens up form the app icon, and you can continue > to drag the file over a particular row. I think they are using some dark-gray magic to do that kind of thing; see below. It’s not at all straightforward. This isn’t something that sounds reasonable for a newbie programming task. > 1. Using the openFile: and openFiles: NSApplication delegates to let > me handle dragging a file over the icon and handling that. That’s not going to give you control until the user releases the mouse. > 2. Modifying the dock menu to add items and separators to the dock > menu (at least simple cases). But what I notice here is that this menu > if presented on a two-fingered click of the doc icon, not presented > when I drag the file over the dock icon. Right. Dragster definitely isn’t using a normal dock menu — this must be a custom window that they open and do mouse-tracking in. I don’t know how they detect that the mouse is over the dock tile, or even how they figure out the on-screen coordinates of the tile. There isn’t any straightforward way to do either. (NSDockTile only lets you customize the appearance of the tile; it doesn’t support any special event handling.) My suspicion is that they are using a private API that lets the app run a real live NSView in the dock tile. With that it would be pretty easy to build that sort of UI. I know that this API has existed for a long time, but I don’t know the details (and talking about private APIs on this list is not allowed.) —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com