• 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: Changing Icons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing Icons


  • Subject: Re: Changing Icons
  • From: Nathan Day <email@hidden>
  • Date: Thu, 2 May 2002 16:43:43 +0930

There is a bug that prevents setting the icon of files that already have a custom icon, I sent in a bug fix for it but last time I looked Troy hadn't released an update with the fix, he's a busy man. Also the class works by creating a resource for the file and storing the icon data in there with all correct flags set, but folders don't have resource fork. In mac OS 9 this is done with and invisible file called 'Icon\n' pretty sure it's a return that it ends with, OS X seems to be the same, you might have success if instead of saving the custom icon to the folder you specify the 'Icon\n' file instead. It would be good if IconFamily handled this automaticly.
From your original post it seems to me what you want to do is create an IconFamily with the iconFamilyWithIconOfFile: method passing it you .icns file, and then apply it to your folder with the setAsCustomIconForFile: method where you paths is "<folder path>/Icon\n". There is no way to do this in Cocoa it's all carbon wrapped in Cocoa.
You can change the tint of an image by simple creating a new image of the same size, locking focus on it they drawing your original image at (0,0) and then drawing over the image with the NSRectFillUsingOperation(NSRect aRect, NSCompositingOperation op) function, look at the source code example /Developer/Examples/AppKit/CompositeLab to see what the different operations do.

On Wednesday, May 1, 2002, at 08:41 PM, Albert Atkinson wrote:

Hello!

Found some good learning code there but it does not solve my problem. It looks like MAYBE the "saveThumbnailToIcnsFile:" action is what I am looking for but when I try it out in the built app it does not work. Furthermore I just want folders to be able to receive the custom icon instead of ICNS files. Maybe if I explain more:

What will happen is first: my user will select a folder in the Finder, then he will switch to my app (maybe have a utility panel with no hide on deactivate command)

The user will then select an item from a pop up menu and it will be inserted into a string with "iconlabel = [[iconlabelPopUpButton selectedItem] tag];"

Then my app will test that string and based on the item selected it will set the custom icon of that folder to the correct one in the app's package.

Maybe if someone could point me to some documentation that describes every method in detail?

Also, does any of you know how I would change the tint of an icon? (Look in Can Combine Icons for an example)

Thanks!

Albert

On Wednesday, May 1, 2002, at 05:44 AM, Nathan Day wrote:
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Changing Icons
      • From: David Remahl <email@hidden>
References: 
 >Re: Changing Icons (From: Albert Atkinson <email@hidden>)

  • Prev by Date: Re: NSTextView: how to avoid insertion of text
  • Next by Date: NSString problem
  • Previous by thread: Re: Changing Icons
  • Next by thread: Re: Changing Icons
  • Index(es):
    • Date
    • Thread