--00151750e50a769b15046375a816 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Adam, Thanks for looking into this for me! kComputer is defined in the IconsCore.h header file in CoreServices.framework/LaunchServices.framework. (tried referencing it as KComputer, but that didn't work) I tried your example and it just returned the generic "unknown file-type" icon. :( I am trying to load the system icon for the computer... it's really easy in Ubuntu to load stock (system) icons, so I am really frustrated when I can't seem to figure this out on my lovely mac :'( Any ideas..? Thanks Tom On Fri, Feb 20, 2009 at 11:06 PM, Adam Gardner <adam.oddfellow / gmail.com>wrote: > Tom Medhurst wrote: > > Hi There, > > > > I am trying to create an NSImage which contains the system kComputer > > icon. Unfortunately RubyCocoa can't resolve kComputer or > > use :kComputer or it's header value 'root'.. I have tried the > > following: > > > > 1. NSWorkspace.sharedWorkspace.iconForFileType(NSFileTypeForHFSTypeCode > > (:root)) > > 2. NSWorkspace.sharedWorkspace.iconForFileType(NSFileTypeForHFSTypeCode > > (:kComputer)) > > 3. NSWorkspace.sharedWorkspace.iconForFileType(NSFileTypeForHFSTypeCode > > (kComputer)) > > 4. NSWorkspace.sharedWorkspace.iconForFileType(NSFileTypeForHFSTypeCode > > (NSNumber.numberWithUnsignedLong('root'))) > > > > 5. NSWorkspace.sharedWorkspace.iconForFileType(:root) > > 6. NSWorkspace.sharedWorkspace.iconForFileType(:kComputer) > > 7. NSWorkspace.sharedWorkspace.iconForFileType(kComputer) > > etc... > > > > Has anybody got this to work in RubyCocoa? > > Many Thanks > > *Tom Medhurst* > > First off, since in Ruby all constants begin with a capital letter, all > the constants like kSuchAndSuch morph into OSX::KSuchAndSuch. > > Second of all, where on earth is kComputer defined? I can't find it > documented *anywhere*; in particular, it's not in this list: > > http://developer.apple.com/documentation/Carbon/Reference/IconServices/Reference/reference.html#//apple_ref/doc/uid/TP30000239-CH4g-TPXREF130 > > Third, it seems to me that the iconForFileType method of NSWorkspace > takes a string representing either a filename extension or a HFS file > type. So if anything of these is going to work, it'd be: > > OSX::NSWorkspace.sharedWorkspace.iconForFileType('root') > > which does, in fact, return an NSImage instance for me. Of course, I get > an NSImage with every string I've tried, including the empty string - I > haven't tried drawing it on screen to see if it's the one you want, > since I don't have anywhere to draw it to, as it were. But it should be > a good place for you to start. > -- > Posted via http://www.ruby-forum.com/. > > --00151750e50a769b15046375a816--