Re: Hide badge of NSDraggingSession

2019-07-25 Thread じょいすじょん via Cocoa-dev


> On Jul 26, 2019, at 10:50, Dragan Milić via Cocoa-dev 
>  wrote:
> 
>> pet 26.07.2019., at 03.08, Rob Petrovec wrote:
>> 
>> I would not recommend using those deprecated API.  They are not long for 
>> this world.  With that said, I don’t have a better solution.
> 
> Yeah, I’d like ti avoid using that too.
> 
> 
>> pet 26.07.2019., at 03.30, Steve Mills via Cocoa-dev wrote:
>> 
>> Yeah, hard to say how much longer they'll be available. You could always add 
>> a single item using a custom NSPasteboardWriting class and supply your own 
>> image. It would hold the multiple items and write them.
> 
> The thing is, in that dragging session I have to supply a list of URLs, so 
> that other applications expecting URLs (like Finder, for example) would 
> accept them. As a matter of fact, speaking about specifics, what I really 
> want is to do is drag a couple of URLs into System Preferences’ “Full Disk 
> Access” list, and that one accepts only lists of URLs, as far as I know.
> 
> Now, I want it to look like a user is only dragging an icon of my application 
> (which he/she really does), but application’s privileged helper needs to be 
> added into “Full Disk Access” too. I don’t want user to see that (and 
> potentially get confused), so my intention is to show just application’s icon 
> during the drag. That works okay (the second dragging items has no content), 
> but since I actually have two dragging items, the count badge appears, and 
> that doesn’t look very nice.
> 
> Speaking of above mentioned deprecated method, I tried to use it and write 
> URLs to the dragging pasteboard using -[NSPasteboard writeObjects:]. That 
> worked well and looked exactly as I wanted on Mojave, but on Catalina it 
> throws exception for “there are two dragging items but only one dragging 
> image, there should be one image per item”.
> 
> Finally, I know of application which does exactly the same as I described and 
> want. The session contained three dragging items, but the badge was hidden. 
> So I thought there could be something obvious I may be missing. Now it seems 
> to me that only can be done through private API calls and/ore other hackery.
> 
> Cheers,
> -- Dragan
You want to look at the hairy block property of NSDraggingItem.h

@property (nullable, copy) NSArray * __nonnull 
(^imageComponentsProvider)(void);

It's been years ago now, but Raleigh Ledet did a WWDC presentation on Drag 
Flocking.
See
https://developer.apple.com/videos/play/wwdc2011/115/

It's one of the most intensely valuable videos for understanding scrolling, 
swiping and dragging in macOS. Still very very very valuable video.
It's a dense presentation, but if you *can* do this, this is where you will 
find out how.


___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Steve Mills via Cocoa-dev
On Jul 25, 2019, at 20:50:18, Dragan Milić via Cocoa-dev 
 wrote:
> 
> The thing is, in that dragging session I have to supply a list of URLs, so 
> that other applications expecting URLs (like Finder, for example) would 
> accept them. As a matter of fact, speaking about specifics, what I really 
> want is to do is drag a couple of URLs into System Preferences’ “Full Disk 
> Access” list, and that one accepts only lists of URLs, as far as I know.
> 
> Now, I want it to look like a user is only dragging an icon of my application 
> (which he/she really does), but application’s privileged helper needs to be 
> added into “Full Disk Access” too. I don’t want user to see that (and 
> potentially get confused), so my intention is to show just application’s icon 
> during the drag. That works okay (the second dragging items has no content), 
> but since I actually have two dragging items, the count badge appears, and 
> that doesn’t look very nice.

According to documentation, it's up to the drop location to decide how many 
items it will accept and change the numberOfValidItemsForDrop property on the 
NSDraggingInfo, like if one item is a jpg file and the other is a text file, 
but it only wants images, so it sets it to 1, but then if the mouse moves over 
some other app or destination that wants all files, it would change back to 2.

--
Steve Mills
Drummer, Mac geek

___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread じょいすじょん via Cocoa-dev


> On Jul 26, 2019, at 12:19, Steve Mills via Cocoa-dev 
>  wrote:
> 
> On Jul 25, 2019, at 20:50:18, Dragan Milić via Cocoa-dev 
>  wrote:
>> 
>> The thing is, in that dragging session I have to supply a list of URLs, so 
>> that other applications expecting URLs (like Finder, for example) would 
>> accept them. As a matter of fact, speaking about specifics, what I really 
>> want is to do is drag a couple of URLs into System Preferences’ “Full Disk 
>> Access” list, and that one accepts only lists of URLs, as far as I know.
>> 
>> Now, I want it to look like a user is only dragging an icon of my 
>> application (which he/she really does), but application’s privileged helper 
>> needs to be added into “Full Disk Access” too. I don’t want user to see that 
>> (and potentially get confused), so my intention is to show just 
>> application’s icon during the drag. That works okay (the second dragging 
>> items has no content), but since I actually have two dragging items, the 
>> count badge appears, and that doesn’t look very nice.
> 
> According to documentation, it's up to the drop location to decide how many 
> items it will accept and change the numberOfValidItemsForDrop property on the 
> NSDraggingInfo, like if one item is a jpg file and the other is a text file, 
> but it only wants images, so it sets it to 1, but then if the mouse moves 
> over some other app or destination that wants all files, it would change back 
> to 2.
> 
> --
> Steve Mills
> Drummer, Mac geek

I wonder if it could work if the content types are carefully crafted to be all 
one kind.
___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Dragan Milić via Cocoa-dev
> pet 26.07.2019., at 03.08, Rob Petrovec wrote:
> 
> I would not recommend using those deprecated API.  They are not long for this 
> world.  With that said, I don’t have a better solution.

Yeah, I’d like ti avoid using that too.


> pet 26.07.2019., at 03.30, Steve Mills via Cocoa-dev wrote:
> 
> Yeah, hard to say how much longer they'll be available. You could always add 
> a single item using a custom NSPasteboardWriting class and supply your own 
> image. It would hold the multiple items and write them.

The thing is, in that dragging session I have to supply a list of URLs, so that 
other applications expecting URLs (like Finder, for example) would accept them. 
As a matter of fact, speaking about specifics, what I really want is to do is 
drag a couple of URLs into System Preferences’ “Full Disk Access” list, and 
that one accepts only lists of URLs, as far as I know.

Now, I want it to look like a user is only dragging an icon of my application 
(which he/she really does), but application’s privileged helper needs to be 
added into “Full Disk Access” too. I don’t want user to see that (and 
potentially get confused), so my intention is to show just application’s icon 
during the drag. That works okay (the second dragging items has no content), 
but since I actually have two dragging items, the count badge appears, and that 
doesn’t look very nice.

Speaking of above mentioned deprecated method, I tried to use it and write URLs 
to the dragging pasteboard using -[NSPasteboard writeObjects:]. That worked 
well and looked exactly as I wanted on Mojave, but on Catalina it throws 
exception for “there are two dragging items but only one dragging image, there 
should be one image per item”.

Finally, I know of application which does exactly the same as I described and 
want. The session contained three dragging items, but the badge was hidden. So 
I thought there could be something obvious I may be missing. Now it seems to me 
that only can be done through private API calls and/ore other hackery.

Cheers,
-- Dragan
___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Steve Mills via Cocoa-dev
On Jul 25, 2019, at 20:08:40, Rob Petrovec via Cocoa-dev 
 wrote:
> 
> I would not recommend using those deprecated API.  They are not long for this 
> world.  With that said, I don’t have a better solution.

Yeah, hard to say how much longer they'll be available. You could always add a 
single item using a custom NSPasteboardWriting class and supply your own image. 
It would hold the multiple items and write them.

--
Steve Mills
Drummer, Mac geek

___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Rob Petrovec via Cocoa-dev
I would not recommend using those deprecated API.  They are not long for this 
world.  With that said, I don’t have a better solution.

—Rob


> On Jul 25, 2019, at 7:03 PM, Dragan Milić via Cocoa-dev 
>  wrote:
> 
>> On pet 26.10.2019,. at 02.37, Steve Mills via Cocoa-dev wrote:
>> 
>> Use the single image methods instead of adding multiple items.
> 
> Do you think of deprecated (as of Lion) one:
> 
> -[NSView dragImage:at:offset:event:pasteboard:source:slideBack:] ??
> 
> -- Dragan
> ___
> 
> 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/petrock%40mac.com
> 
> This email sent to petr...@mac.com

___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Dragan Milić via Cocoa-dev
> On pet 26.10.2019,. at 02.37, Steve Mills via Cocoa-dev wrote:
> 
> Use the single image methods instead of adding multiple items.

Do you think of deprecated (as of Lion) one:

-[NSView dragImage:at:offset:event:pasteboard:source:slideBack:] ??

-- Dragan
___

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


Re: Hide badge of NSDraggingSession

2019-07-25 Thread Steve Mills via Cocoa-dev
> On Jul 25, 2019, at 19:12, Dragan Milić via Cocoa-dev 
>  wrote:
> 
> Hi everyone,
> 
> Here's a very straightforward question: starting a dragging session with
> 
> -[NSDraggingSession beginDraggingSessionWithItems:event:source:]  
> 
> and having multiple dragging items automatically adds a badge, showing items 
> count, to the composited dragging image. Is there any public way to hide/not 
> show that badge? For certain reasons, even though a user can drag multiple 
> items of certain type in my application, I want just a simple image without a 
> badge displayed.

Use the single image methods instead of adding multiple items.

Steve via iPad


___

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


Hide badge of NSDraggingSession

2019-07-25 Thread Dragan Milić via Cocoa-dev
Hi everyone,

Here's a very straightforward question: starting a dragging session with

-[NSDraggingSession beginDraggingSessionWithItems:event:source:]  
 
and having multiple dragging items automatically adds a badge, showing items 
count, to the composited dragging image. Is there any public way to hide/not 
show that badge? For certain reasons, even though a user can drag multiple 
items of certain type in my application, I want just a simple image without a 
badge displayed.
 
I may be missing something obvious in the documentation and if so, please 
provide a reference where I can find it.
 
Thanks in advance
-- Dragan
___

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