• 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: NSWindow title bar icon without representedURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow title bar icon without representedURL


  • Subject: Re: NSWindow title bar icon without representedURL
  • From: "email@hidden" <email@hidden>
  • Date: Thu, 21 Feb 2008 13:59:28 +0000

Hello Jean

I also tried [<window> standardWindowButton:NSWindowDocumentIconButton] and got nowhere.
Your extended code works fine.


My old brain got hung up on the fact that I have no file associated with my window.

Ergo, guilty of dumbness.

Thanks

Jonathan


On 21 Feb 2008, at 12:35, Jean-Daniel Dupas wrote:


Le 21 févr. 08 à 13:21, Jean-Daniel Dupas a écrit :

Le 21 févr. 08 à 13:07, email@hidden a écrit :
Hello All

I would like to place an icon in the window title bar without a corresponding representedURL.
I know what the HIG says about this but I would like to emulate finder's behaviour when selecting an item from its outline view sidebar.


I have a list of local and network resources and would like the titlebar icon to reflect the selection (local or network) as the user may collapse the resource browser, denying them info regarding the resource they are operating on.

Can I create an NSUrl proxy of some sort?

Or is just one of those "it's right in front of you, Dummy" situations.
If so, please address replies to "Dear Dummy,".


The target is Leopard.

Regards

Jonathan


You was very close to the answer.
See what the -representedURL documentation says:

You can customize the file icon in the tile bar with the following code:
[[<window> standardWindowButton:NSWindowDocumentIconButton] setImage:<image>];


I do not send this message to "Dear dummy" because i didn't try and don't know if it works ;-) Maybe it's not so simple._______________________________________________

So, after a simple test, it appears that is not so simple.
[<window> standardWindowButton:NSWindowDocumentIconButton] returns nil if there is no URL setted.


I find a workaround anyway:

[uiWindow setRepresentedURL:[NSURL fileURLWithPath:@"Your Window Title"]];
NSImage *img = [NSImage imageNamed:@"EnergySaver"];
[img setSize:NSMakeSize(16, 16)]; // scale your image if needed (and maybe should use userSpaceScaleFactor)
[[uiWindow standardWindowButton:NSWindowDocumentIconButton] setImage:img];


And also implements this delegate function.

- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu: (NSMenu *)menu {
return NO;
}



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >NSWindow title bar icon without representedURL (From: "email@hidden" <email@hidden>)
 >Re: NSWindow title bar icon without representedURL (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSWindow title bar icon without representedURL (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Garbage collection performance
  • Next by Date: Re: FSFindFolder PDF Services
  • Previous by thread: Re: NSWindow title bar icon without representedURL
  • Next by thread: FSFindFolder PDF Services
  • Index(es):
    • Date
    • Thread