Re: How to obtain icon displayed by Finder for a file

2009-01-08 Thread David
I was thinking using NSAttributedString seems like a more general purpose solution because they sound powerful and can be used all over the place. I've used it for HTML which seems like way overkill for this. But I haven't successfully come up with a string that looks correct, whereas I have been

How to obtain icon displayed by Finder for a file

2009-01-07 Thread David
Hello,Is there a way to obtain the icon that finder uses to display for a file system object? Such things as the folder icon for folders, PDF icon for pdfs etc. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Rob Rix
Check out -[NSWorkspace iconForFile:] in the docs. Rob On 7-Jan-09, at 4:42 PM, David wrote: Hello,Is there a way to obtain the icon that finder uses to display for a file system object? Such things as the folder icon for folders, PDF icon for pdfs etc. Thanks

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Peter Ammon
On Jan 7, 2009, at 1:42 PM, David wrote: Hello,Is there a way to obtain the icon that finder uses to display for a file system object? Such things as the folder icon for folders, PDF icon for pdfs etc. You can use -[NSWorkspace iconForFile:] if you want to get a specific file's icon,

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread j o a r
On Jan 7, 2009, at 1:42 PM, David wrote: Hello,Is there a way to obtain the icon that finder uses to display for a file system object? Such things as the folder icon for folders, PDF icon for pdfs etc. See: NSWorkspace j o a r ___

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread David
Great! Thanks for the info. I hoped it was something simple. Next question though... how do I set the icon (image) for a 1st column of an outline view and have it show text as well? I found an example using NSBrowserCell but that doesn't seem to work in an outline view. I can't find any other

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Rob Rix
Either make your own cell class, or use two columns for that. I’d recommend the latter due to simplicity, but it may not give you the look you’re going for. Sincerely, Rob On 7-Jan-09, at 5:36 PM, David wrote: Great! Thanks for the info. I hoped it was something simple. Next question

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Michael Ash
On Wed, Jan 7, 2009 at 7:39 PM, David enki1...@gmail.com wrote: I must complain again. Cocoa does not have a clean well designed object model. It seems haphazard. Someone needed a function here, but not there. Apple doesn't go back and look at making general purpose classes and methods. Some

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Rob Keniger
On 08/01/2009, at 10:39 AM, David wrote: Some of the cell classes seem very specialized. I had assumed that NSTextFieldCell could display an icon. Frequently there are outline views of files which display icons and names, yet there is no simple class which implements this functionality.

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Jelle De Laender
Did you try - (NSImage *)iconForFile:(NSString *)fullPath from NSWorkSpace? CodingMammoth Jelle De Laender i...@codingmammoth.com On 07 Jan 2009, at 22:42, David wrote: Hello,Is there a way to obtain the icon that finder uses to display for a file system object? Such things as the

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Rob Keniger
On 08/01/2009, at 7:49 AM, Jelle De Laender wrote: Did you try - (NSImage *)iconForFile:(NSString *)fullPath from NSWorkSpace? You can also have a look at Matt Gemmel's NSImage+QuickLook class, which produces icons that match the ones the Finder gets from QuickLook:

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread David
Amazingly difficult, but I have it working almost 2 different ways. I created my own ImageAndTextCell class and handle my own drawing based on some code from Dave Blanton. I've also tried the NSAttributedString since that sounded potentially cleaner, more powerful and generally useful. Argh. So I

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Kyle Sluder
On Wed, Jan 7, 2009 at 11:51 PM, David enki1...@gmail.com wrote: Amazingly difficult, but I have it working almost 2 different ways. I created my own ImageAndTextCell class and handle my own drawing based on some code from Dave Blanton. I've also tried the NSAttributedString since that sounded

Re: How to obtain icon displayed by Finder for a file

2009-01-07 Thread Rob Keniger
On 08/01/2009, at 3:16 PM, Kyle Sluder wrote: I'd disagree. I'd say that the proper way to do this is to implement a custom NSCell subclass (a la ImageAndTextCell). This is more in line with the framework: the cell is given an object value, which the cell represents by drawing into a view.